Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Confluence REST API GET request also looks into the recycle bin, how do I prevent that?

Ano Niempje March 19, 2025

Hello,

When I use a GET request to find a page by looking for its title, the call will also look for the page in the recycle bin. How do I prevent this? To visualize this issue a little bit better:

Lets say we have a page called foobar. I have a Jira automation rule that checks if the page foobar exists. If it does not exists, it will create the page. We run the automation rule and the page exsits, thus nothing is created. Now lets say that someone accidentally, manually, deleted the page foobar. Once the rule is executed it will look for foobar. It finds foobar, in the recycle bin. It thinks the page foobar exists and it is not created. Yes it exists, but its not live for the world to see.

My question is, is it possible for the GET request to NOT look into the recycle bin and only look for live pages?

Example code:

https://mybusiness.confluence.com/rest/api/content/search?cql=title=foobar

1 answer

0 votes
Cyrille Martin
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 19, 2025

Hi @Ano Niempje 

I think you can specify the status of the content, in your case set it at "current" to avoid "trashed" content

https://docs.atlassian.com/atlassian-confluence/REST/6.6.0/#content-getContent

Regards,

 

Ano Niempje March 19, 2025

Hi Cyrille thanks for your reply. I tried this for a custom body:

custom.png

But it still looks into the trash. Any idea why that is?

Ano Niempje March 19, 2025

FYI. We have two environments. One for development and one for production. If I execute this in development, it works. When I execute this is production, it doesn't work.

I run this in production, using status current as its body and it gives me results such as the page title, the body, the ID etcetera. So when I copy that ID like this:

https://confluence.mycompany.nl/spaces/mySpace/pages/2769289397

It redirects me to a page that says:

Page has been deleted but you can find it in the recycle bin

Ano Niempje March 19, 2025

And one last thing, the api result says status:current even though the page is in the trash.


Like this:

{
    "results": [
        {
            "id""2769289397",
            "type""page",
            "status""current",
            "title""foobar",
            "position"0,
            "restrictions": {},


This page is literally in the trash but the status comes back as current???
Cyrille Martin
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 19, 2025

You may have an issue on your content indexation.
I know it is not the best to rebuild an index on production environment during the day but depending on the size of the space where your trash page is present, you can only re-index this space ?

 

Ano Niempje March 20, 2025

Hi Cyrille, not sure how I do this but I guess this is something I will have to discuss with the Administrator. I did some aditional testing and tried to look for my live page but it keeps giving me a page with an ID that does no longer exists anymore (not even in the trash) so I am suspecting that it still is looking for my previously deleted page somewhere in the database? Funny thing is that when I run the GET request form a Jira automation rool webhook action I get the wrong page, but when I run the GET request from Postman I get the live and correct page, every time. 

Thanks for your input Cyrille I think the best thing I can do now is contact my Atlassian administrator.

Like Cyrille Martin likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events