Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

rest

jira

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

like image 929
user3570706 Avatar asked Sep 04 '14 14:09

user3570706


People also ask

How do I change the Issue status in Jira rest API?

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.

How do I see statuses in Jira?

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.

What is the use of rest API in Jira?

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.


1 Answers

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
like image 182
Seb Avatar answered Oct 20 '22 19:10

Seb