简体   繁体   中英

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?

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM