I have a set of pages, labelled as "active" or "inactive". It's important to me, that all pages have one of those labels.
As it might be that I forget to label a new page, I need to find unlabelled pages in my space (without checking each page one by one).
Unfortunately I was not able to find a way to search for unlabelled pages. All the solutions I found are very old and it seems, that those functions are not included in Confluence anymore.
Hello @Fabian_Holz !
As I understand, you need to search for all pages within a specific Confluence Space and those pages should not contain a specific list of labels.
There is a native way for us to get those results. It involves Confluence Query Language (CQL) and Representational State Transfer Application Programming Interface (REST API).
Here you can check our documentation:
Now, here is how we can get the desired content:
- Go to your Confluence site
- Go to your desired space
- Take note of the Space Key for that specific space
- Use the following query: https://yoursite.atlassian.net/wiki/rest/api/search?cql=label?NOT?IN("yourlabel","yourlabel2")?AND?type="page"?AND?space=YOURSPACEKEY
- The results should give you all the pages that do not contain the labels
A little explanation of the query above.
- The "https://yoursite.atlassian.net/wiki" is your Confluence Site URL. You must replace the "yoursite" part with your site name.
- The "/rest/api/search" part tells Confluence you are asking for a REST call for a search
- The "?cql=label?NOT?IN("yourlabel","yourlabel2")?AND?type="page"?AND?space=YOURSPACEKEY" part is the actual query. You must replace "yourlabel", "yourlabel2", and "YOURSPACEKEY" with your desired labels and space key.
- Each "?" character is used to symbolize where a white space would be placed
- The type=”page” is what assures that the results will contain only pages and no blog posts, for example.
You can get your Space Key under Space Settings:
Let me know if there is anything else I could assist you with!
I tried building the query like this https://yoursite.atlassian.net/wiki/rest/api/search?cql=label?NOT?IN("yourlabel","yourlabel2")?AND?type="page"?AND?space=YOURSPACEKEY
Please clarify should it be like
where you have to replace ? with a space as above.
Hello Community! Quick disclaimer: We are running a contest on Community (The Atlympics!) from July 23rd - August 8th of 2021. If you are interested in participating in this contest (prizes! ...
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