Friday, July 12, 2013

RTC Rest API

Setup

Use a REST client, add headers as mentioned along the requests.

Get Root services

https://[RTCSERVER]/jazz/rootservices

Get a list of projects on the RTC server

https://[RTCSERVER]/jazz/oslc/workitems/catalog

Workitems

Fetch list of all workitems for a project, without details.

Headers
Accept: application/xml
OSLC-Core-Version: 2.0

https://[RTCSERVER]/jazz/oslc/contexts/[PROJECT_UUID]/workitems


Fetch list of all workitems for a project, with all details.

Headers
Accept: application/xml

https://[RTCSERVER]/jazz/oslc/contexts/[PROJECT_UUID]/workitems

Fetch all workitems for a project, specify the attributes that should be returned by the API, select

Headers
Accept: application/xml
OSLC-Core-Version: 2.0

https://[RTCSERVER]/jazz/oslc/contexts/[PROJECT_UUID]/workitems?oslc.select=dcterms:identifier,dcterms:title,dcterms:description,dcterms:type,dcterms:contributor,rtc_ext:com.ibm.team.apt.attribute.complexity,rtc_ext:groomed,rtc_cm:com.ibm.team.workitem.linktype.parentworkitem.parent,rtc_cm:plannedFor,oslc_cmx:priority,rtc_cm:state,oslc_cmx:project,rtc_cm:filedAgainst,rtc_ext:release_ticket_ID&oslc.pageSize=100

RTC 4.x and above API throttles the data to 50 records by default and a max of 100.
If you don't use OSLC-Core-Version header then the API won't recognize the where clause.

Fetch workitems by type and iteration

https://[RTCSERVER]/jazz/oslc/contexts/[PROJECT_UUID]/workitems?oslc.where=rtc_cm:type in ["com.ibm.team.apt.workItemType.story","task"] and rtc_cm:plannedFor="[ITERATION_UUID]"&oslc.select=dcterms:identifier,dcterms:title,dcterms:description,dcterms:type,dcterms:contributor,rtc_ext:com.ibm.team.apt.attribute.complexity,rtc_ext:groomed,rtc_cm:com.ibm.team.workitem.linktype.parentworkitem.parent,rtc_cm:plannedFor,oslc_cmx:priority,rtc_cm:state,oslc_cmx:project,rtc_cm:filedAgainst,rtc_ext:release_ticket_ID,dcterms:created,oslc_cm:closeDate&oslc.pageSize=100

Project Area > Workflow (States, Action, etc.) details

https://[RTCSERVER]/jazz/service/com.ibm.team.workitem.service.process.internal.rest.IWorkItemConfigRestService/workflows?projectAreaItemId=[PROJECT_UUID]

Fetch Actions:

https://[RTCSERVER]/jazz/oslc/workflows/[PROJECT_UUID]/actions?type=com.ibm.team.apt.workItemType.story&oslc_cm.properties=dc%3Aidentifier%2Crtc_cm%3AresultState%2Cdc%3Atitle

Reportable API


Get details of a sign-off workitem using Reportable API 
https://[RTCSERVER]/jazz/rpt/repository/workitem?fields=workitem/workItem[id=[WORITEMID]]/(projectArea/name|target/name|tags|id|summary|priority/name|owner/name|creationDate|resolutionDate|type/(id|name)|state/name|approvals/(stateIdentifier|approver/(userId|name)|stateDate)|approvalDescriptors/(id|typeIdentifier|name|cumulativeStateIdentifier|dueDate))

5 comments:

Mad Martian said...

Hi, I am trying to use OSLC to give me all work items for a particular FiledAgainst and PlannedFor. I am not able to find the proper syntax. Can you post the syntax for filtering based on those two items (in addition to the project as you have already shown)? The fields are (I think):

rtc_cm:filedAgainst
rtc_cm:plannedFor

Amit Kumar said...

Hi Martian,
Try this..

https://[RTCSERVER]/jazz/oslc/contexts/[PROJECT_UUID]/workitems?oslc.where=rtc_cm:filedAgainst="[FILEDAGAINST_UUID]" and rtc_cm:plannedFor="[ITERATION_UUID]"&oslc.select=dcterms:identifier,dcterms:title,dcterms:description,dcterms:type,dcterms:contributor,rtc_ext:com.ibm.team.apt.attribute.complexity,rtc_ext:groomed,rtc_cm:com.ibm.team.workitem.linktype.parentworkitem.parent,rtc_cm:plannedFor,oslc_cmx:priority,rtc_cm:state,oslc_cmx:project,rtc_cm:filedAgainst,rtc_ext:release_ticket_ID,dcterms:created,oslc_cm:closeDate&oslc.pageSize=100

Mad Martian said...

I'm afraid that didn't work. I got oslc_cm:totalCount="5000" (the max set in the server settings for query results) when I should be getting 316 work items (for the category and iteration I specified).

Unknown said...

Thanks a lot Amith Kumar Your Post really dragged me out of hell it helped me a lot thanks once again

Anonymous said...

Excellent Article
It helped me a lot
Thanks