It's all about the answers!

Ask a question

cURL PUT WI - RTC 4.0.3 (State Transition)


Kartik Manchanda (767) | asked Feb 07 '14, 2:43 p.m.
edited Feb 11 '14, 10:01 p.m.
  Hello

Goal : Update the state of a Build WI 
State Flow : Ready For Build  (com.hcsc.team.workitem.buildWorkflow.state.s1) -> Dev (com.hcsc.team.workitem.buildWorkflow.state.s2) -> Pending UAT Approval (com.hcsc.team.workitem.buildWorkflow.state.s3)
Issue : cURL PUT update defaulting to Ready For Build  (com.hcsc.team.workitem.buildWorkflow.state.s1).

One answer



permanent link
Simon Washbrook (67216) | answered Feb 10 '14, 10:23 a.m.
Kartik,
When I was doing updates to work items. i need to collect the "ETag" field from the headers and feed it back during the PUT.
i.e. Extract the ETag filed from the headers returned by the GET:

ETag=`grep ETag header.txt | sed -e 's/ETag: //' | sed -e 's/"//g'`

Then pass it has a value to the header "If-Match", you can add the following option tot he curl command line for the PUT.
 -H "If-Match: $ETag

The ETag field contains the last modified date of the work item so the work item will only be updated if it wasn't updated between the GET and the PUT. You need to manage this in your script, i.e. if you get an error during the PUT you need to perform the GET and again the PUT to update the work item.

I hope this helps,
Simon

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.