Forums

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

Status transition using the edit issue endpoint

Hassan Rachid
Contributor
November 23, 2022

Hello,

 

I am trying to perform status transitions using the edit issue endpoint, since the documentation does state that it supported transitioning statuses. However, when I attempt to perform a status transition, I get a 204 response but the status doesn't actually transition. My request body is 

{"fields": {}, "transition": {"id": "21"}}.


Is it possible to transition status using that endpoint? If so, how can I get it to work? I am already aware of the endpoint that specifically handles status transitions, and that one works for me, but I'd like to lump it together with other edits if possible.

 

Thanks

1 answer

1 vote
Fernando Eugênio da Silva
Community Champion
November 23, 2022

@Hassan Rachid , Welcome to the Atlassian Community!

 

You can only edit fields in a transition event via REST API, if this transition has an associated screen. This is because the transition event will edit the fields and status together.

If you intend to transition the issue and edit fields without an associated screen in the transition, this will not work.

Create a new screen > Place the Summary field on it > Associate this screen with the transition you are making > Send the following payload.

{
"transition": {
"id": "XXX"
},
"fields": {
"summary": "Changing summary by REST API transition"
}
}

I hope it helps :)

Regards,

Fernando - Cloud Application Engineer | OAT Solutions

Hassan Rachid
Contributor
November 23, 2022

And what if the transition doesn't require additional fields / have a screen associated with it? Do I just omit fields from the request body? I've tried this and have received a 400 response.

Fernando Eugênio da Silva
Community Champion
November 23, 2022

@Hassan Rachid 

If the event does not ask for field changes, just forward the issue. You must use the following parameters.

Metodo: POST
URL: https://your_site_name/rest/api/3/issue/{{issue key}}/transitions

Payload:

{
"transition": {
"id": "XX"
}
}

Hassan Rachid
Contributor
November 23, 2022

@Fernando Eugênio da Silva 

Yes, that endpoint works for me, but is it possible to do it with this endpoint?

PUT /rest/api/2/issue/{issueIdOrKey}

From the doc - "Edits an issue. A transition may be applied and issue properties updated as part of the edit."

However, when I try, it does not work and I am unsure why

Fernando Eugênio da Silva
Community Champion
November 23, 2022

@Hassan Rachid 

Yes, I saw it. Honestly I had some difficulty until I understand that the PUT method is only accepting "Edit Issue" not related to status/transition or maybe I didn't understand the payload right

The method I got was sending a POST payload like I showed you before.

Maybe it's a case for you to see with Atlassian if this is really a documentation error or just missing information in the doc.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events