Hello folks,
I'm trying to transition a Jira issue via REST API. However, I keep getting 400 response.
POST: `https://xxxxxx/rest/api/3/issue/<issue_id>/transitions`
Header: Content-Type: application/json
Auth: Basic <user>:<token>
Body: `{"transition":{"id":<id>}}`
Expected: 204
Actual: 400 (Bad Request) `Transition Id <id> is Invalid
I have verified that the <id> is available via the `statuses` endpoint:
GET: https://xxxxxx/rest/api/3/status/<id>
Response: 200 (With the status detail)
Surprisingly, I was able to set the Issue status to the expected value manually via dropdown and verify via the GET api that the value is indeed the one I'm trying to set above.
GET: https://xxxxxx/rest/api/3/issue/<IssueId>?fields=status
Response: 200 with the proper/expected status value
Furthermore:
1. Using the same POST REST API, I am able to transition the Issue to a state that is NOT visible in the dropdown! How is this possible?
Questions
1. Why do I get a 400 response when setting a valid status (since I can set the value manually from the dropdown)?
2. Why am I able to transition a Jira to an "invalid" status (since THAT value is not available in the dropdown)?
Thank you.
Welcome to the Atlassian Community!
I think you may be mixing up transition and status. The drop-down is showing you the ids of the status it is displaying, it is not giving you a transition id.
To change status, you don't even look at the status, you push the issue through a transition.
I've just looked at a workflow and a snippet of it says
In this case, you would need the id of 30, not the 10051 or 10078 the status list shows.
Good catch! You're right.. I indeed confused the two. Using the transition Id works well. Accepting this answer. Thank you!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It is a little bit of a weird one - the drop-down status list is a replacement for a many that named the transitions and showed you their IDs, but it's actually still triggering transitions when you select the status!
Very confusing at first - we had developers going off trying to change transition automation and scripts because they thought the ids of the transitions had changed even though they were working fine!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.