Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

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

How to delete whole page tree with Rest API

How to delete all 2500 pages having their common ancestor id using rest api?

1 answer

1 accepted

2 votes
Answer accepted
DPK J Community Leader Jan 16, 2020

@WojciechThis is going to be a multi step process,

  1. Fetch ID of ancestor page
  2. From above API you will get ANCESTOR_ID, now you will need to search for all children on this ancestor, for that you can use CQL based search api
    1. API reference - https://docs.atlassian.com/atlassian-confluence/REST/6.6.0/#content-search
    2. CQL search reference - https://developer.atlassian.com/server/confluence/advanced-searching-using-cql/#ancestor
    3. GET <BASE_URL>/rest/api/content/search?cql=ancestor=ANCESTOR_ID
  3. Above API will give you paginated list content, and from that you can delete elements one by one
    1. API reference - https://docs.atlassian.com/atlassian-confluence/REST/6.6.0/#content-delete
    2. DELETE <BASE_URL>/rest/api/content/{CONTENT_ID}

 

I hope this points you to right direction.

I was afraid I'd have to do it one by one - that can take a while...

DPK J Community Leader Jan 16, 2020

@Wojciech  Yup! this is time consuming stuff.

I have also seen this add-on popping up in various discussions/questions related to deleting page tree - https://marketplace.atlassian.com/apps/1215148/delete-child-pages-delete-page-tree?hosting=server&tab=overview

Have a look if this can help you.

It's ridiculous to pay additionally for functionality that is already there... 

My solution was to ask administrator with highest privileges to click "delete page" and "delete child pages". It took few minutes.

Seems my space privileges weren't enough for this number of subpages.
Also DELETE requests take 2-4 seconds each, so it would take a lot of time to do it that way

DPK J Community Leader Jan 20, 2020

I happy that your issue is resolved.

I know prices of some add-on which just replicate existing features are not justified at all, it just lack of effective documentation by Atlassian.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Confluence

Lessons and Learnings: Six Months of Working Remote [Discussion]

Hey there, folks! For most of us, the past six months- yes, you read that right- have been a journey. More people than ever before have pivoted to working remotely, and navigating being on-scre...

8,592 views 7 7
Join discussion

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