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 Nov 29, 2018 in New to Confluence

How to use Confluence Cloud for stakeholder management

Most of us don’t need much convincing that stakeholder management is important. It just makes sense that keeping everyone in-the-know on projects and assigning clearly defined roles is key to having ...

1,127 views 2 6
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