Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JIRA REST API -- How to Query On Issue Status Name

I'm using the JIRA REST API and I would like to query for all issues in "Resolved" status. The status field looks like this:

"status": {
      "self": "https:\/\/jira.atlas.xx.com\/rest\/api\/2\/status\/5",
      "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.",
      "iconUrl": "https:\/\/jira.atlas.xx.com\/images\/icons\/statuses\/resolved.png",
      "name": "Resolved",
      "id": "5",
      "statusCategory": {
        "self": "https:\/\/jira.atlas.xx.com\/rest\/api\/2\/statuscategory\/3",
        "id": 3,
        "key": "done",
        "colorName": "green",
        "name": "Complete"
      }
    }

Currently the only way to know to do this is to query for status=5. It would be nice to make the query more intuitive and look for all issues using the string "Resolved" status. Here is the query I'm using:

https://jira.atlas.xx.com/rest/api/2/search?jql=project=MYPROJECT and status=5 and fixVersion=15824&fields=id,key,description,status

Is it possible to query on status name?

like image 978
Steve Murphy Avatar asked Sep 02 '14 00:09

Steve Murphy


2 Answers

Yes, you can query on status name as well.

I think you should use the official Jira documentation, especially this when using advanced searching options like JQL queries.

This documentation describes every part of your possible JQL queries. If you look at the Fields reference section, there you will find the fields as well as the possible attributes on which you can search. For example, in case of Status field:

You can search by Status name or Status ID (i.e. the number that JIRA automatically allocates to a Status).

According to this, your query can be modified easily

https://jira.atlas.xx.com/rest/api/2/search?jql=project=MYPROJECT and status=Resolved and fixVersion=15824&fields=id,key,description,status
like image 139
luviktor Avatar answered Sep 28 '22 18:09

luviktor


If you can type the JQL in the browser, you can use it as a string for the REST API search resource. So you can indeed search by status name, suitable quoted

like image 40
mdoar Avatar answered Sep 28 '22 19:09

mdoar