It's all about the answers!

Ask a question

How do I sort the results of a query using REST API?


Andre Gusmao (801937) | asked Jul 22 '14, 1:42 p.m.
Hello,

I have a very simple REST API query to retrieve all work items created within a time frame:

https://localhost:9443/ccm/rpt/repository/workitem?fields=workitem/workItem[creationDate>2014-07-14T00:00:00.00-0300 and creationDate<2014-07-20T23:59:59.99-0300]/(id|summary|creator/name)&size=100

The question is: is it possible to sort the results by any of the attributes? For example, I would like to sort the results by the creator name.

Thanks in advance.

Accepted answer


permanent link
Donald Nong (14.4k314) | answered Jul 22 '14, 9:43 p.m.
You're using reportable REST API which does not mention sorting in its specification. Depending on your programming language, you can do the sorting on the resulting XML response once you get it.
If you don't have to use the reportable REST API, consider using the OSLC REST API (they are different). Below is a previous discussion on this topic.
https://jazz.net/forum/questions/157431/how-to-get-sorted-workitems-list-by-using-oslc
Andre Gusmao selected this answer as the correct answer

Your answer


Register or to post your answer.