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

Can I use the REST API to link workitems?

Hi

I am trying to find the right URL to send to the RTC server to create a link between two work items.  Is this possible?

many thanks
anthony

p.s Bonus points if I can create links to multiple work items (ie one to many)

0 votes



One answer

Permanent link
Simply PUT the below content to the resource URI of a workitem, e.g.
https://clm405:9443/ccm/resource/itemName/com.ibm.team.workitem.WorkItem/43
<rdf:RDF
    xmlns:dcterms="http://purl.org/dc/terms/"
    xmlns:oslc_cm="http://open-services.net/ns/cm#"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:rtc_ext="http://jazz.net/xmlns/prod/jazz/rtc/ext/1.0/"
    xmlns:oslc_cmx="http://open-services.net/ns/cm-x#"
    xmlns:acp="http://jazz.net/ns/acp#"
    xmlns:rtc_cm="http://jazz.net/xmlns/prod/jazz/rtc/cm/1.0/"
    xmlns:oslc="http://open-services.net/ns/core#"
    xmlns:oslc_pl="http://open-services.net/ns/pl#" >
  <rdf:Description>
    <rtc_cm:com.ibm.team.workitem.linktype.blocksworkitem.dependsOn rdf:resource="https://clm405:9443/ccm/resource/itemName/com.ibm.team.workitem.WorkItem/61"/>
     <rtc_cm:com.ibm.team.workitem.linktype.blocksworkitem.dependsOn rdf:resource="https://clm405:9443/ccm/resource/itemName/com.ibm.team.workitem.WorkItem/62"/>
 </rdf:Description>
</rdf:RDF>
In this example, the links are established so that WI 43 "Depends On" WI 61 and WI 62.
Note that the same link type will be overwritten, so if you want to "add" work items to the same link type, you need to add the existing work items in the PUT payload. For example, if later on you want to link WI 63 so that WI 43 "Depends On" WI 63 as well, you need to put all three work items in the PUT payload.
To find out what link types are available for the work item type, check the instance shape of the work item type, such as
https://clm405:9443/ccm/oslc/shapes/workitems/_RsxIUGLBEeOj4c1n9GOJ3Q (this is Task in my system)
You can get the instanceShape URL when you GET a work item of this type (look for <oslc:instanceShape>).

2 votes

Comments

Thanks Donald - this is exactly the info I needed.

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
× 10,948

Question asked: Aug 18 '14, 12:50 p.m.

Question was seen: 3,845 times

Last updated: Aug 19 '14, 2:57 a.m.

Confirmation Cancel Confirm