It's all about the answers!

Ask a question

Problem with updating a WorkItem using Curl


Asaf Kivity (3311016) | asked Mar 20 '13, 4:37 a.m.
edited Mar 20 '13, 4:38 a.m.
Hi All,
I was using this useful guide: https://jazz.net/wiki/bin/view/Main/ResourceOrientedWorkItemAPIv2 to try to manipulate WorkItems from a script.
There is a section  regarding update of a Work Item:
https://jazz.net/wiki/bin/view/Main/ResourceOrientedWorkItemAPIv2#Update_a_Work_Item
The issue is that I always get
HTTP/1.1 412 Precondition FailedServer: Apache-Coyote/1.1Cache-Control: private, max-age=0, must-revalidateExpires: Wed, 20 Mar 2013 08:26:32 GMTVary: AcceptContent-Type: application/x-oslc-cm-change-request+json;charset=UTF-8Transfer-Encoding: chunkedDate: Wed, 20 Mar 2013 08:26:32 GMT{    "oslc_cm:message": "CRJAZ0007I Unable to update the item identified by \"https:\/\/clm-demo:9443\/ccm\/service\/com.ibm.team.repository.common.internal.IItemRestService\/itemName\/com.ibm.team.workitem.WorkItem\/90\" - there is a laterversion of this item available.",    "oslc_cm:status": 412}
and the update does not work.
I was running these commands:
set URL="https://clm-demo:9443/ccm/resource/itemName/com.ibm.team.workitem.WorkItem/90"
curl -D - -k  -b %COOKIES% -o "wi-90.json" -H "Accept: application/x-oslc-cm-changerequest+json" %URL%

And from the ETag response, run this line:

curl -D - -k -b %COOKIES% -H "If-Match: 7250960a-8438-31d1-a97a-5ffba71fc94e" -H "Content-Type: application/x-oslc-cm-change-request+json" -H "Accept: application/x-oslc-cm-change-request+json" -X PUT --data-binary @wi-90.json %URL%

and got the error above.
Any Ideas?
Thanks!
Asaf














Comments
Binoy D'costa commented Mar 28 '13, 1:37 p.m.

Hi Asaf,

I'm getting the same message while updating the state of the workitem. Did you get around this issue?

Thanks,
Binoy

One answer



permanent link
Emiliano Iannetti (111) | answered Dec 06 '19, 10:13 a.m.

 Hi, I don't know the solution to your problem well, as I don't "work" with get calls, but the problem that gives you the classic conflict about workitems seems to me. I'll explain:

Java side, where I work practically to change the workitem you can't do it on the same direct but you have to instantiate a copy that will then receive the modification and that it will be saved and will update the original element. Maybe the other problem is similar. Try to see if you can retrieve the item after retrieving the item and "maneuver" that. I hope to be useful.

Your answer


Register or to post your answer.