Reputation: 658
I need to get Jira ticket ID based on summary and description field
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
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 :(
Upvotes: 2
Views: 1589
Reputation: 54
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:
Official documentation 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 protected]:<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"
}
}
}'
Upvotes: 1
Reputation: 658
found a solution:need to use escape character
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
Upvotes: 0