Entering a url, or running with curl, like:
https://<myurl>/rest/api/2/search?jql=project=<myproject>&status=closed&fields=id,key,status,project&maxResults=5
returns me 5 items in my project but with all statuses. For some reason I can't query for a specific status.
The output (part of it) is:
{
"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"
}
}
},(...)
]
}
How to query for a given status? Many thanks.
Use URL encoding on the attributes.
Perhaps use an online tool like this to URL encode your JQL from this:
project = PROJECTKEY AND status = Closed
to get this:
/rest/api/2/search?jql=project%20%3D%20PROJECTKEY%20AND%20status%20%3D%20Closed&fields=id,key,status,project&maxResults=5
The resulting JSON will be all closed issues.
Run the query you want in the Issue Navigator. Use the link to the left of the Share button that resembles a chain link to find the URL for the query, e.g.
http://jira.example.com/issues/?jql=project%20%3D%20MDOAR%20and%20status%20%3D%20Closed
Use that URL with curl
来源:https://stackoverflow.com/questions/17976378/how-do-i-retrieve-issues-of-specific-status-with-jql