Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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.

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

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

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

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...

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

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...

<html><head><title>Apache Tomcat/6.0.32 - Error report</title><style><!--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;}--></style> </head><body><h1>HTTP Status 401 - Basic Authentication Failure - Reason : AUTHENTICATION_DENIED</h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u>Basic Authentication Failure - Reason : AUTHENTICATION_DENIED</u></p><p><b>description</b> <u>This request requires HTTP authentication (Basic Authentication Failure - Reason : AUTHENTICATION_DENIED).</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/6.0.32</h3></body></html>

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"


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

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"
<html><head><title>Apache Tomcat/6.0.32 - Error report</title><style><!--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;}--></style> </head><body><h1>HTTP Status 401 - Basic Authentication Failure - Reason : AUTHENTICATION_DENIED</h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u>Basic Authentication Failure - Reason : AUTHENTICATION_DENIED</u></p><p><b>description</b> <u>This request requires HTTP authentication (Basic Authentication Failure - Reason : AUTHENTICATION_DENIED).</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/6.0.32</h3></body></html>

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"

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

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.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bamboo

Bamboo Data Center - Early Access Program

G’day Bamboo customers, The wait is almost over! We are in the final stages of work on the first release of Bamboo Data Center, our self-managed enterprise offering of Bamboo. This Data Center offe...

945 views 0 16
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you