Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Rest API says Transition id is not valid for this issue but I can transition through dropdown

Rohit Potnis
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 10, 2022

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.

1 answer

1 accepted

2 votes
Answer accepted
Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 10, 2022

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

  • Current status: New: id 10051
  • Transition: Start work: id 30
  • Transition target status: In dev: id 10078

In this case, you would need the id of 30, not the 10051 or 10078 the status list shows. 

Rohit Potnis
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 10, 2022

Good catch! You're right.. I indeed confused the two. Using the transition Id works well. Accepting this answer. Thank you!

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 10, 2022

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!

Like Rohit Potnis likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events