簡體   English   中英

基於問題名稱/描述的 JIRA JQL CURL-搜索(根據名稱獲取票證 ID)REST API

[英]JIRA JQL CURL-Search based on Issue name/description (Get ticket ID based on name) 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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM