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

Get Space page hierarchy using the REST api

There was a question asked a while ago, but with no helpful answer.


In a webpage, I want to build a tree view of the pages of a space, and maybe put them in a dropdown so the user can select one.


I am able to do a REST call to /rest/api/space/{spaceKey}/content to get the pages, but they are all in a list, with no hierarchy, and the ancestor field is always empty.


I am able to get only the root page with the same api, but setting the depth to "root". From there, I could do a REST call to get the children of that page, then do a REST call for every child to get their children and so on...

This would mean a number of REST calls equal to the number of pages, which is not great. Is there a better way to do it?

3 answers

Helen's workarounds are very helpful - and point out a glaring omission within Confluence. The content management tool UI is severely underpowered. This question has been in the community since 2016 and STILL doesn't have an adequate response from Atlassian. 

0 votes
AnnWorley Atlassian Team Mar 13, 2018

Hi Mathieu,

You could use the Page Tree Macro to display the tree view of the pages on a Confluence page. 

Here is another resource for REST questions if this forum doesn't answer satisfactorily.



Thank you for the suggestion. Page Tree Macro is fine, but can only be used in a Confluence Page, and after trying it, you cannot use it to select a page as part of a form.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Confluence

Confluence Mythbusters: Does Atlassian even use Confluence?

Hi, Confluence collaborators! As part of #Confluence-Collaboratory month, we’ve created a very special Mythsbusters segment, where we're dive into an interesting myth and uncover the truth behind i...

1,752 views 8 32
Read article

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