Get Space page hierarchy using the REST api

Andrew Reeman September 21, 2016

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

0 votes
Peter Geshev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 21, 2016

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

Regards,

Peter

Andrew Reeman September 22, 2016

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:

expand=descendants.page

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

 

Thanks for your help again,

 

Andrew

 

 

 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events