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

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 Community Champion Aug 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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted 2 hours ago in Confluence

Calling all marketing teams who use Confluence - we want to hear from you!

Hi Community! me again 🙂 If you’re a marketing team using Confluence, we want to hear your story! How did you start using Confluence? What are your use cases? What have been some of the benefits?...

22 views 0 2
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you