3

输入一个 url,或者使用 curl 运行,例如:

https://<myurl>/rest/api/2/search?jql=project=<myproject>&status=closed&fields=id,key,status,project&maxResults=5

在我的项目中向我返回 5 个项目,但具有所有状态。出于某种原因,我无法查询特定状态。

输出(部分)是:

{
  "expand": "schema,names",
  "startAt": 0,
  "maxResults": 5,
  "total": 727,
  "issues": [
    {
      "expand": "editmeta,renderedFields,transitions,changelog,operations",
      "id": "79577",
      "self": "https://<myurl>/rest/api/2/issue/79577",
      "key": "<myproject>-774",
      "fields": {
        "project": {
          "self": "https://<myurl>/rest/api/2/project/<myproject>",
          "id": "14421",
          "key": "<myproject>",
          "name": "<myproject>",
          "avatarUrls": {
            (...)
          }
        },
        "status": {
          "self": "<myurl>/rest/api/2/status/1",
          "description": "The issue is open and ready for the assignee to start work on it.",
          "iconUrl": "https://<myurl>/images/icons/statuses/open.png",
          "name": "Open",
          "id": "1"
        }
      }
    },(...)
  ]
}

如何查询给定的状态?非常感谢。

4

2 回答 2

6

对属性使用 URL 编码。

也许使用这样的在线工具对您的 JQL 进行 URL 编码:

project = PROJECTKEY AND status = Closed

得到这个:

/rest/api/2/search?jql=project%20%3D%20PROJECTKEY%20AND%20status%20%3D%20Closed&fields=id,key,status,project&maxResults=5

生成的 JSON 将是所有已关闭的问题。

于 2013-08-01T10:44:47.863 回答
4

在问题导航器中运行所需的查询。使用“共享”按钮左侧的链接(类似于链式链接)来查找查询的 URL,例如

http://jira.example.com/issues/?jql=project%20%3D%20MDOAR%20and%20status%20%3D%20Closed

将该 URL 与 curl 一起使用

于 2013-08-01T20:45:05.473 回答