REST api for changing the state of the workitem doesn't work with RTC 4.0.1
![]()
Binoy D'costa (95●3●18●35)
| asked Mar 27 '13, 10:26 a.m.
retagged Dec 03 '13, 4:34 p.m. by David Lafreniere (4.8k●7)
I have a script to move workitem from "Resolved" state to "Built" state. Details below:
Curl cmd:
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"
Error;
{
"oslc_cm:message": "CRJAZ0007I Unable to update the item identified by \"https:\/\/clm-host\/jazz\/service\/com.ibm.team.repository.common.internal.IItemRestService\/itemName\/com.ibm.team.workitem.WorkItem\/64486?_action=bugzillaWorkflow.action.a6\" - there is a later version of this item available.",
"oslc_cm:status": 412
Please advise. I have some important services on halt.
Thanks,
Binoy
|
6 answers
![]()
The problem appears to be related to the way you are quoting the If-Match header. Your command should look like this (notice the single quotes:
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.
|
![]()
The work around i have is to remove the "If-Match" header. Somehow JTS 4.0.1 server does not process this as it used to with 3.0.1
|
![]() 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
HTTP/1.1 409 Conflict
<?xml version="1.0" encoding="UTF-8"?><oslc_cm:error xmlns:oslc_cm="http://open-
HTTP/1.1 412 Precondition Failed
<?xml version="1.0" encoding="UTF-8"?><oslc_cm:error xmlns:oslc_cm="http://open-
|
![]()
Jorge Diaz (866●42●34)
| answered Oct 16 '13, 12:06 p.m.
JAZZ DEVELOPER edited Oct 23 '13, 12:25 p.m.
Hi Luis,
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!!
|
![]()
Hello,
I´m trying to do use curl to change the state in 6.02 version, but getting error 500:
curl -o 1503706.json -k -b cookies.txt "https://server:9443/ccm/oslc/workitems/1503706.json" -H "Content-Type:application/x-oslc-cm-change-request+json"
curl -k -v -b %COOKIES% "https://server:9443/ccm/oslc/workitems/1503706.json" --header "Content-Type:application/x-oslc-cm-change-request+json" --header "Accept:application/x-oslc-cm-change-request+json" -X PUT --data-binary @1503706.json "https://server:9443/ccm/resource/itemName/com.ibm.team.workitem.WorkItem/1503706?_action=change_workflow.action.a2"
--------------------------
result:
> Content-Type:application/x-oslc-cm-change-request+json
> Accept:application/x-oslc-cm-change-request+json
> Content-Length: 13805
> Expect: 100-continue
>
< HTTP/1.1 100 Continue
< HTTP/1.1 100 Continue
< Content-Length: 0
< Date: Fri, 29 Jul 2016 21:13:05 GMT
< HTTP/1.1 500 Internal Server Error
< Date: Fri, 29 Jul 2016 21:13:05 GMT
< X-Powered-By: Servlet/3.0
< Cache-Control: private, max-age=0, must-revalidate
< Expires: Fri, 29 Jul 2016 21:13:05 GMT
< Vary: Accept
< Content-Type: application/x-oslc-cm-change-request+json;charset=UTF-8
< Content-Language: pt-BR
< Connection: close
< Transfer-Encoding: chunked
<
{
"oslc_cm:message": null,
"oslc_cm:status": 500
|