It's all about the answers!

Ask a question

Change the status of workitem in RTC(4.0) using REST API


Rupam Roy (623) | asked Jan 02 '15, 5:00 a.m.
Hi Team,

I have tried to change the status of workitem using Rest Api in RTC 4.0.6. But not able to update status of workitem.

Headers:
Accept:text/json
Content-Type:application/x-oslc-cm-change-request+json
If-Match:29c27c1b-cbfa-3745-baf6

URL:
https://ratsuitein131.in.dst.ibm.com:9444/ccm/resource/itemName/com.ibm.team.workitem.WorkItem/102066

JSON Body
{
"dc:identifier":102066,
  "rtc_cm:state":{
    "rdf:resource":"https://ratsuitein131.in.dst.ibm.com:9444/ccm/oslc/workflows/_S-BFgSK4EeKBhX83Q/states/bugzillaWorkflow/3"
   }
}

Using PUT Method return these response.

Response Headers
    Status Code: 412 Precondition Failed
    Cache-Control: private, max-age=0, must-revalidate
    Connection: Close
    Content-Language: en-US
    Content-Type: text/json;charset=UTF-8
    Date: Thu, 01 Jan 2015 07:11:55 GMT
    Expires: Thu, 01 Jan 2015 07:11:56 GMT
    Transfer-Encoding: chunked
    Vary: Accept
    X-Powered-By: Servlet/3.0

Respose Body
{
    "oslc_cm:message": "CRJAZ0007I Unable to update the item identified by \"https:\/\/ratsuitein131.in.dst.ibm.com:9444\/ccm\/service

\/com.ibm.team.repository.common.internal.IItemRestService\/itemName\/com.ibm.team.workitem.WorkItem\/102066\" - there is a later version of this item available.",
    "oslc_cm:status": 412
}


Some ref link that I already have followed:

https://jazz.net/forum/questions/45192/update-workitem-status-with-oslc-api.
https://jazz.net/forum/questions/32674/change-workitem-state-via-rest?redirect=%2Fforum%2Fquestions%2F32674%2Fchange-workitem-state-via-rest
https://jazz.net/wiki/bin/view/Main/ResourceOrientedWorkItemAPIv2#Update_a_Work_Item
https://www.youtube.com/watch?v=eXVWtiuygr0

I would appreciate if anyone could gives some lights.

Regards,
Rupam

One answer



permanent link
Eric Jodet (6.3k5111120) | answered Jan 02 '15, 5:18 a.m.
JAZZ DEVELOPER
 Hello Rupam,
either there is a more recent of the work item that you're trying to update,
which I doubt -
or there is some precondition in place that prevents from changing the status.

Possibly try and do the same operation using the WebUI
and see if it works.

Eric

Comments
Rupam Roy commented Jan 02 '15, 6:28 a.m. | edited Jan 02 '15, 6:30 a.m.

Yes Eric.

I can change the status using WebUI and it is working fine.
But getting error for rest calling.

Rupam



Eric Jodet commented Jan 02 '15, 7:22 a.m.
JAZZ DEVELOPER

 Umm...

Hello Rupam,
anything you may notice in the ccm.log?

Eric

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.