基于问题名称/描述(基于名称获取机票ID)的JIRA JQL curl-search REST API



我需要根据摘要和说明字段获取JIRA票证ID

curl -D- -u user:password -X GET -H "Content-Type: application/json" https://jira.corp.company.com/rest/api/2/search?jql=project="Technology" and summary="Check o365 license"

但是获得了curl: (6) Could not resolve host: summary=Check o365 license Unknown error

仅在摘要字段上搜索时,没有错误,但没有结果

这是我用作搜索过滤器的门票的一些输出(摘要和描述(

    "customfield_10600":null,"customfield_10204":null,"customfield_11019":null,"customfield_10205":null,"customfield_10206":null,"attachment":[],"aggregatetimeestimate":0,**"summary":"Check o365 license"**,"creator"
"components":[],"timeoriginalestimate":57600,"description":"Check office 365 license" 

我可以通过项目和受让人过滤

jql=project=Technology+AND+assignee=user 

但是,当通过描述和/或摘要进行搜索时,现在没有错误,但也没有结果:(

您有一些解决方案的选择,首先,您需要替换空间。其次,检查官方文档,您可以发送一个带有字段的JSON,请按照以下示例:

官方文件https://confluence.atlassian.com/jirasoftwareserver/search-syntax-for-text-fields-939938747.html

在运行某件事之前先转到文档!

curl --request POST 
  --url 'https://your-domain.atlassian.net/rest/api/2/issue' 
  --user 'email@example.com:<api_token>' 
  --header 'Accept: application/json' 
  --header 'Content-Type: application/json' 
  --data '{
  "update": {
    "worklog": [
      {
        "add": {
          "timeSpent": "60m",
          "started": "2019-07-05T11:05:00.000+0000"
        }
      }
    ]
  },
  "fields": {
    "summary": "Main order flow broken",
    "parent": {
      "key": "PROJ-123"
    },
    "issuetype": {
      "id": "10000"
    },
    "components": [
      {
        "id": "10000"
      }
    ],
    "customfield_20000": "06/Jul/19 3:25 PM",
    "customfield_40000": "Occurs on all orders",
    "customfield_70000": [
      "jira-administrators",
      "jira-software-users"
    ],
    "project": {
      "id": "10000"
    },
    "description": "Order entry fails when selecting supplier.",
    "reporter": {
      "id": "5b10a2844c20165700ede21g"
    },
    "fixVersions": [
      {
        "id": "10001"
      }
    ],
    "customfield_10000": "09/Jun/19",
    "priority": {
      "id": "20000"
    },
    "labels": [
      "bugfix",
      "blitz_test"
    ],
    "timetracking": {
      "remainingEstimate": "5",
      "originalEstimate": "10"
    },
    "customfield_30000": [
      "10000",
      "10002"
    ],
    "customfield_80000": {
      "value": "red"
    },
    "security": {
      "id": "10000"
    },
    "environment": "UAT",
    "versions": [
      {
        "id": "10000"
      }
    ],
    "duedate": "2019-03-11",
    "customfield_60000": "jira-software-users",
    "customfield_50000": "Could impact day-to-day work.",
    "assignee": {
      "id": "5b109f2e9729b51b54dc274d"
    }
  }
}'

找到了一个解决方案:需要使用逃生字符

 curl -XH -u user:pass -X GET -H "Content-Type: application/json" https://mycompany/rest/api/2/search?jql=project='"Technology"+AND+summary~"Check%20O365%20License%20"' | python -m json.tool > 1.json

最新更新