I've created a curl script but it seems the query is showing wrong results.
curl -H "Authorization: Basic ZnJhbmtsaW4ubWFudWJhZ0BhY2MuY28ubno6WW5HQUFNdUJ4WmF0NDBUelVielUyRDAy" -X GET -H "Content-Type: application/json" "https://project.atlassian.net/rest/api/2/search?jql=project=NAME&status=done&runQuery=true"
The data part of parameter jql has to encoded ans jql does not take & in query, so if you JQL query is,
project=NAME AND status=done
it should be url encoded,
project%3DNAME%20AND%20status%3Ddone
If you are not happy with encoding your query every time, try using POST request in place of GET request for JQL search, check this page ('Searching for issues examples' section)
https://developer.atlassian.com/server/jira/platform/jira-rest-api-examples/
Thanks.. that worked..
I'm facing another issue adding the fixVersion but the value has a space. The http link works on a browser but fails on curl.
curl -H "Authorization: Basic ZnJhbmtsaW4ubWFudWJhZ0BhY2MuY28ubno6WW5HQUFNdUJ4WmF0NDBUelVielUyRDAy" -X GET -H "Content-Type: application/json" "https://project.atlassian.net/rest/api/2/search?jql=status=done+and+project=NAME+and+fixVersion=%22AB%203.1%22"
This worked for me,
status%20%3D%20Done%20AND%20project%20%3D%20NAME%20AND%20fixVersion%20%3D%20%22AB%203.1%22
Also I suggest you switch to POST request to search for issues via API, in that you can copy query directly from search field, no need for encoding etc.
I've used your suggestion and encountered this error.. I will test the POST
{"errorMessages":["Error in the JQL Query: Expecting operator before the end of the query. The valid operators are '=', '!=', '<', '>', '<=', '>=', '~', '!~', 'IN', 'NOT IN', 'IS' and 'IS NOT'."],"errors":{}}
It looks like you're new here. Sign in or register to get started.