Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,463,370
Community Members
 
Community Events
176
Community Groups

Using the REST api from Bamboo on demand

The latest I can find on this is this question and the link in the third answer is dead

https://answers.atlassian.com/questions/236167

This was last updated in 2013 and I wondered if there is a way of triggering Cloud Bamboo build plans via cURL?

 

11 answers

1 accepted

1 vote
Answer accepted
rsperafico Atlassian Team Apr 08, 2015

Hello Lee,

Please, run the following http://myhost.com:8085/bamboo/rest/api/latest/info [GET]:

# [USERNAME], i.e.: myuser
# [MYCOMPANY], i.e.: mycompany
curl -D- -u [USERNAME] -p -H "Content-Type: application/json" -X GET https://[MYCOMPANY].atlassian.net/builds/rest/api/latest/info

Kind regards,
Rafael P. Sperafico
Atlassian Support

Sharing this for others having the same issue. 

AUTHENTICATION_DENIED on the login meant the user needed to fill out the CAPTCHA due to too many failed login attempts. 

I went to the application we were trying to use the API for and logged in. Once successfully answering the CAPTCHA the login then worked though the API.

tried this - and it worked.

curl -D- -u admin:<PASSWORD> -H "Content-Type: application/json" -X GET https://<COMPANY>.atlassian.net/builds/rest/api/latest/info

the trick is to use admin as the user and the normal account password. The <COMPANY>.atlassian.net is the url that was setup when you first signed up for bamboo.

Tried that format already but gave it another go and I still get

HTTP/1.1 401 Unauthorized

 AUTHENTICATION_DENIED

 

rsperafico Atlassian Team Apr 08, 2015

Hello Lee, Please, do not add extra parameters to the URL provided (no Authorization:Basic ***, no ?os_authType=basic). Just copy and run the cURL I have provided as it is by only replacing [USERNAME] and [MYCOMPANY]. [USERNAME] cannot be an email address as you have attempted earlier — Kind regards, Rafael P. Sperafico Atlassian Support

Ahhhh thanks, I was always under the impression that my username was my email. When I changed it my actual username that I went hunting for in my profile it worked! I was then able to add basic authorisation headers which saved me having to do a two step authentication process....many thanks

Also tried the following command too

curl -D- -p -H "Content-Type: application/json" -H "Authorization:Basic ***" -X GET "http://mycompany.atlassian.net/builds/rest/api/latest?os_authType=basic"

So I tried your curl...

curl -D- -u lee.myring@mycompany.com -p -H "Content-Type: application/json" -X GET "https://mycompany.atlassian.net/builds/rest/api/latest?os_authType=basic"

It asked me for my password which I duly entered

Enter host password for user 'lee.myring@mycompany.com':

And I received 

HTTP/1.1 401 Unauthorized
Server: nginx
Date: Wed, 08 Apr 2015 17:24:39 GMT
Content-Type: text/html;charset=utf-8
Content-Length: 1137
Connection: keep-alive
X-Seraph-LoginReason: AUTHENTICATION_DENIED
WWW-Authenticate: OAuth realm="https%3A%2F%2Fmycompany.atlassian.net%2Fbuilds"
&lt;html&gt;&lt;head&gt;&lt;title&gt;Apache Tomcat/6.0.32 - Error report&lt;/title&gt;&lt;style&gt;&lt;!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--&gt;&lt;/style&gt; &lt;/head&gt;&lt;body&gt;&lt;h1&gt;HTTP Status 401 - Basic Authentication Failure - Reason : AUTHENTICATION_DENIED&lt;/h1&gt;&lt;HR size="1" noshade="noshade"&gt;&lt;p&gt;&lt;b&gt;type&lt;/b&gt; Status report&lt;/p&gt;&lt;p&gt;&lt;b&gt;message&lt;/b&gt; &lt;u&gt;Basic Authentication Failure - Reason : AUTHENTICATION_DENIED&lt;/u&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;description&lt;/b&gt; &lt;u&gt;This request requires HTTP authentication (Basic Authentication Failure - Reason : AUTHENTICATION_DENIED).&lt;/u&gt;&lt;/p&gt;&lt;HR size="1" noshade="noshade"&gt;&lt;h3&gt;Apache Tomcat/6.0.32&lt;/h3&gt;&lt;/body&gt;&lt;/html&gt;

ok...just got your reply...will try your command

So I tried this...

curl -X GET --user lee.myring@mycompany.com:*** "https://mycompany.atlassian.net/bamboo/rest/api/latest?os_authType=basic"

and received this...

&lt;!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"&gt;
&lt;html&gt;&lt;head&gt;
&lt;title&gt;302 Found&lt;/title&gt;
&lt;/head&gt;&lt;body&gt;
&lt;h1&gt;Found&lt;/h1&gt;
&lt;p&gt;The document has moved &lt;a href="https://mycompany.atlassian.net/builds/rest/api/latest?os_authType=basic"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;hr&gt;
&lt;address&gt;Apache/2.2.3 (CentOS) Server at mycompany.atlassian.net Port 80&lt;/address&gt;
&lt;/body&gt;&lt;/html&gt;

So I then tried this...

curl -X GET --user lee.myring@mycompany.com:*** "https://mycompany.atlassian.net/builds/rest/api/latest?os_authType=basic"

and received this...

&lt;html&gt;&lt;head&gt;&lt;title&gt;Apache Tomcat/6.0.32 - Error report&lt;/title&gt;&lt;style&gt;&lt;!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--&gt;&lt;/style&gt; &lt;/head&gt;&lt;body&gt;&lt;h1&gt;HTTP Status 401 - Basic Authentication Failure - Reason : AUTHENTICATION_DENIED&lt;/h1&gt;&lt;HR size="1" noshade="noshade"&gt;&lt;p&gt;&lt;b&gt;type&lt;/b&gt; Status report&lt;/p&gt;&lt;p&gt;&lt;b&gt;message&lt;/b&gt; &lt;u&gt;Basic Authentication Failure - Reason : AUTHENTICATION_DENIED&lt;/u&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;description&lt;/b&gt; &lt;u&gt;This request requires HTTP authentication (Basic Authentication Failure - Reason : AUTHENTICATION_DENIED).&lt;/u&gt;&lt;/p&gt;&lt;HR size="1" noshade="noshade"&gt;&lt;h3&gt;Apache Tomcat/6.0.32&lt;/h3&gt;&lt;/body&gt;&lt;/html&gt;

So I followed it up with the @ symbol replaced with %40 and got the same message of AUTHENTICATIO_DENIED

curl -X GET --user lee.myring%40mycompany.com:*** "https://mycompany.atlassian.net/builds/rest/api/latest?os_authType=basic"


0 votes
rsperafico Atlassian Team Apr 08, 2015

Hello Lee

When running Bamboo under HTTPS protocol, please run the cURL command as per following:

# [METHOD], i.e.: GET, POST, PUT
curl -D- -u [USERNAME] -p -H "Content-Type: application/json" -X [METHOD]

Kind regards,
Rafael P. Sperafico
Atlassian Support

Hi Rafael, 

thanks for the super quick response. 

Whenever I try to run a command I get 301 Moved Permanently codes...for example

curl -X GET --user username:password "http://mycompany.atlassian.net/bamboo/rest/api/latest?os_authType=basic"


I know all the rest api documentation is for non-cloud bamboo...does it work for Atlassian OnDemand 

0 votes
rsperafico Atlassian Team Apr 08, 2015

Hello Lee,

Thank you for your question.

Please, refer to the following documentation for further information:

If you find this answer useful, I would kindly ask you to accept it so the same will be visible to others who might be facing the same issue you have inquired.

Thank you for your understanding.

Kind regards,
Rafael P. Sperafico
Atlassian Support

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events