Help with CQL?

Hi, call me stupid but I'm not even sure how/where to start with this: https://developer.atlassian.com/confdev/confluence-server-rest-api/advanced-searching-using-cql. I have the latest version server instance of Confluence and what's written in there doesn't make sense to me at all, so let me start with a few questions and if anyone of you can help me, I'll be very appreciative:

  1. Do I actually need an add-on to use the CQL 'interface' to configure my CQL searches?
  2. I ran 'wiki/rest/capabilities' and it returned a response but what does this mean i.e. what now?
  3. How could I, for example, find all content where the creator is jsmith - I mean that link above says: 'creator = jsmith', but what does this mean? Where is that set? Hence my confusion!
  4. It says add your query using fields, operators, field values etc as the value for the CQL query parameter, but again what does this mean? Do I just tweak and run a query, then hit enter? And if so, how would I do that using the above 'creator = jsmith' search or even more parameters for that matter - does anybody have any more examples I can reference?

Thanks all in advance and apologies if the questions are simple, but I've been reading through that page for some time now without success (apart from the successful running of '/wiki/rest/capabilities'.

 

Thanks!

1 answer

0 vote
Sam Hall Community Champion Nov 27, 2016

Hi Danny,

At the moment, Atlassian have made CQL available via only the Confluence REST API, which is intended for use by developers who want to build add-ons or integrate confluence with other systems / products. It's designed to be used programatically, with structured search requests and results appropriate for sending and reading by a computer program.

That means there isn't really a user-friendly way of performing CQL searches without some add-on or some other software.

There's a pretty good free add on called CQL Search which gives a user interface for performing CQL searches, but the bad news is that it is only available for Confluence Cloud, and it sounds like you are using Confluence Server.

You can submit searches via your browser address bar, if you structure the parameters correctly and encode the spaces, quotes, etc (which can get tricky!)

Some basic examples that work for me:

Search for all content created by the user "jsmith":

<YOUR_URL>/wiki/rest/api/content/search?cql=creator=jsmith

Search for all content created by the user "jsmith" in the space with key "WORK":

<YOUR_URL>/wiki/rest/api/content/search?cql=creator=jsmith%20and%20space=WORK

Search for content with title = "Decision log" in the "WORK" space

<YOUR_URL>/wiki/rest/api/content/search?cql=space=WORK%20and%20title=%22Decision%20log%22

However, as you see if you try these, the results you'll get are not user friendly, as they are designed to be read by a computer program rather than a human.

Anyway, I hope that helps a bit.

Sam

 

 

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jul 10, 2018 in Confluence

We want to see the templates you've created in Confluence!

Hi Community, Jessica here from the Confluence Product Marketing team!  July’s community challenge is all about sharing pictures  — and as an extension of our first post on what ...

974 views 23 12
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