Finding out if an RTC build is tagged through the REST API
Hello!
I've learned a little about the resful apis, and am interesting in getting information about builds that we have applied a tag to.
I can successfully run this sort of query:
https://<my_jazz_location>/rpt/repository/build?fields=build/buildResult[buildDefinition/id='<my_build_id>']/(buildDefinition/projectArea/name|label|buildStatus|timeTaken)
I also noticed that you can list out different parameters besides buildStatus / label / timeTaken.
I found what looked to be a comprehensive list here:
https://jazz.net/wiki/bin/view/Main/ReportsRESTAPI#build
I noticed 2 things:
1) compilationResults doesn't seem to work as a field
2) There is no field for tags
Can you suggest an alternative way with the REST API for me to check if a build has a tag associated with it?
Additionally, is there a limit to the amount of results returned, and is there a way to query for all results?
Any help would be appreciated!
|
Accepted answer
You could also try, e.g.
https://jazz.net/jazz/resource/virtual/build/results?definition=rtc.jcb&profile=REDUCED&_prettyPrint=true This uses the internal REST interface supporting our web UI and VS clients. The _prettyPrint arg is just for debugging. Normally you'd specify an Accept header with text/json as the format, and omit the _prettyPrint. John Harvey selected this answer as the correct answer
Comments
John Harvey
commented Sep 10 '13, 10:14 a.m.
Hi Nick,
Thank you very much for this reply. This actually works quite well!
I think I'll still keep 279053 open to see if I can get that function ported to the documented REST api, but this is really a cool solution, and works like a champ.
I did have one follow-up; this may be a simple question, but I noticed that with such a query I get "all" results, whereas with the rest-API, I'm limited to 100 results (so, if my build definition has 150 builds, I only get 100 through the original REST call I was making). Is there a parameter I need to set on the restful api so that I don't have limited results? Not sure if you'd know that offhand.
Thanks!
John Harvey
commented Sep 10 '13, 1:48 p.m.
For anyone watching, the limit to 100 can be stretched by adding:
&size=1000
to the end of a query.
For example:
https://<jazz_repo>/jazz/rpt/repository/build?fields=build/buildResult[buildDefinition/id="<my_stream>" and buildStatus="OK" and buildState="COMPLETED" and personalBuild=false]/(buildDefinition/projectArea/name|buildStatus|buildState|label|timeTaken|personalBuild|startTime|timeWaiting|buildDefinition|itemId)&size=1000
The default is 100; the above works great if the number of build results > 100 but < 1000 results.
|
3 other answers
Regarding paging, if there is more to the result, it should include a rel="next" URL in the top element.
e.g. for https://jazz.net/jazz/rpt/repository/build?fields=build/buildResult%5BbuildDefinition/id='rtc.jcb'%5D/(buildDefinition/projectArea/name%7Clabel%7CbuildStatus%7CtimeTaken)
the top element is:
<build Version="1.0.0" rel="next" href="https://jazz.net/jazz/rpt/repository/build?fields=build%2FbuildResult%5BbuildDefinition%2Fid%3D%27rtc.jcb%27%5D%2F%28buildDefinition%2FprojectArea%2Fname%7Clabel%7CbuildStatus%7CtimeTaken%29&id=_T3bhqxpKEeOwis1DfBnHNg&size=100&pos=100">
For more details, see the whitepaper link in the General Documentation section of:
https://jazz.net/wiki/bin/view/Main/ReportsRESTAPI#General_documentation
|
If anyone follows this thread, I have raised enhancement 279053 to make the request to add the tags field to the restful api.
Heres the link:
https://jazz.net/jazz/web/projects/Rational%20Team%20Concert#action=com.ibm.team.workitem.viewWorkItem&id=279053
|
Based on my investigation, it seems that you cannot query for tags through the build rest-API.
I really wish you could.
I came up with an alternative plan:
1) Query for good builds, and add the itemId parameter
https://<jazz_repo>/jazz/rpt/repository/build?fields=build/buildResult[buildDefinition/id="<my_stream>" and buildStatus="OK" and buildState="COMPLETED" and personalBuild=false]/(buildDefinition/projectArea/name|buildStatus|buildState|label|timeTaken|personalBuild|startTime|timeWaiting|buildDefinition|itemId)
2) Using the itemId's, query this:
https://<jazz_repo>/jazz/resource/virtual/build/resultrecord/<itemId>
Unfortunately, this means that I have to loop for every itemId, through every stream (so, a double-for loop), whereas if the tag information was available as part of the build restful api, I could just have a single loop.
So, I would love to have that functionality! It's the difference of 1 minute vs. 20 minutes, so it'd be great to have in a future version of the restful api.
I also wonder.. what is the second site I'm hitting there? It doesn't seem to be part of the restful api; so, what is it? I see it referenced in a few docs on the web, so it's definitely valid. Is it ok for me to hit that link?
|
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.