Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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.

0 votes


Accepted answer

Permanent link
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

0 votes

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.

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,938
× 562
× 479
× 137

Question asked: May 12 '14, 12:12 p.m.

Question was seen: 5,158 times

Last updated: May 19 '14, 10:37 a.m.

Confirmation Cancel Confirm