OSLC/REST API: How to change the state AND resolution of a work item?
I want to change the state of a work item via the OSLC or Reportable REST API and I succeeded in doing this in most cases using the method described here: https://jazz.net/forum/answer_link/99991/. It basically works by POSTing to the work item URL appended with "?_action=[desired action]".
However this doesn't work for the action "Resolve" because it needs an extra field describing the Resolution (like "Invalid", "Fixed" etc.). I found that the list of possible resolutions is under the URL ...oslc/workflows/[Project Area UUID]/resolutions/com.ibm.team.workitem.defectWorkflow/. But how can I pass the resolution code to RTC, in addition to the "Resolve" action? Additional information: If I try to change the state by the "Resolve" action, it fails with the message {"oslc:message":"'Save Work Item' failed. Preconditions have not been met: The 'Root Cause Description' attribute needs to be set (work item 114391).","oslc:statusCode":403,"prefixes":{"oslc":"http://open-services.net/ns/core#"}} |
Accepted answer
Hello... I haven't tried this but it looks like you need to include the "Root Cause Description" and any other required attributes with the save. The Resolution is passed in as the attribute internalResolution.
http://open-services.net/bin/view/Main/CmRestApiV1 describes how to save. Assuming the root cause description is called rootCauseDescription, the call would look something like this: PUT {CR URI}?_action=bugzillaWorkflow.action.resolve&oslc_cm.properties=rootCauseDescription,internalResolution Content: <oslc_cm:ChangeRequest> <rootCauseDescription>Something broke.</rootCauseDescription> <internalResolution>5</internalResolution> </oslc_cm:ChangeRequest> You will need to play around with this for the right content. Fabian Zaiser selected this answer as the correct answer
Comments
Fabian Zaiser
commented Sep 12 '16, 7:45 a.m.
Thanks for your answer! I tinkered with it a bit and I could get it to work like this (written done for other people having this problem):
|