I am writing a script (in Powershell if that matters) to deploy SQL code. Part of the logic that I want in the script is to have it check that the JIRA issue associated with the script is in the correct status prior to deploying (e.g. in my case that the issue status is "QE Certified".
I'm trying to use the JIRA REST API but so far have been unable to find a way to give me the current status of an issue. The closest I've found is to look at the transitions available for the issue:
https://docs.atlassian.com/jira/REST/5.2/#id251679
This doesn't give me the current status but I could figure it out from the available transitions. That seems a bit kludgy to me.
I was hoping there would be something like /rest/api/2/issue/{issueIdOrKey}/status that would just give me the current status of the issue.
What would be the best way to get the issue status via the REST API?
Thanks
To update the status, you need to use the Transition issue. You can edit an issue using the Edit issue API. The fields that can be edited are determined using Get edit issue metadata.
If you have Jira Admin permissions you can go to Jira settings > Issues > Statuses. Here you will see all the statuses that are available and how many workflows are associated with each status.
The Jira REST API enables you to interact with Jira programmatically. Use this API to build apps, script interactions with Jira, or develop any other type of integration. This page documents the REST resources available in Jira Cloud, including the HTTP response codes and example requests and responses.
You can use /rest/api/2/issue/{issueIdOrKey}
and set the fields-parameter to restrict the returned data to the status field.
So your request would be:
/rest/api/2/issue/{issueIdOrKey}?fields=status
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With