How to set parent link when creating a work item by OSLC
![](http://jazz.net/_images/myphoto/69e30c8120a75ce29e1474d95ddc1678.jpg)
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
![](http://jazz.net/_images/myphoto/69e30c8120a75ce29e1474d95ddc1678.jpg)
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
2 other answers
![](http://jazz.net/_images/myphoto/69e30c8120a75ce29e1474d95ddc1678.jpg)
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!!