I would like to know how we can call a REST API to change work flows states.

Mubeena T M August 24, 2017

I need to create a plugin that should call a REST API. Based on the response from the API, want to change the work flow state.

1 answer

1 vote
Tayyab Bashir
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.
August 24, 2017

You need to need into the following REST API. 

api/2/issue/{issueIdOrKey}/transitions

The GET Method of this api takes issue key and retruns all the possible tranistions from the current state to future state. 

So lets say an issue is "In Progress" state and can go to "Resolved" and "Closed" from here. 

So the GET method would return resolved and closed along with their Ids and other information. 

Then you would make a POST request to your issue to update its status. 
Note: If there are some mandatory fields on issue screens on any of the transistions, they would need to be provided as well. 

e.g.

{
"update": {
"comment": [
{
"add": {
"body": "Bug has been fixed."
}
}
]
},
"transition": {
"id": "51"
} }
}

Suggest an answer

Log in or Sign up to answer