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

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 Join to answer
Community showcase
Teodora [Botron]
Published Thursday in Marketplace Apps

Jira Inferno: The Nine Circles of Jira Administration Hell

If you spend enough time as a Jira admin - whether you are managing a single, mid-sized instance, a large enterprise one or juggling multiple instances at once - you will eventually find yourself in ...

413 views 1 13
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot