It's all about the answers!

Ask a question

How to set parent link when creating a work item by OSLC


Yoshihisa Komai (3002422) | asked Mar 27 '12, 5:30 a.m.
Please give me an advice on this.

I'm trying work item creation by OSLC, referring to the following article.
https://jazz.net/library/article/352
There is a following sample how to create a work item.
----------------------------------------------------------
POST https://rtc:9443/jazz/oslc/contexts/_gasc4Ju-Ed6cerS9lb5AWw/workitems
Content-Type: application/x-oslc-cm-change-request+xml

<oslc_cm:ChangeRequest
xmlns:dc="http://purl.org/dc/terms/"
xmlns:rtc_cm="https://jazz.net/xmlns/prod/jazz/rtc/cm/1.0/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:oslc_cm="http://open-services.net/xmlns/cm/1.0/">
<dc:title>A new Bug</dc:title>
<dc:description>This is new bug</dc:description>
<dc:type rdf:resource="https://rtc:9443/jazz/oslc/types/_gasc4Ju-Ed6cerS9lb5AWw/defect"/>
<rtc_cm:filedAgainst rdf:resource="https://rtc:9443/jazz/resource/itemOid/com.ibm.team.workitem.Category/_hckJkpu-Ed6cerS9lb5AWw"/>
</oslc_cm:ChangeRequest>
----------------------------------------------------------

However, how to set parent link is not mentioned.
So please let me know how to do that.

Also, I found a following post, which is discussing similar thing.
https://jazz.net/forums/viewtopic.php?t=21977

According the post, following thing is mentioned.
"Parent-Child, are not accessible via OSLC."
Is that true?

Accepted answer


permanent link
Yoshihisa Komai (3002422) | answered Mar 28 '12, 9:10 p.m.
Resolved this :)

Following is a sample xml I tested.
------------------------------------------------------------------------------------
<rdf:RDF
xmlns:dcterms="http://purl.org/dc/terms/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rtc_cm="http://jazz.net/xmlns/prod/jazz/rtc/cm/1.0/" >
<rdf:Description rdf:nodeID="A0">
<dcterms:title rdf:parseType="Literal">Sample Work Item</dcterms:title>
<rtc_cm:type rdf:resource="https://server:9443/ccm/oslc/types/_0uPwCl3bEeGtcZ7F_iHxXw/task"/>
<rtc_cm:com.ibm.team.workitem.linktype.parentworkitem.parent rdf:resource="https://server:9443/ccm/resource/itemName/com.ibm.team.workitem.WorkItem/10"/>
</rdf:Description>
</rdf:RDF>
--------------------------------------------------------------------------------------

I referred to
https://jazz.net/wiki/bin/view/Main/WorkItemAPIsForOSLCCM20
Ralph Schoon selected this answer as the correct answer

2 other answers



permanent link
Ralph Schoon (63.1k33646) | answered Mar 29 '12, 2:30 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Hi,

thanks for posting the solution! These type of questions are typically discussed in the Extending Team Concert forum. You might have more people with some expertise there.

permanent link
Shasi kumar (112) | answered Jun 05 '17, 3:50 a.m.

Hi Yoshihisa,

There are different types of which could be used (Set Parent, Add children, Add Blocks etc., are some examples)
Here is an example of how to add a parent link to a work item using JSON. You could POST the following JSON request to use "Set Parent" link of a work item

{

  "rtc_cm:com.ibm.team.workitem.linktype.parentworkitem.parent": {
    "rdf:resource": "<RTC_URL>/ccm/resource/itemName/com.ibm.team.workitem.WorkItem/<Parent_WorkIem_ID>"
  }

}

Similarly for a "Blocked By" link the following request could be used

    {
      "rtc_cm:com.ibm.team.workitem.linktype.blocksworkitem.blocks": {
        "rdf:resource": "<RTC_URL>/ccm/resource/itemName/com.ibm.team.workitem.WorkItem/<Blocking_WorkItem_ID>"
      }
    }
       
The same could be obtained with rdf+xml also.

We could determine which JSON object to use for the request based on the resource shape of a work item from the resource catalog.

Hope this helps. Thanks!!

Your answer


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