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
  • Community
  • Products
  • Bamboo
  • Questions
  • What is the JSON data structure for the following API method in bamboo https://docs.atlassian.com/bamboo/REST/5.8.0/#d2e653

What is the JSON data structure for the following API method in bamboo https://docs.atlassian.com/bamboo/REST/5.8.0/#d2e653

It seems that the examples are missing when i click on the links to show JSON request example it doesnt work.

I need to kick off a build with a JSON payload.

 

https://docs.atlassian.com/bamboo/REST/5.8.0/#d2e653

1 answer

0 votes
HeyJoe Atlassian Team May 03, 2015

I'm pretty sure you can actually submit a HTTP POST request with an empty body - the information required to queue the build is embedded in the URL pattern.

EDIT: 

If you need to specify additional information, such as overriding custom variable values, you can do that by either appending them as query parameters, or sending them as a form-encoded request body.  Here's an example:

curl -vvv -X POST -u admin:admin 'http://localhost:6990/bamboo/rest/api/1.0/queue/PROJECT-PLAN?bamboo.variable.MyCustomerVariable=true'
* Hostname was NOT found in DNS cache
*   Trying ::1...
* Connected to localhost (::1) port 6990 (#0)
* Server auth using Basic with user 'admin'
> POST /bamboo/rest/api/1.0/queue/PROJECT-PLAN?bamboo.variable.MyCustomerVariable=true HTTP/1.1
> Authorization: Basic YWRtaW46YWRtaW4=
> User-Agent: curl/7.37.1
> Host: localhost:6990
> Accept: */*
>
< HTTP/1.1 200 OK
* Server Apache-Coyote/1.1 is not blacklisted
< Server: Apache-Coyote/1.1
< Set-Cookie: JSESSIONID=79C73D864B26AB65E4CB4DB8D27CD0CA; Path=/
< X-Seraph-LoginReason: OK
< X-Content-Type-Options: nosniff
< cache-control: private, max-age=0, no-cache
< Content-Type: application/xml
< Content-Length: 287
< Date: Mon, 04 May 2015 15:04:34 GMT
<
* Connection #0 to host localhost left intact
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><restQueuedBuild buildResultKey="PROJECT-PLAN-4" buildNumber="4" planKey="PROJECT-PLAN"><triggerReason>Manual build</triggerReason><link rel="self" href="http://localhost:6990/bamboo/rest/api/1.0/result/PROJECT-PLAN-4"/></restQueuedBuild>

So query params are the preferred way to send variables for a build?

HeyJoe Atlassian Team May 04, 2015

@Douglas Macqueen - oh, do you mean you want to specify some custom variables when triggering the build? In that case, you can specify them as query parameters or as a form-encoded request body (the documentation appears to be inconsistent on whether or not JSON is accepted). I've edited my answer to include an example.

Thanks. I did some tests with both form encoded body params and query params it seems that form encoded sometimes do not get picked up. Ill stick with query params for now.

Suggest an answer

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

Unable to add or edit Bitbucket Cloud repository in Bamboo

On 31 May, a GDPR-related change went live in the Bitbucket Cloud API that resulted in users not being able to create or edit Bitbucket Cloud Linked repositories in Bamboo. This API update removed t...

552 views 2 7
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