简体   繁体   English

基于问题名称/描述的 JIRA JQL CURL-搜索(根据名称获取票证 ID)REST API

[英]JIRA JQL CURL-Search based on Issue name/description (Get ticket ID based on name) REST API

I need to get Jira ticket ID based on summary and description field我需要根据摘要和描述字段获取 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"

but got curl: (6) Could not resolve host: summary=Check o365 license Unknown error但得到了curl: (6) Could not resolve host: summary=Check o365 license Unknown error

when searching on summary field alone no error but no results单独搜索汇总字段时没有错误但没有结果

Here is some output from tickets which i used as search filter (summary and description)这是我用作搜索过滤器的票证的一些输出(摘要和描述)

    "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" 

I can filter by project and assignee我可以按项目和受让人过滤

jql=project=Technology+AND+assignee=user 

but when searching by description and/or summary now got no errors but also no results :(但是当按描述和/或摘要搜索时,现在没有错误,但也没有结果:(

you have some options to solve it, first, you need to replace the space.您有一些选择来解决它,首先,您需要更换空间。 Second, check the official documentation, you can send a json with your field filled follow example:其次,查看官方文档,您可以发送一个带有您的字段的json,如下示例:

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

Go to the documentation before running something!在运行之前先查看文档!

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