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

400 error when using REST / PATCH to change a workitem state

Hi all,

I'm using REST to try and change the state of a work item in Rational Team Concert, like this:

curl -k -X PATCH -b ~/cookie-test.txt -H "Content-Type: application/x-oslc-cm-change-request+json" -H "Accept: application/json" -d '{"rtc_cm:state": {"rdf:resource": "https://rtc.astsnet.com/ccm/oslc/workflows/_4d-C4A_hEei4Y9x1-0JhoA/states/com.ibm.team.workitem.defectWorkflow/com.ibm.team.workitem.defectWorkflow.state.s34" } }' https://rtc.astsnet.com/ccm/oslc/workitems/313172?_action=com.ibm.team.workitem.defectWorkflow.action.a43



    
In my test environment, this works fine, but in Production, it returns a 400 error. There isn't anything revealing in the logs.

Both test and production are running 6.0.6.1.

I'm not sure what's going on! I tried filling in the estimate fields and leaving them blank, as well as sending `rtc_cm:resolved` along with my state.

Are there configuration or other differences I should look for in order to figure out what might make this work in Production?

This only seems to happen with PATCH operations.

[Edited to remove log entry that now seems like it is probably unrelated]

Any pointers you have or things I might try would be helpful. Thank you.

0 votes

Comments

Are you able to do the state change manually? try using RESTCLIENT in Firefox or Postman. Switch off auto redirect and look if the error messages are better. 


The request result body should contain more text.
 

Preconditions, follow up actions and permissions can be different on both systems. the process might be customized. 

The Content-Type looks suspicious, not sure.



One answer

Permanent link
I'm glad I got a couple replies, because I have an update and didn't remember to post it here.

I am still mystified about the difference between the test and the production environments that I'm seeing, but I worked around this by using 'PUT' instead of 'PATCH' for the state transition. It seems that actions work better with 'PUT', and it did not overwrite any workitem attributes.

0 votes

Comments

The REST APIs support POST, PUT, GET, DELETE for CRUD. Not sure if PATCH is supported.

PATCH does seem to be supported to update workitem attributes (like title), without having to post the entire workitem and all its data:

Ah, forgot about that. 

Follow up, as far as I can tell PATCH is not supported - in some calls I get a not implemented error. To do partial update, use the oslc.properties query parameter. See my findings in https://rsjazz.wordpress.com/2022/02/02/ewm-work-item-oslc-cm-api/ 

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,930
× 478
× 137

Question asked: Dec 23 '20, 1:37 p.m.

Question was seen: 2,194 times

Last updated: Mar 10 '22, 9:41 a.m.

Confirmation Cancel Confirm