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 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 Thursday in Jira

5 ways you can make the most of Jira Software and Bitbucket Cloud

As part of the Bitbucket product team I'm always interested in better understanding what kind of impact the use of our tools have on the way you work. In a recent study we conducted of software devel...

73 views 0 5
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