How to update status of a defect in RTC using Rest API
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.
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
Ralph Schoon (63.3k●3●36●46)
| 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.
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
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.