It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Advanced Search Problems with WIld Cards, Parentheisis, and more than one condition

Mike Lang Dec 06, 2017

I am attempting Advanced Search using the Confluence API, and I am experiencing the following problems. 


(NOTE: When publishing this topic, the forum made changes to the HTML links below because it said they were invalid.  I hope they didn't change them too much!!!)


If I surround two or more conditions in the URL with parenthesis, an error is returned

THIS WORKS (no parenthesis):



THIS WORKS (parenthesis around each criteria):



THIS DO NOT WORK (parenthesis around BOTH criteria):


·         {"statusCode":400,"data":{"authorized":false,"valid":true,"errors":[],"successful":false},"message":"Missing closing parenthesis near field (()"}


THIS DO NOT WORK (parenthesis around each and BOTH criteria):


·         {"statusCode":400,"data":{"authorized":false,"valid":true,"errors":[],"successful":false},"message":"Could not parse cql : ((type=attachment)"}


If I use more than one criteria, it seems that some criteria are not executed


·         This returns 200 records (when it should return 0) because the titles were not filtered to only include the file titled "EODB". 

·         It seems that the type and limit were executed, but title was not

·         Examples of the titles returned include:

·         SeeTouchExample.pdf

·         DEPRECATED_Application_(GUI)_Software_Release_Authorization.xlsx

·         image2016-10-7 16:30:12.png

·         image2017-12-1_17-33-38.png

·         image2017-12-1_17-33-59.png

·         image2017-12-4_9-6-15.png



·         This returns no records (which is correct), and all I did was swap the order of TYPE and TITLE


Wildcards do not seem to work:



·         Both of these return an empty set


·         Returns 3 records, as expected

Please help…






1 answer

1 accepted

1 vote
Answer accepted
Stephen Deutsch Dec 07, 2017

Hi Mike,

Your major problem is that "and" in CQL is not the ampersand character (&), it is instead the word "AND".

Therefore the URL should look like this:"EODB"

In this URL, the + is a replacement for the space character. You could use %20 instead if you'd like.

Mike Lang Dec 07, 2017

Thanks, Stephen.  This helped some, but I am still having some problems.

Replacing "&" with "+AND+" solved the problem of "unable to use outer parenthesis" Thanks! 

However, the line that you "corrected" for me was working as-is (meaning, it worked using "&")  How was it able to work in that case?!?!  And more confusing, my example below seems to show that I HAVE to use "&", at least with 'limit'.




{"statusCode":400,"data":{"authorized":false,"valid":true,"errors":[],"successful":false},"message":"Could not parse cql : (type=attachment) AND (title~\"EODB*ESR\") AND (limit=200)"}


BUT THIS WORKS!!! (Doing it "wrong", using "&" instead of "+AND+"):"EODB*ESR")&(limit=200)





Stephen Deutsch Dec 07, 2017

Hi Mike,

That's because limit is an additional parameter, not a part of CQL.

Here's the documentation for CQL:

Here's the documentation for the REST call: (you should click on "Search")

I would recommend installing the REST API Browser in your instance, it makes debugging REST calls so much easier:

So using &limit=200 is not wrong, it is an additional parameter and should therefore be that way. :)

Mike Lang Dec 11, 2017

Brilliant!  Solved.  Thank you!

Stephen Deutsch Dec 11, 2017

Glad I could help! If you could click on the "Accept as Solution" button I would appreciate it!

Mike Lang Dec 11, 2017

For the life of me I cannot find that button!  Where should I be looking?

Stephen Deutsch Dec 12, 2017

Thanks for looking so hard! For anyone else who's curious, it's the checkmark button next to the answer :)

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Confluence

6 Awesome Ways to Apply Trello, JIRA and Confluence to your Project

I attended  Atlassian Summit 2019  and learned a lot from the presenters, attendees and knowledgeable Atlassian product managers. The presentations I attended focused on applying Agile, pla...

2,339 views 11 28
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you