Hi guys,
I am using a curl PUT command to update JIRA issue status, it is returning the HTML 204 response but no status is being updated. The only thing being updated is a comment into the issue "test test". The transition id 101 is "In progress".
What am I doing wrong?
See code below:
curl -v -D- -u username:password -X PUT --data \'{"update": {"comment": [{"add": {"body": "test test"}}]}, "transition": {"id":"101"}}\' -H "Accept:application/json" -H "Content-Type:application/json" "https://tests.atlassian.net/rest/api/2/issue/TES-3"
cheers,
Hello Samuel,
To update an issue status you need to call the transition action with POST:
curl -u username:password -X POST --data '{"transition":{"id":"11"}}' -H "Content-Type: application/json" http://jira/rest/api/2/issue/TEST-1/transitions
Reference: https://docs.atlassian.com/software/jira/docs/api/REST/7.11.0/#api/2/issue-doTransition
I hope that helps,
Tom
@tomd thanks very much for your solution it works properly.
I wonder how we can keep the comment there to work.
Would you know if it is possible to use POST with a comment (like in same curl command)?
Or should I pass 2 curl commands one for POST (transition) one for PUT (comment)?
Cheers, Sam
You should be able to use the following JSON in your POST call:
{ "update": { "comment": [ { "add": { "body": "Bug has been fixed." } } ] }, "transition": { "id": "5" },}
@tomd
Hello, I tried this piece of code you suggested me. However, I wasn't able to add the comment.
The only update was on the transition.
I made other test by using two curl commands, one POST (transition) and one PUT (comment) and it worked properly.
I wonder if update:comment:add works only with PUT, instead of POST.
Thanks, Sam
is this works only for api version 2?
It looks like you're new here. Sign in or register to get started.