Calling Bamboo API does not return full body in Scriptrunner

I'm trying to get a Bamboo build number, in order for it to be used in JIRA version. The problem I'm facing is when I call the following API in Scriptrunner console

def issueKey = 'esp-45'

def string1 = get('https://mybamboo.com/rest/api/latest/result?issueKey=' + issueKey).asString().body

it returns only 

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><results expand="results"><results expand="result" start-index="0" max-result="0" size="0"/><link href="https://mybamboo.com/rest/api/latest/result" rel="self"/></results>

 Rather than 

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<results expand="results">
<results expand="result" start-index="0" max-result="1" size="1">
<result key="ESP-DEP-32" state="Successful" lifeCycleState="Finished" number="32" id="7372921">
<link href="https://mybamboo.com/rest/api/latest/result/ESP-DEP-32" rel="self"/>
<plan key="ESP-DEP" name="eSP - eSP Build Plan" shortName="eSP Build Plan" shortKey="DEP" type="chain" enabled="true">
<planKey>
<key>ESP-DEP</key>
</planKey>
<link href="https://mybamboo.com/rest/api/latest/plan/ESP-DEP" rel="self"/>
</plan>
<buildResultKey>ESP-DEP-32</buildResultKey>
<planResultKey>
<key>ESP-DEP-32</key>
<entityKey>
<key>ESP-DEP</key>
</entityKey>
<resultNumber>32</resultNumber>
</planResultKey>
<buildState>Successful</buildState>
<buildNumber>32</buildNumber>
</result>
</results>
<link href="https://mybamboo.com/rest/api/latest/result" rel="self"/>
</results>

 which is returned with Postman, for example.

https://mybamboo.com/rest/api/latest/result?issueKey=ESP-45

1 answer

1 accepted

0 votes
Accepted answer

Hi Anton,

This sounds a bit trivial but in your example:

def issueKey = 'esp-45'

You could try changing the value to upper case to match what is in the returned result (i.e. 'ESP-45')

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted 10 hours ago in Jira Service Desk

Looking for anyone who has switched from Zendesk to Jira Service Desk

Hi Community! The Jira Service Desk marketing team is looking for customers who have successfully switched from Zendesk to Jira Service Desk!   We’d love to hear your thoughts on the pros and ...

15 views 0 1
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