Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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.

1

0 votes


Accepted answer

Permanent link
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

0 votes


8 other answers

Permanent link
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.

1 vote


Permanent link
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

0 votes


Permanent link
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

0 votes


Permanent link

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.

0 votes


Permanent link
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

0 votes


Permanent link
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

0 votes


Permanent link
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

0 votes


Permanent link
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

0 votes

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 11,047

Question asked: Nov 05 '10, 4:57 a.m.

Question was seen: 11,812 times

Last updated: Jul 02 '15, 11:08 a.m.

Confirmation Cancel Confirm