How to update workitem setting an empty collection using REST?
//Add a new members in a collection. This work fine
{
"rtc_cm:br.sicredi.team.workitem.attribute.componentversionList": [
{
"rdf:resource": "https://app1dessist002l.lrn.sicredi.net:9443/ccm/resource/itemName/com.ibm.team.workitem.WorkItem/899"
},
{
"rdf:resource": "https://app1dessist002l.lrn.sicredi.net:9443/ccm/resource/itemName/com.ibm.team.workitem.WorkItem/901"
}
],
}
//Remove one item from a collection. This work fine to
"rtc_cm:br.sicredi.team.workitem.attribute.componentversionList": [
{
"rdf:resource": "https://app1dessist002l.lrn.sicredi.net:9443/ccm/resource/itemName/com.ibm.team.workitem.WorkItem/899"
}
]
//Empty a collection. This does not work. There is no error, but nothing happing
{
"rtc_cm:br.sicredi.team.workitem.attribute.componentversionList": [],
}
This is the command used to update in all tests
curl -k -b $COOKIES -H "Accept:application/x-oslc-cm-change-request+json" -H "Content-Type:application/json" -H "If-Match: \"$ETAG\"" -X PUT --data-binary "@$WIID.json" "$HOST/resource/itemName/com.ibm.team.workitem.WorkItem/$WIID
Accepted answer
You need to change the URL a bit. For details, see this post:
https://jazz.net/forum/questions/98302/oslc-how-to-remove-subscribers-with-oslc
Basically the URL in your case should become:
$HOST/resource/itemName/com.ibm.team.workitem.WorkItem/$WIID?oslc_cm.properties=rtc_cm:br.sicredi.team.workitem.attribute.componentversionList
https://jazz.net/forum/questions/98302/oslc-how-to-remove-subscribers-with-oslc
Basically the URL in your case should become:
$HOST/resource/itemName/com.ibm.team.workitem.WorkItem/$WIID?oslc_cm.properties=rtc_cm:br.sicredi.team.workitem.attribute.componentversionList