It's all about the answers!

Ask a question

how to sort the result of an XML based on the value to any tag in OSLC & REST API?


Rishi Sharma (6616) | asked Jun 30 '15, 2:14 p.m.
 how to sort the result of an XML based on the value to any tag like oslc:Modified or oslc:shortId
using OSLC or REST API queries?

2 answers



permanent link
Rafael Rodriguez Montes (23013130258) | answered Jun 30 '15, 3:45 p.m.

Hi Rishi,

I did that using a java client, and I did through sorting algorithm that you can find easily but it depends how you are consuming the web services, as far I know I haven see a function on the api for that? I'm curious too?


permanent link
Donald Nong (14.5k614) | answered Jun 30 '15, 9:02 p.m.
Since you tagged this question with both RTC and RQM, I assume that you are interested in both tools.

If you want to use the OSLC sort feature, it has to be implemented in the tools to begin with. So it may work, or may work on some attributes, or may not work at all.

For RTC, contrary to the document, I have not found a reliable way to sort any of the attributes of a work item (with RTC 5.0.2). The "oslc.orderBy" parameter has no effect without the "OSLC-Core-Version: 2.0" header and gives out an error with the header.
https://jazz.net/wiki/bin/view/Main/WorkItemAPIsForOSLCCM20

For RQM, you can try the "sort" parameter which should sort the artifacts on modified date. It appears that modified date is the only attribute supports sorting though. So "shortId" is out.
https://jazz.net/wiki/bin/view/Main/RqmApi#sort

All in all, I think you will have to do the same thing as Rafael mentioned and sort the items _after_ retrieving the items from the OSLC/REST call.

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.