Inconsistent result in Jira API
Asked by Vimalraj:

When I use below API, I get below error,

[https://localhost.jira.com/rest/api/2/search?\&fields=reporter,status,summary\&issuetype=Change\&jql=](https://localhost.jira.com/rest/api/2/search?&fields=reporter,status,summary&issuetype=Change&jql=)("'Program Name'=Test")\&maxResults=1000

```
{"errorMessages":["Error in the JQL Query: Expecting operator but got ')'. The valid operators are '=', '!=', '<', '>', '<=', '>=', '~', '!~', 'IN', 'NOT IN', 'IS' and 'IS NOT'. (line 1, character 23)"],"errors":{}}
```

When I use below API, I get all other records except "Change" records

[https://localhost.jira.com/rest/api/2/search?\&fields=reporter,status,summary\&\&issuetype=Change\&jql](https://localhost.jira.com/rest/api/2/search?&fields=reporter,status,summary&&issuetype=Change&jql):("'Program Name'=Test")\&maxResults=1000

May I know what is wrong with the api?

Thanks


Answers:
author: Marc - Devoteam
body: HI [@Vimalraj](/t5/user/viewprofilepage/user-id/120036)

I think your call is not correct.

I assume you want to see all issue with type change and the changes have a field program name set with value test and you want to show the fields:

reporter, status and summary

Am i correct?

The the call should be: <https://localhost.jira.com/rest/api/2/search?jql=>"Program Name"=Test and type=change\&fields=reporter,status,summary

comments: author: Vimalraj
body: [@Marc - Devoteam](/t5/user/viewprofilepage/user-id/3796976) Thanks for your response. Could you pls check on the above issue?


author: Marc - Devoteam
body: Hi [@Vimalraj](/t5/user/viewprofilepage/user-id/120036)

I don't have inconsistencies in my trials.

[https://localhost/rest/api/latest/search?jql=status%20=%20%22in%20progress%22\&fields=summary,status,reporter](https://localhost/rest/api/latest/search?jql=status%20=%20%22in%20progress%22&fields=summary,status,reporter)

This gets all issues with status in progress

[https://localhost/rest/api/latest/search?jql=type=Task%20and%20status%20=%20%22in%20progress%22\&fields=summary,status,reporter](https://localhost/rest/api/latest/search?jql=type=Task%20and%20status%20=%20%22in%20progress%22&fields=summary,status,reporter)

This gets all Tasks with status in progress

I do see an issue in you URL. %27 equals : and you should use %22 that represents "

So your URL should look like:

[https://localhost.jira.com/rest/api/2/search?fields=reporter,status,summary\&jql=issuetype=Change%20AND%20%22Program%20Name%22=Test\&status=%22In%20backlog%22\&maxResults=1000](https://localhost.jira.com/rest/api/2/search?fields=reporter,status,summary&jql=issuetype=Change%20AND%20%22Program%20Name%22=Test&status=%22In%20backlog%22&maxResults=1000)


author: Fabio Racobaldo _Herzum_
body: Hi [@Vimalraj](/t5/user/viewprofilepage/user-id/120036) ,

please could you try the following [https://localhost.jira.com/rest/api/2/search?fields=reporter,status,summary\&jql=issuetype=Change%20AND%20%27Program%20Name%27=Test\&maxResults=1000](https://localhost.jira.com/rest/api/2/search?fields=reporter,status,summary&jql=issuetype=Change%20AND%20%27Program%20Name%27=Test&maxResults=1000) ?

Hope this helps,

Fabio

comments: author: Vimalraj
body: Thanks [@Fabio Racobaldo _Herzum_](/t5/user/viewprofilepage/user-id/781528) . It returns with value even for other program names and not just "Test". Also, If I include status like below

[https://localhost.jira.com/rest/api/2/search?fields=reporter,status,summary\&jql=issuetype=Change%20AND%20%27Program%20Name%27=Test\&status=%27In%20backlog%27\&maxResults=1000](https://localhost.jira.com/rest/api/2/search?fields=reporter,status,summary&jql=issuetype=Change%20AND%20%27Program%20Name%27=Test&status=%27In%20backlog%27&maxResults=1000)

It returns with all status and not just "In Backlog". Pls assist.

Thanks


author: Vimalraj
body: I'm able to get it working as below. Thanks for your support

[https://localhost.jira.com/rest/api/2/search?fields=reporter,status,summary\&issuetype=ChangeAND\&jql=%20%27Program%20Name%27=Test\&status=%27In%20backlog%27\&maxResults=1000](https://localhost.jira.com/rest/api/2/search?fields=reporter,status,summary&issuetype=ChangeAND&jql=%20%27Program%20Name%27=Test&status=%27In%20backlog%27&maxResults=1000)


Tags: data-center

jira-data-center

jira-server

server