jira - 如何使用 JQL 检索特定状态的问题

标签 jira jql jira-rest-java-api

输入一个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"
        }
      }
    },(...)
  ]
}

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

最佳答案

对属性使用 URL 编码。

也许可以使用 this 之类的在线工具从这个 URL 编码你的 JQL:

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 将是所有已关闭的问题。

关于jira - 如何使用 JQL 检索特定状态的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17976378/

相关文章:

java - 如何解决 AsynchronousJiraRestClientFactory 的 java.lang.NoClassDefFoundError?

java - 从 Jira 获取所有工作时间

soap - 如何使用 JIRA SOAP API 在问题上设置标签

python - 检查是否存在史诗问题,如果不存在,则创建一个新的史诗问题

python - 通过 REST API 查询 JIRA 以及查询中可能存在错误值

JIRA JQL : How to search on issues closed before a time in the day?

linux - JIRA 启动失败 ("The following plugins are required by JIRA, but have not been started")

groovy - 找不到匹配方法 - JIRA/Groovy

rest - 从 Jenkins 在 JIRA 中创建请求

java - 使用什么技术来访问 Jira 3.13.2?