Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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.

1

1 vote



3 answers

Permanent link

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
	

0 votes


Permanent link

In our environment - we can use the URI for Work Item Types

https://myjazzserver.com:9443/jazz/oslc/types/_8IloQGRKEeGMeeKcLm-Fsg/

It will retrieve the xml of all the work item types in the project area

This snippet is for work item type Story

  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
https://myjazzserver.com:9443/jazz/oslc/contexts/_8IloQGRKEeGMeeKcLm-Fsg/workitems?oslc.where=rtc_cm:type="com.ibm.team.apt.workItemType.story"
 
List of Stories with Attributes
https://myjazzserver.com:9443/jazz/oslc/contexts/_8IloQGRKEeGMeeKcLm-Fsg/workitems?oslc.where=rtc_cm:type="com.ibm.team.apt.workItemType.story"&oslc.select=dcterms:type,dcterms:identifier,dcterms:type,rtc_cm:type
  
You can also get the Work Item Type ID (dcterms:identifier) by going into :

Manage This Project Area -> Work Items -> Types and Attributes: use the ID associated with the Work Item Type

0 votes


Permanent link
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")

0 votes

Your answer

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

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 12,019
× 516
× 201

Question asked: Mar 06 '15, 4:28 a.m.

Question was seen: 8,716 times

Last updated: Nov 03 '15, 8:08 a.m.

Confirmation Cancel Confirm