1
votes

I want to get issues of a certain issuetype from a project using the curl call for Jira api.

curl -D- -X GET -H "Authorization: Basic encoded" -H "Content-Type: application/json" "site/rest/api/2/search?jql=project="GB" and issuetype="Risk""

This is the call i use. It gets all the issues of project GB and not only of type Risk. I dont see where i go wrong with my JQL. I already replased issuetype with type but it still doesn't work. It keeps returning all issues and not only the issues of type Risk.

2

2 Answers

1
votes

Your JQL is correct, but your curl commandline is not.

You're using double quotes within a double quoted string. You'll have to either escape your inner double quotes or use single quotes instead.

E.g. try this:

curl -D- -X GET -H "Authorization: Basic encoded" -H "Content-Type: application/json" "site/rest/api/2/search?jql=project=\"GB\" and issuetype=\"Risk\""
0
votes

Is probably a problem due parsing of the link.

I suggest you to use the post search instead.

curl -D- -u Username:Password  -X POST -H "Content-Type: application/json" --data "{\"jql\":\"project = GB and issueType = Risk\"}"  "site/rest/api/2/search"