• 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

This widget could not be displayed.
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
Community showcase
Posted Tuesday in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

199 views 1 3
Join discussion

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