Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

REST api for changing the state of the workitem doesn't work with RTC 4.0.1

 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

2

0 votes



6 answers

Permanent link
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.

2 votes

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"


Permanent link
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"

0 votes

Comments

Tried with single quotes as you suggested, still doesn't work. Getting the same oslc_cm:status: 412 message.

Please help.


Permanent link
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

0 votes


Permanent link
 I'm facing the same problem but I don't think that removing the header is a workaround. Any news on this? How can the If-Match header be used in version 4?

Thanks,
Michele.

0 votes

Comments

I don't have any update. Unfortunately, RTC Rest api are not supported by IBM and I haven't found any useful information in the forums.


Permanent link

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>

0 votes


Permanent link
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

0 votes

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,936
× 369
× 137

Question asked: Mar 27 '13, 10:26 a.m.

Question was seen: 11,710 times

Last updated: Jul 29 '16, 5:26 p.m.

Confirmation Cancel Confirm