It's all about the answers!

Ask a question

Using PATCH on a change state REST call


Michele Pegoraro (1.8k14119103) | asked Aug 30 '11, 3:50 a.m.
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:

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



permanent link
SEC Servizi (97123860) | answered Sep 19 '11, 10:37 a.m.
From the same article you cite:
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.

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.