How to use oslc.query in the RTC RESTful simply query interface
I am trying to write some Perl code to use the RESTful interface on RTC to access workitems. I am able to get the simpl_query_services URI as described in https://jazz.net/library/article/1001 and https://jazz.net/wiki/bin/view/Main/WorkItemAPIsForOSLCCM20. When I use the basic URI, eg
https://myjazzserver.com:9443/jazz/oslc/contexts/_8IloQGRKEeGMeeKcLm-Fsg/workitems then all seems to work well and I get a collection of workitems returned (in fact all the workitems in the Project). However, I have not been able to work out how to do a 'where' query to select a subset of these workitems, eg https://myjazzserver.com:9443/jazz/oslc/contexts/_8IloQGRKEeGMeeKcLm-Fsg/workitems?oslc.where=dc:identifier="1832" again returns all the workitems in the project. In fact, whatever I put in the where clause seems to have absolutely no effect. Can anyone say what the correct syntax is for these types of queries? I want to be able to do queries based on id and also on workitem type, which seems to be a more complex resource type. For instance we have a workitem type called 'build' in our project, and i would like to be able to find all the workitems of that type. The type is indicated in the workitem description by elements such as <dc:type rdf:resource="https://jazz201.hursley.ibm.com:9443/jazz/oslc/types/_8IloQGRKEeGMeeKcLm-Fsg/build"/> so how should I construct a query to find all these items - i tried https://myjazzserver.com:9443/jazz/oslc/contexts/_8IloQGRKEeGMeeKcLm-Fsg/workitems?oslc.where=dc:type="build" but this does not work. How does the oslc_prefix parameter play in all of this? Any help or examples greatly appreciated. |
3 answers
I'm new to oslc but here is an example that works for me ?oslc.where=dcterms:identifier=1832&oslc.select=dcterms:identifier,dcterms:title,oslc_cm:status,dcterms:contributor,oslc_cm:closed |
In our environment - we can use the URI for Work Item Types
It will retrieve the xml of all the work item types in the project area This snippet is for work item type Story
Notice dcterms:identifier = com.ibm.team.apt.workItemType.story Use com.ibm.team.apt.workItemType.story in the oslc.where clause
List of Stories
Manage This Project Area -> Work Items -> Types and Attributes: use the ID associated with the Work Item Type |
In other articles (e.g. https://jazz.net/forum/questions/89876/can-i-use-work-item-type-as-query-parameter-in-reportable-rest-api) I have found the hint that workItemType is something like a "complex" attribute and one needs to use on its "id". For me, this olsc.where expression worked (I replaced my type with your "build" type)
oslc.where=workItemType%2Fid%3D%22build%22 (decoded: oslc.where=workItemType/id="build") |
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.