How can I find the status of a JIRA issue via the REST API?

user3570706 picture user3570706 · Sep 4, 2014 · Viewed 29.8k times · Source

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

Answer

Seb picture Seb · Sep 5, 2014

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