It's all about the answers!

Ask a question

How can I get result for a specific build request using REST api?


Michele Pegoraro (1.8k1210599) | asked May 12 '14, 12:12 p.m.
 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


permanent link
Nick Edgar (6.5k611) | 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": {
        "com.ibm.team.repository.typeName": "com.ibm.team.build.BuildResult",
        "itemId": "_MXhtQcdvEeO185rLDU7C-w",
        "uri": "itemOid\/com.ibm.team.build.BuildResult\/_MXhtQcdvEeO185rLDU7C-w"
    },
Michele Pegoraro selected this answer as the correct answer

Comments
Nick Edgar commented May 12 '14, 12:44 p.m.
JAZZ DEVELOPER

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. 


Michele Pegoraro commented May 15 '14, 6:13 a.m.

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?


Nick Edgar commented May 15 '14, 12:09 p.m.
JAZZ DEVELOPER

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.


Michele Pegoraro commented May 19 '14, 10:37 a.m.

Thanks Nick. I will use this way.

Your answer


Register or to post your answer.