How can I delete a service provider link, or the entire collection, using the REST API with curl?
I have a curl script that will step through my list of active RDNG projects and will present me with a list of the Associations that each project has with other projects, such as RTC for Change Requests, or RQM for Test Cases. I am using REST API calls found here: https://jazz.net/wiki/bin/view/Main/DraftTeamProcessRestApi. The API call that I use to present the list looks like this: curl -k -b cookies.txt -H "Accept: application/xml" "https://<host>:9443/rm/process/project-areas/_01KIgzQjEeazXZOTb1V8ow/links"
What I want to do is to remove one the Association links or in some cases remove all the links for the project. I am struggling with the syntax to do the delete. This is what I have tried to delete a single link:
curl -D - -k -b cookies.txt -X DELETE "https://<host>:9443/rm/process/project-areas/_01KIgzQjEeazXZOTb1V8ow/links/_5ui5UTQjEeazXZOTb1V8ow"
When I do I get a nasty looking java error that concludes with the message: "You don't have permission to perform the following actions: Modify project area properties (modify/other)"
I have also tried deleting the collection itself instead of the individual links using this command:
curl -D - -k -b cookies.txt -X DELETE "https://<host>:9443/rm/process/project-areas/_01KIgzQjEeazXZOTb1V8ow/links"
That returns a "400 Bad Request" and the message, "Missing parameter "type"
I can see in the output from the listing curl command that each of the links shows a <jp:link-type> with "validated-by" or "implemented-by" or "tracked-by-cm" but I can't seem to find the syntax to specify the type on the curl command itself.
This is in CLM 6.0.1 and we are archiving one of the CLM applications, such as RQM, and as part of the decommissioning process, I would like to do a bulk removal of all the Associations in each RDNG project and this seems to be a better way to do it than to open up each RDNG project and manually remove the association links. I assume that I am close but just can't figure out the correct syntax.
Thank you
Accepted answer
Thanks for the suggestion. After some trial and error, this appears to work:
curl -D - -k -b .\cookies.txt -X DELETE -G https://<QM_SERVER>:9443/qm/process/project-areas/_6Db1UgLLEeSbwp7ZNy4XUQ/links -d type=tracked-by -d resource="https://<CCM_SERVER>:9443/ccm/process/project-areas/_2cXoAgLLEeSfK8RNZdnwOg"
Not sure what the -G option to curl does but this syntax works to successfully delete an association link between a QM project and and CCM project. I can use it in my code to loop through all existing associations and remove them.
Comments
One other answer
The documentation specified that the delete request requires two parameters.
The error indicates that a parameter is missing and the cURL code does not show that parameter either.
I would suggest to use RESTCLIENT in Firefox to play around with the API to find out how the request would look like and generate the cURL code once that works.