• 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

Douglas Macqueen May 2, 2015

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
Joe Clark
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 3, 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>
Douglas Macqueen May 4, 2015

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

Joe Clark
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 4, 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.

Douglas Macqueen May 5, 2015

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
TAGS
AUG Leaders

Atlassian Community Events