"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: 


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

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 vote
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
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Tuesday in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

246 views 1 18
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