It's all about the answers!

Ask a question

Delete related links with REST API


Pavel Cikota (13610) | asked Sep 07 '16, 9:38 a.m.
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?

Accepted answer


permanent link
Donald Nong (14.5k614) | answered Sep 07 '16, 11:49 p.m.
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.
Pavel Cikota selected this answer as the correct answer

Comments
Pavel Cikota commented Sep 08 '16, 7:29 a.m. | edited Sep 08 '16, 7:29 a.m.

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.


Pavel Cikota commented Sep 08 '16, 10:48 a.m.

"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?


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.