It's all about the answers!

Ask a question

Is There a Simple Work Item Query Via REST API?


Allen Boone (312) | asked Sep 01 '15, 3:39 p.m.
I've been looking through the docs and Googling around the web for information on a REST API for querying work items. I've found some old, seemingly outdated information, and I saw a rather complicated API with OLSC that requires multiple calls to just get to the service I need. What I'm looking for is a simple way to query work items in a Node.js app. Something like, 
GET https://<rtc_host>:<port>/services/workitems?owner=bob&open=true?foundIn=iteration3
that returns some nice JSON (though I'd settle for nasty XML) with a list of work items that meet the search criteria.

Does something like this exist? If not, can you point me toward a tutorial or some documentation for how to use the existing APIs for querying work items? 

Accepted answer


permanent link
Donald Nong (14.5k414) | answered Sep 01 '15, 9:02 p.m.
Yes it can be easily done with RTC OSLC API. The query would look like this

To get the response in JSON format, simply add the HTTP Request Header "Accept: application/json".

For more details about using the OSLC API, see below articles.
https://jazz.net/library/article/1001
https://jazz.net/wiki/bin/view/Main/WorkItemAPIsForOSLCCM20#Examples
Allen Boone selected this answer as the correct answer

Comments
Allen Boone commented Sep 03 '15, 11:00 a.m.

Thanks for the help. The approach in the first article worked, but it says that the only URI I should keep in the code is the rootservices path. Doing so requires a couple of extra REST calls that I'd like to avoid, however. Is it necessary to follow this procedure, or can I save the workitems service path? Is it likely to change? 


Allen Boone commented Sep 03 '15, 11:04 a.m.

 Thanks for the help. The approach in the first article worked, but it says that the only URI I should keep in the code is the rootservices path. Doing so requires a couple of extra REST calls that I'd like to avoid, however. Is it necessary to follow this procedure, or can I save the workitems service path? Is it likely to change? 


Donald Nong commented Sep 03 '15, 9:54 p.m.

If there is no configuration changes, such as server rename, version upgrade and etc, the path/URL stays the same.


Allen Boone commented Sep 15 '15, 1:37 p.m.

Is there a way to get a list of resources, such as the categories for filedAgainst? I haven't been able to figure out how to get the references that I need for my queries through the REST interface. 

Your answer


Register or 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.