It's all about the answers!

Ask a question

How to update status of a defect in RTC using Rest API


Asit Mohanty Mohanty (111) | asked Oct 23 '18, 2:04 a.m.

We have a need to update the status of the defect/observation logged in RTC. We are trying to leverage the Rest Apis published for Jazz toolsets.

 

URL used: https://<domian name>/ccm/resource/itemOid/com.ibm.team.workitem.WorkItem/_QfJAMJcWEei2nqqtDv7JZg?_action=com.ibm.team.workitem.impedimentWorkflow.action.startWorking

 

HttpMethod Used: HttpPut

 

Json Request: {"dc:identifier":"<observation ID>","rtc_cm:Status":{"rdf:resource=":"https:\/\/<domain name>\/ccm\/oslc\/workflows\/_w1ldJRkGEeWDiM8aLc-GlA\/states\/com.ibm.team.workitem.impedimentWorkflow/com.ibm.team.workitem.impedimentWorkflow.state.s3"}}

 

Note: For observations we have the below three states:

State: Invalid

<rtc_cm:Status rdf:resource="https://<domain name>/ccm/oslc/workflows/_w1ldJRkGEeWDiM8aLc-GlA/states/com.ibm.team.workitem.impedimentWorkflow/com.ibm.team.workitem.impedimentWorkflow.state.s3">

 

State: New

<rtc_cm:Status rdf:resource="https://<domain name>//ccm/oslc/workflows/_w1ldJRkGEeWDiM8aLc-GlA/states/com.ibm.team.workitem.impedimentWorkflow/com.ibm.team.workitem.impedimentWorkflow.state.s1">

 

State: Resolved

<rtc_cm:Status rdf:resource="https://<domain name>//ccm/oslc/workflows/_w1ldJRkGEeWDiM8aLc-GlA/states/com.ibm.team.workitem.impedimentWorkflow/com.ibm.team.workitem.impedimentWorkflow.state.s2">

 

The observation <observation ID> had the status as https://<domain name>//ccm/oslc/workflows/_w1ldJRkGEeWDiM8aLc-GlA/states/com.ibm.team.workitem.impedimentWorkflow/com.ibm.team.workitem.impedimentWorkflow.state.s1

 

Http Headers used:

              updateDefect.addHeader("Content-Type", "application/x-oslc-cm-change-request+json");

              updateDefect.addHeader("accept","text/json");

              updateDefect.addHeader("User-Agent", "MSIE 8.0");

 

Sample code:

StringEntity defrequest = new StringEntity(jsonRequest.toString());

updateDefect.setEntity(defrequest);

HttpResponse defectResponse = client.execute(updateDefect,context);

 

 

Output:

 

Http Response: 200

 

However the status of the observation still stays as https://<domain name>//ccm/oslc/workflows/_w1ldJRkGEeWDiM8aLc-GlA/states/com.ibm.team.workitem.impedimentWorkflow/com.ibm.team.workitem.impedimentWorkflow.state.s1

One answer



permanent link
Ralph Schoon (63.1k33645) | answered Oct 23 '18, 2:30 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

 The state of a work item is read only. You have to submit a valid work flow action to get the state transition triggered.


Comments
Asit Mohanty Mohanty commented Oct 30 '18, 8:53 a.m.

Hi Ralph,

Could you please share some examples on the valid work flow action that you are referring to. Are you referring to the action we are passing in as a parameter.


Ralph Schoon commented Oct 30 '18, 9:08 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

I don't have anything that I could share. https://www.google.com/search?q=OSLC+work+item+change+state+site%3Ajazz.net shows several forum questions and there are some that seem to have made progress. 

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.