It's all about the answers!

Ask a question

Update WorkItem status with OSLC API


0
1
Jaegon Yoo (9611314) | asked Nov 05 '10, 4:57 a.m.
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.

Accepted answer


permanent link
Jaegon Yoo (9611314) | answered Nov 09 '10, 4:20 a.m.
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.
Ralph Schoon selected this answer as the correct answer

8 other answers



permanent link
Rosa Naranjo (2.8k11420) | answered Sep 26 '14, 9:12 a.m.
FORUM MODERATOR / JAZZ DEVELOPER
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.

permanent link
Patrick Streule (4.9k21) | answered Nov 08 '10, 6:38 a.m.
JAZZ DEVELOPER
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

permanent link
Jaegon Yoo (9611314) | answered Nov 09 '10, 12:43 a.m.
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

permanent link
Takehiko Amano (1.3k3641) | answered Nov 09 '10, 3:52 a.m.
JAZZ DEVELOPER

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.

permanent link
Patrick Streule (4.9k21) | answered Nov 09 '10, 5:53 a.m.
JAZZ DEVELOPER
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

permanent link
Case Taintor (1462116) | answered Dec 04 '10, 1:11 a.m.
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

permanent link
Patrick Streule (4.9k21) | answered Dec 14 '10, 8:38 a.m.
JAZZ DEVELOPER
On 12/4/10 7:23 AM, pctainto wrote:
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

permanent link
Jia Jia Li (8057131184) | answered Jul 02 '15, 11:08 a.m.
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

Your answer


Register or to post your answer.