Get Space page hierarchy using the REST api

We are looking into using the REST api to create backups for all the content on our confluence cloud page. We would like this content to match the structure within confluence. Is there a simple 'view space structure' REST call to get the hierarchical structure of the pages within a space? 

At the moment the only way I can think of is recursively accessing the "/content/{id}/child/page" starting with the space root page until it returns an empty list. However this could end up being a ridiculous number of requests. 

Thanks for your help and I'll be happy to clarify anything. 



1 answer

Hi Andrew,

I think that if you use the space content API rest point(with depth=all) and expand the ancestors you will be able to collect the structure in one call



Thanks for your help Peter. Perhaps I've not been setting up the pages correctly but my ancestors entry appears blank: 


_expandable: {
	ancestors: "",


I can get the descendants though of each page returned by doing:

Unsure if this is the best of doing it but it seems to work! 


Thanks for your help again,






Suggest an answer

Log in or Sign up to answer
Community showcase
Published Mar 12, 2019 in Confluence

Confluence Admin Certification now $150 for Community Members

More and more people are building their careers with Atlassian, and we want you to be at the front of this wave! Important Dates Start the Certification Prep Course by 2 April 2019 Take your e...

1,162 views 2 13
Read article

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