"Error in the JQL Query: Expecting either 'OR' or 'AND' but got ','

Hi! I am newbie here!
I am trying to get issues by passing some parameters using JQL.
First, I am building normal string for jql 

e.g jqlExpr:::::::: project=Jira&fields=id,key,project,assignee,description,summary,status,priority,reporter,created,updated,issuetype,subtasks&maxResults=-1&assignee=abc

After encoding it with java method : #[java.net.URLEncoder.encode(flowVars.jqlExpr)]

also  i am setting the encoding as 'ISO 10646/Unicode(UTF-8)'
I am passing it the request call as: 

https://<host>/rest/api/2/search?jql=project%3DJira%26fields%3Did%2Ckey%2Cproject%2Cassignee%2Cdescription%2Csummary%2Cstatus%2Cpriority%2Creporter%2Ccreated%2Cupdated%2Cissuetype%2Csubtasks%26maxResults%3D-1%26assignee%3Dabc


Error message i am getting :
Error: {
"errorMessages": [
"Error in the JQL Query: Expecting either 'OR' or 'AND' but got ','. (line 1, character 21)"
],
"errors": {}
}

 

I am not able to understand what's going wrong and how can I resolve?


I appreciate your response.Thanks! 

2 answers

1 accepted

Accepted Answer
1 vote
Warren Levy Community Champion Nov 30, 2017

Hi Anuja

assignee=abc is part of the jql, but you've got it as a parameter being passed to the API. Try

jql=project=Jira AND assignee=abc&fields=id,key,project,assignee,description,summary,status,priority,reporter,created,updated,issuetype,subtasks&maxResults=-1

If you still get an error, try copying just the JQL bit (i.e. everything after jql= up to and excluding the first &) into a Jira query and see if there are any errors

Hello Warren,

Thanks a lot! 
the best answer! it  did not only just resolve the error but also helpful in a way to connect the dots here. 


I tried to use JIRA's UI to search issues to know url--> concluded that it should be encoded but JIRA's UI allowed only these two Fields 'project' and 'assignee' in advanced search issue text field, wondering why it wont allow 'fields=id,key..etc'  
Now i got what JQL is! 

so no need to do encoding in this case!

0 votes
Warren Levy Community Champion Nov 30, 2017

fields= is not part of JQL, it is what the API uses to know which fields to report on. The equivalent in the Jira issues screen is the Columns dropdown where you choose which fields (columns) to show

yes, tried that too and it didn't get added in the url,,just changed on the screen

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Sep 18, 2018 in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

24,350 views 2 7
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you