• 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 vote
Joe Clark 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?

Joe Clark 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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published May 18, 2017 in Bamboo

FAQ: How to Upgrade Bamboo Server

Bamboo 5.9 will no longer be supported after June 12, 2017. What does this mean? As part of our End of Life policy, Atlassian supports major versions for two years after the first major iteratio...

1,813 views 0 6
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you