I've been trying to transition an issue via Rest API for over a week now with no success. I've been able to create an issue, add a comment, change the assignee.. but not transition to a different status.
Here's my work:
I first determine the transition IDs - It's currently In Progress, and I'm wanting to Close it.
The following is shown after "rest/api/2/issue/REL-10569/transitions?expand=transitions.fields" is appended to the jira server:
{"expand":"transitions","transitions":[{"id":"21","name":"Close","to":{"self":"https://jira.bullhorn.com/rest/api/2/status/6","description":"The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.","iconUrl":"https://jira.company.com/images/icons/statuses/closed.png","name":"Closed","id":"6","statusCategory":{"self":"https://jira.company.com/rest/api/2/statuscategory/3","id":3,"key":"done","colorName":"green","name":"Done"}},"fields":{}}]}
So I'm wanting to use transition ID 21 (I'm assuming - I've tried the other IDs any they did not do anything either).
I'm using a user with full admin permissions - the following is my script:
api_data="{\"update\":{\"comment\":[{\"add\":{\"body\":\"It is time to finish this task\"}}]},\"fields\":{\"assignee\":{\"name\":\"username\"},\"resolution\":{\"name\":\"Done\"}},\"transition\":{\"id\":\"21\"}}"
curl -D- -u "username":"${password}" -w "<%{http_code}>" -H "Content-Type: application/json" https://jira.company.com/rest/api/2/issue/${TICKETNUMBER} -X PUT --data "${api_data}"
This script successfully adds a comment and assigns the issue, returning a 204 No Content code, but no transition is made into the next workflow status.
I've also read that transition can only be set with a Post, so I also tried the following:
api_data="{\"transition\":{\"id\":\"21\"}}"
curl -D- -u "username":"${password}" -w "<%{http_code}>" -H "Content-Type: application/json" https://jira.company.com/rest/api/2/issue/${OUTBOUNDRELTICKET}/ -X POST --data "${api_data}"
This returns 405 method not allowed.
I've also read that /transitions needs to be appended to server name in the curl, after the ticket number - this returns a 500 Internal Server Error.
So I believe I have tried Everything that is on the internet, but nothing works. I'm desperate... please help!