Update WorkItem status with OSLC API

Dear
I'm trying to change workitem status from 'new' to another status like 'Start Working' or 'Complete'.
I read an article which says send a PUT request adding '_action=com.ibm.team.workitem.taskWorkflow.action.Complete' in the end like below.
'https://localhost:9443/jazz/resource/itemOid/com.ibm.team.workitem.WorkItem/_0xazQG2dEd-Tlez1oMG4hw?_action=com.ibm.team.workitem.taskWorkflow.action.Complete
But it doesn't work.
I check that type is a Task which is using default task workflow , id 'com.ibm.team.workitem.taskWorkflow'.
Any hint for this?
Thanks for any help.
I'm trying to change workitem status from 'new' to another status like 'Start Working' or 'Complete'.
I read an article which says send a PUT request adding '_action=com.ibm.team.workitem.taskWorkflow.action.Complete' in the end like below.
'https://localhost:9443/jazz/resource/itemOid/com.ibm.team.workitem.WorkItem/_0xazQG2dEd-Tlez1oMG4hw?_action=com.ibm.team.workitem.taskWorkflow.action.Complete
But it doesn't work.
I check that type is a Task which is using default task workflow , id 'com.ibm.team.workitem.taskWorkflow'.
Any hint for this?
Thanks for any help.
Accepted answer

I finally did it.
The solution was
1. URL : http://localhost:80/jazz/resource/itemOid/com.ibm.team.workitem.WorkItem/_oxzwQG2dEd-TIez1oMG4hw?_action=com.ibm.team.workitem.taskWorkflow.action.startWorking
2. HTTP Request body has this value.
<rtc_cm:state rdf:resource=\"https://localhost:9443/jazz/oslc/workflows/_nhCr8G2dEd-TIez1oMG4hw/states/com.ibm.team.workitem.taskWorkflow/2\"/>
Thanks for helping me.
The solution was
1. URL : http://localhost:80/jazz/resource/itemOid/com.ibm.team.workitem.WorkItem/_oxzwQG2dEd-TIez1oMG4hw?_action=com.ibm.team.workitem.taskWorkflow.action.startWorking
2. HTTP Request body has this value.
<rtc_cm:state rdf:resource=\"https://localhost:9443/jazz/oslc/workflows/_nhCr8G2dEd-TIez1oMG4hw/states/com.ibm.team.workitem.taskWorkflow/2\"/>
Thanks for helping me.
8 other answers

Folks
There is an OSLC workshop here https://jazz.net/library/article/635 and in Example04 of the OSLC-CM samples we show how to make an update to a workitem. Take a look to see what you are missing.
There is an OSLC workshop here https://jazz.net/library/article/635 and in Example04 of the OSLC-CM samples we show how to make an update to a workitem. Take a look to see what you are missing.

I'm trying to change workitem status from 'new' to another status like
'Start Working' or 'Complete'.
I read an article which says send a PUT request adding
'_action=com.ibm.team.workitem.taskWorkflow.action.Complete' in the
end like below.
'https://localhost:9443/jazz/resource/itemOid/com.ibm.team.workitem.WorkItem/_0xazQG2dEd-Tlez1oMG4hw?_action=com.ibm.team.workitem.taskWorkflow.action.Complete
But it doesn't work.
I check that type is a Task which is using default task workflow , id
'com.ibm.team.workitem.taskWorkflow'.
Any hint for this?
The approach sounds correct, but you must also make sure that the work
item is in a state that actually allows the action.
--
Regards,
Patrick
RTC Work Item Component Lead

I checked that work item in right status so it should be transitioned with OSLC API request.
I check that workitem is a task and workflow definition like below.
<workflowDefinition id="com.ibm.team.workitem.taskWorkflow">
<action icon="processattachment:/workflow/inprogress.gif" id="com.ibm.team.workitem.taskWorkflow.action.startWorking" name="Start Working" state="s2"/>
</workflowDefinition>
So I sent a request like below but it still doesn't work.
https://localhost:9443/jazz/resource/itemOid/com.ibm.team.workitem.WorkItem/_0xazQG2dEd-Tlez1oMG4hw?_action=com.ibm.team.workitem.taskWorkflow.action.startWorking
I don't understand why.
Any idea?
Thanks in advance
I check that workitem is a task and workflow definition like below.
<workflowDefinition id="com.ibm.team.workitem.taskWorkflow">
<action icon="processattachment:/workflow/inprogress.gif" id="com.ibm.team.workitem.taskWorkflow.action.startWorking" name="Start Working" state="s2"/>
</workflowDefinition>
So I sent a request like below but it still doesn't work.
https://localhost:9443/jazz/resource/itemOid/com.ibm.team.workitem.WorkItem/_0xazQG2dEd-Tlez1oMG4hw?_action=com.ibm.team.workitem.taskWorkflow.action.startWorking
I don't understand why.
Any idea?
Thanks in advance

The approach sounds correct, but you must also make sure that the work
item is in a state that actually allows the action.
I guess team need the following information.
- Exact procedure (step by step) how to change state of workitem.
Suppose we have workitem "Defect 10" just created. The state is "New".
Team needs to know how to make action "Start Working" via URL,
or another way such as Java API call.
Thanks !
-- Amano
Yamato Software Development Laboratory
A member of "Unleash the Labs" initiative.

I checked that work item in right status so it should be transitioned
with OSLC API request.
I check that workitem is a task and workflow definition like below.
workflowDefinition
action icon="processattachment:/workflow/inprogress.gif"
id="com.ibm.team.workitem.taskWorkflow.action.startWorking"
name="Start Working" state="s2"/
/workflowDefinition
So I sent a request like below but it still doesn't work.
https://localhost:9443/jazz/resource/itemOid/com.ibm.team.workitem.WorkItem/_0xazQG2dEd-Tlez1oMG4hw?_action=com.ibm.team.workitem.taskWorkflow.action.startWorking
I don't understand why.
Any idea?
It works for me, I tried the following using the Firefox Poster plug-in:
https://clmwb:9443/jazz/resource/itemName/com.ibm.team.workitem.WorkItem/312?_action=com.ibm.team.workitem.taskWorkflow.action.startWorking
And PUT the XML work item resource representation to the above URL. You
can take an empty resource representation if you only want to make the
state transition.
If you use an action that is associated with resolutions, you also need
to set a resolution. E.g.:
<xml>
<oslc_cm>
<rtc_cm>
</oslc_cm>
--
Regards,
Patrick
RTC Work Item Component Lead

Thank you so much for posting this. I just spent an hour first trying to do a 'partial update' to the work item, then a full update, then changing headers... ugh.
This is so easy -- it'd be nice if this sort of thing was documented somewhere, like here: http://open-services.net/bin/view/Main/CmRestApiV1
This is so easy -- it'd be nice if this sort of thing was documented somewhere, like here: http://open-services.net/bin/view/Main/CmRestApiV1

On 12/4/10 7:23 AM, pctainto wrote:
Currently, it is an implementation detail of RTC. But actions will
eventually end-up in the OSLC-CM spec.
I refrained from documenting it before it is spec'd, but given how often
it is used already, I might as well create a page for these out-of-spec
parts.
--
Regards,
Patrick
RTC Work Item Component Lead
Thank you so much for posting this. I just spent an hour first trying
to do a 'partial update' to the work item, then a full update, then
changing headers... ugh.
This is so easy -- it'd be nice if this sort of thing was documented
somewhere, like here:
http://open-services.net/bin/view/Main/CmRestApiV1
Currently, it is an implementation detail of RTC. But actions will
eventually end-up in the OSLC-CM spec.
I refrained from documenting it before it is spec'd, but given how often
it is used already, I might as well create a page for these out-of-spec
parts.
--
Regards,
Patrick
RTC Work Item Component Lead

PUT : https://rtcserver:13043/ccm/oslc/workitems/190?_action=com.ibm.team.workitem.taskWorkflow.action.startWorking
Content-Type : application/json
Body: {"rtc_cm:state":{"rdf:resource":"https:\/\/rtcserver:13043\/ccm\/oslc\/workflows\/_jtyOwNZ-EeS0-OksqjQuNA\/states\/com.ibm.team.workitem.taskWorkflow\/com.ibm.team.workitem.taskWorkflow.state.s1"}}
This works for me