JIRA REST API - 如何查询问题状态名称

Ste*_*phy 6 rest jira jira-rest-api

我正在使用JIRA REST API,我想查询处于"已解决"状态的所有问题.状态字段如下所示:

"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"
      }
    }
Run Code Online (Sandbox Code Playgroud)

目前知道这样做的唯一方法是查询status = 5.最好使查询更直观,并使用字符串"已解决"状态查找所有问题.这是我正在使用的查询:

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

是否可以查询状态名称?

luv*_*tor 7

是的,您也可以查询状态名称.

我想你应该使用官方的吉拉文档,尤其是这种使用像JQL查询高级搜索选项时.

本文档描述了可能的JQL查询的每个部分.如果查看" 字段参考"部分,您将在其中找到字段以及可以搜索的可能属性.例如,在状态字段的情况下:

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

据此,您的查询可以轻松修改

https://jira.atlas.xx.com/rest/api/2/search?jql=project=MYPROJECT and status=Resolved and fixVersion=15824&fields=id,key,description,status
Run Code Online (Sandbox Code Playgroud)