Using PATCH on a change state REST call
Hi,
I'd like to change a work-item state and an attribute value at once using REST API. It works fine if I'm using this curl command:
On this article I've read that if I use PUT I have to put the entire json on update.json file. If I try PATCH I get an error that says that "the method is not implemented". I've tried to use PUT using a partial json, putting only the attribute I want to change and it works, but I'm not sure this is the "standard" way.
In order to use PUT and a subset of json file I should use oslc_cm.properties. But how can I use either _action and oslc_cm.properties on the same URL?
I'm using RTC 2.0.0.2
Thanks,
Michele.
I'd like to change a work-item state and an attribute value at once using REST API. It works fine if I'm using this curl command:
curl -D - -k -b cookies.txt -H "If-Match: _AXqPgM2XEeCe6LQh8onYag" -H "Content-Type: application/json" -H "Accept: application/json" -X PUT --data-binary @update.json https://localhost:9443/jazz/resource/itemName/com.ibm.team.workitem.WorkItem/44?_action=ReleaseZMFWorkflow.action.a2
On this article I've read that if I use PUT I have to put the entire json on update.json file. If I try PATCH I get an error that says that "the method is not implemented". I've tried to use PUT using a partial json, putting only the attribute I want to change and it works, but I'm not sure this is the "standard" way.
In order to use PUT and a subset of json file I should use oslc_cm.properties. But how can I use either _action and oslc_cm.properties on the same URL?
I'm using RTC 2.0.0.2
Thanks,
Michele.
One answer
From the same article you cite:
So, you could use the PATH action with URL:
instead of:
Cheers.
Alternatively, you could use PATCH without the oslc_cm.properties parameter. Note that this works only for the alternative work item URLs like /jazz/oslc/workitems/{id}, but not for the Location based ones:URL="https://localhost:9443/jazz/oslc/workitems/821"
curl -D - -k -b $COOKIES -H "Content-Type: application/x-oslc-cm-change-request+json" -H "Accept: application/json" -X PATCH --data-binary @changetype.json $URL
So, you could use the PATH action with URL:
https://localhost:9443/jazz/oslc/workitems/44?_action=ReleaseZMFWorkflow.action.a2
instead of:
https://localhost:9443/jazz/resource/itemName/com.ibm.team.workitem.WorkItem/44?_action=ReleaseZMFWorkflow.action.a2
Cheers.