How can I get result for a specific build request using REST api?
![]()
Hi,
I'm looking for a way to get a specific build result through REST api. The scenario is: I launch a build using REST api, and then get the RequestUUID. I'd like to query this single build request result.
Currently I'm requesting all the build results for a single build definition and then parsing it using regex. But I've problem with this exception:
Build result handles array can not exceed 512 elements
512 build results is not enough for my client so reducing purge policy is not a way I can use.
Is it possible to query single request results?
Thanks,
Michele.
|
Accepted answer
![]()
Nick Edgar (6.5k●7●11)
| answered May 12 '14, 12:41 p.m.
JAZZ DEVELOPER edited May 12 '14, 12:45 p.m.
Hi Michele. The REST interface should really return both the build request UUID and the build result UUID. Feel free to open an enhancement request for this. Also, please file an item for the 'cannot exceed 512 elements' and we can follow up on that separately.
One workaround is to fetch the BuildRequest item via the .../itemOid/... URL, e.g.
https://jazzdev.torolab.ibm.com:9443/jazz/resource/itemOid/com.ibm.team.build.BuildRequest/_MXgfIMdvEeO185rLDU7C-w?_mediaType=text/json&_prettyPrint=true
returns:
"buildResult": { Michele Pegoraro selected this answer as the correct answer
Comments Note that the _mediaType and _prettyPrint query args are just for debugging. In a programmatic request you would specify an Accept header with text/json. Thanks Nick for your answer. Once I've the buildResult itemId how can I get the complete element (for example to get buildResult status SUCCESSFUL/FAILED)? Can I use this uri I have in return from buildRequest call? You can either request .../resource/virtual/build/result/[result itemID UUID] or .../resource/itemOid/com.ibm.team.build.BuildResult/[result itemID UUID]. The latter normally redirects to the web UI when pasted into a browser, but if requesting with Accept header of text/xml or text/json, it'll give you the item. There's also .../resource/virtual/build/resultrecord/[result itemID UUID] which gives more info including the request item. Thanks Nick. I will use this way. |