Delete related links with REST API
![](http://jazz.net/_images/myphoto/e14dad8b1f085505bce1d740800bbc33.jpg)
I use method PUT for add related link, it's work fine on cUrl.
@echo { "rdf:resource":"%HOST%/itemName/com.ibm.team.workitem.WorkItem/%ID_UPDATED_WI%" } > somelink.json
curl.exe -# -k -b %COOKIES% -H "Content-Type: application/x-oslc-cm-change-request+json" -H "Accept: application/X-Jazz-CSRF-Prevent" -X PUT --data-binary @somelink.json "%HOST%/oslc/workitems/%ID_ADDED_WI%/rtc_cm:com.ibm.team.workitem.linktype.copiedworkitem.copiedFrom"
but when I try delete that link by method DELETE - it doesn't work. What I can delete it?
@echo { "rdf:resource":"%HOST%/itemName/com.ibm.team.workitem.WorkItem/%ID_UPDATED_WI%" } > somelink.json
curl.exe -# -k -b %COOKIES% -H "Content-Type: application/x-oslc-cm-change-request+json" -H "Accept: application/X-Jazz-CSRF-Prevent" -X PUT --data-binary @somelink.json "%HOST%/oslc/workitems/%ID_ADDED_WI%/rtc_cm:com.ibm.team.workitem.linktype.copiedworkitem.copiedFrom"
but when I try delete that link by method DELETE - it doesn't work. What I can delete it?
Accepted answer
![](http://jazz.net/_images/myphoto/e14dad8b1f085505bce1d740800bbc33.jpg)
If you mean the HTTP DELETE operation, then no, you cannot use it. Even if you can use it, you delete the WI instead, which is not what you want.
To delete a link, do a PUT with all the existing links except the one that you don't want any more.
To delete a link, do a PUT with all the existing links except the one that you don't want any more.
Comments
![](http://jazz.net/_images/myphoto/e14dad8b1f085505bce1d740800bbc33.jpg)
Thank you to answer!
I have in WI 211 links to 201, 209 and 210. I need delete link 209. What I need change in command?
e.g. If I PUT --data-binary @somelink.json "%HOST%/oslc/workitems/210/rtc_cm:com.ibm.team.workitem.linktype.copiedworkitem.copiedFrom" no links delete.
![](http://jazz.net/_images/myphoto/e14dad8b1f085505bce1d740800bbc33.jpg)
"To delete a link, do a PUT with all the existing links except the one that you don't want any more."
How to do it?