REST api for changing the state of the workitem doesn't work with RTC 4.0.1
6 answers
I have tried on my local system and I found out the following:
- with curl I reproduce the error
- if I use FF poster it works (including the etag parameter)
so it sounds like curl is not preserving the quotes as needed.
Update: I found the mistake in my curl call and posting the corrected version. It's working for me on my system (v4.0.4). See the escape characters for the ETag value.
curl -k -b $COOKIES --header "Content-Type:application/json" --header "Accept:application/x-oslc-cm-change-request+json" --header "If-Match: \"<ETagValue>\"" -X PUT --data-binary "@<ID>.json" <server>/ccm/resource/itemName/com.ibm.team.workitem.WorkItem/<ID>?_action=com.ibm.team.workitem.taskWorkflow.action.startWorking"
Anyway, I double-checked with FireFox Poster add-on again, and the ETag value along with the If-Match parameter are working as expected
Regards,
Jorge.
Comments
Sorry, worth mentioning I tried this with RTC 4.0.4
Thanks for your suggestion but unfortunately we are running on windows and we don't have sed.
Hi!!
I made it work by removing the "If-Match" header from the PUT request.
For reference of others with same issue this is my log of steps I followed to change WI state (I've used JSON instead of XML)
curl -k -c cookies.txt "https://jts-test:9443/jts/authenticated/identity"
curl -k -L -b cookies.txt -c cookies.txt -d j_username=612979 -d j_password=612979 https://jts-test:9443/jts/authenticated/j_security_check
curl -o 151.json -k -b cookies.txt "https://jts-test:9443/ccm/oslc/workitems/151.json" -H "Content-Type:application/x-oslc-cm-change-request+json"
curl -k -v -b cookies.txt "https://jts-test:9443/ccm/oslc/workitems/151.json" --header "Content-Type:application/x-oslc-cm-change-request+json" --header "Accept:application/x-oslc-cm-change-request+json" -X PUT --data-binary @151.json "https://jts-test:9443/ccm/resource/itemName/com.ibm.team.workitem.WorkItem/151?_action=com.ibm.team.workitem.taskWorkflow.action.startWorking"
curl -s -k -b ~/.jazzcookies -H 'If-Match:"64486.etag"' -H "Content-Type: application/x-oslc-cm-change-request+json" -H "Accept: application/x-oslc-cm-change-request+json" -X PUT --data-binary 64486.updated.json "https://clm-host/jazz/resource/itemName/com.ibm.team.workitem.WorkItem/15954?_action=bugzillaWorkflow.action.a6"
Comments
Tried with single quotes as you suggested, still doesn't work. Getting the same oslc_cm:status: 412 message.
Please help.
Hi,
Facing same problem any update?
C:\IBMSW\curl-7.32.0-rtmp-ssh2-ssl-sspi-zlib-idn-static-bin-w32\curl-7.32.0-rtmp
-ssh2-ssl-sspi-zlib-idn-static-bin-w32>curl -D - -k -b cookies.txt -H "Content-T
ype:application/x-oslc-cm-change-request+xml" -H "Accept:application/x-oslc-cm-c
hange-request+xml" -X PUT --data-binary @151.xml "https://jts-test:9443/ccm/reso
urce/itemName/com.ibm.team.workitem.WorkItem/151?_action=com.ibm.team.workitem.d
efectWorkflow.action.startWorking"
HTTP/1.1 100 Continue
Content-Length: 0
Date: Wed, 16 Oct 2013 15:54:40 GMT
HTTP/1.1 409 Conflict
Date: Wed, 16 Oct 2013 15:54:40 GMT
X-Powered-By: Servlet/3.0
Cache-Control: private, max-age=0, must-revalidate
Expires: Wed, 16 Oct 2013 15:54:40 GMT
Vary: Accept
Content-Type: text/xml;charset=UTF-8
Content-Language: en-US
Content-Length: 213
Connection: Close
<?xml version="1.0" encoding="UTF-8"?><oslc_cm:error xmlns:oslc_cm="http://open-
services.net/xmlns/cm/1.0/">
<oslc_cm:status>409</oslc_cm:status>
<oslc_cm:message>Illegal value: </oslc_cm:message>
</oslc_cm:error>
C:\IBMSW\curl-7.32.0-rtmp-ssh2-ssl-sspi-zlib-idn-static-bin-w32\curl-7.32.0-rtmp
-ssh2-ssl-sspi-zlib-idn-static-bin-w32>curl -D - -k -b cookies.txt -H "If-Match:
090cf19a-d29d-361e-a751-42f133086e1b" -H "Content-Type:application/x-oslc-cm-ch
ange-request+xml" -H "Accept:application/x-oslc-cm-change-request+xml" -X PUT --
data-binary @151.xml "https://jts-test:9443/ccm/resource/itemName/com.ibm.team.w
orkitem.WorkItem/151?_action=com.ibm.team.workitem.defectWorkflow.action.startWo
rking"
HTTP/1.1 100 Continue
Content-Length: 0
Date: Wed, 16 Oct 2013 15:58:20 GMT
HTTP/1.1 412 Precondition Failed
Date: Wed, 16 Oct 2013 15:58:20 GMT
X-Powered-By: Servlet/3.0
Cache-Control: private, max-age=0, must-revalidate
Expires: Wed, 16 Oct 2013 15:58:20 GMT
Vary: Accept
Content-Type: text/xml;charset=UTF-8
Content-Language: en-US
Content-Length: 501
Connection: Close
<?xml version="1.0" encoding="UTF-8"?><oslc_cm:error xmlns:oslc_cm="http://open-
services.net/xmlns/cm/1.0/">
<oslc_cm:status>412</oslc_cm:status>
<oslc_cm:message>CRJAZ0007I Unable to update the item identified by "https://jts
-test:9443/ccm/service/com.ibm.team.repository.common.internal.IItemRestService/
itemName/com.ibm.team.workitem.WorkItem/151?_action=com.ibm.team.workitem.defect
Workflow.action.startWorking" - there is a later version of this item available.
</oslc_cm:message>
</oslc_cm:error>
C:\IBMSW\curl-7.32.0-rtmp-ssh2-ssl-sspi-zlib-idn-static-bin-w32\curl-7.32.0-rtmp
-ssh2-ssl-sspi-zlib-idn-static-bin-w32>