It's all about the answers!

Ask a question

Unexpected result when querying a work item via OSLC


usman syed ali (1539) | asked Jan 07 '16, 3:22 a.m.
edited Jan 07 '16, 4:18 a.m.
Via OSLC, I want to query all the work items in RTC that are of type "change request" and have state "SIT Setup In Progress". 

The following is the get url I am using in my java program to get the response and it returns all the work items in the project area:

https://werational02:9443/ccm/oslc/contexts/(Project UUID)/workitems/

I am printing on the console the response in json that is returned. See snippet below:

{"prefixes":{"rdf":"http:\/\/www.w3.org\/1999\/02\/22-rdf-syntax-ns#","oslc":"http:\/\/open-services.net\/ns\/core#"},"rdf:about":"https:\/\/werational02.corp.alahli.com:9443\/ccm\/oslc\/contexts\/_ZoC0QNS3EeGPlow7Bl9IAw\/workitems","oslc:results":[{"rdf:type":[{"rdf:resource":"http:\/\/open-services.net\/ns\/cm#ChangeRequest"}],"rdf:resource":"https:\/\/werational02.corp.alahli.com:9443\/ccm\/resource\/itemName\/com.ibm.team.workitem.WorkItem\/5412"},{"rdf:type":[{"rdf:resource":"http:\/\/open-services.net\/ns\/cm#ChangeRequest"}],"rdf:resource":"https:\/\/werational02.corp.alahli.com:9443\/ccm\/resource\/itemName\/com.ibm.team.workitem.WorkItem\/36387"},{"rdf:type":[{"rdf:resource":"http:\/\/open-services.net\/ns\/cm#ChangeRequest"}],"rdf:resource":"https:\/\/werational02.corp.alahli.com:9443\/ccm\/resource\/itemName\/com.ibm.team.workitem.WorkItem\/1839"},{"rdf:type":[{"rdf:resource":"http:\/\/open-services.net\/ns\/cm#ChangeRequest"}],"rdf:resource":"https:\/\/werational02.corp.alahli.com:9443\/ccm\/resource\/itemName\/com.ibm.team.workitem.WorkItem\/7113"}

I am expecting more attributes to be returned for each work item for example state,modified,title,owned by,creator etc. But the response only gives rdf resource with a link that shows the ID of the work item.

Please help me to achieve the desired result.

Thank You.


Accepted answer


permanent link
Donald Nong (14.4k314) | answered Jan 08 '16, 4:46 a.m.
edited Jan 08 '16, 4:47 a.m.
What is the exactly URI that you used for the query?

You should use "oslc.select" to select attributes shown in the result set. If you haven't done so, you will get the result similar to what you have posted.

Refer to this article for more details.
https://jazz.net/library/article/1001
usman syed ali selected this answer as the correct answer

One other answer



permanent link
usman syed ali (1539) | answered Jan 10 '16, 9:54 a.m.
Thanks a lot Donald for your help. I am able to fetch those specific properties.

My objective is to find all the work items that are of type "Change Request" having status "SIT Setup In Progress" and 

are related to certain applications (Filed Against).

I am having a difficult time constructing the query using oslc.where.




The URI I am using in my query is: 

https://rtcdevsrv1.corp.alahli.com:9443/ccm/oslc/contexts/_ZoC0QNS3EeGPlow7Bl9IAw/workitems?

oslc.select=dcterms:type,dcterms:identifier,dcterms:title,dcterms:modified,dcterms:created,rtc_cm:filedAgainst,oslc_c

m:status and oslc.where=dcterms:type="Change Request"

When I use the where clause the returned result shows everything. How can I fix my where clause? (I am using RTC

 4.0.1)

Thanks again for your above solution.

Comments
Donald Nong commented Jan 10 '16, 6:50 p.m.

You may have to use "rtc_cm:type" instead of "dcterms:type". See below posts.
https://jazz.net/forum/questions/85789/oslc-simple-query
https://jazz.net/forum/questions/86619/oslc-20-query-with-oslcwhere-parameter-dctermstype-returns-400-unknown-attribute-id

The OLSC API is used by many users and most of the known issues have been reported in this forum. So chances are you should find a solution in some old posts.


usman syed ali commented Jan 13 '16, 2:59 a.m.

 Those links were really helpful I am able to fetch results using oslc.where. I have used the following way to get those specific work items



A literal id was used instead of the value in the oslc.where clause.

Your answer


Register or to post your answer.