XWiki Restful Get Childrens issue

Hi there!

I have a strange behaviour by using the REST API. When I want to list the child pages of a specific page like XXX/spaces/XXSpecificPageXX/pages/WebHome/children, then not all childs are listed.

Using the “normal” front end and the /?viewer=children parameter after the Page URI will list all childs.

Why I am getting different results?

Thanks,
Thomas

Hello Thomas.

Your question is interesting, it shows us that the “children” REST action has not been upgraded to handle Nested Pages. It only shows you pages that have the current one as “parent”, in the old “parent-child relationship” way (some explanations).

If you wish to have ALL the children, in a hierarchal way (just like the breadcrumb does or viewer=children), then you need to call:

XXX/spaces/XXSpecificPageXX/pages/

But it works only if XXSpecificPageXX is not a terminal page.

I hope it helps,

Guillaume

Hi,

pages/ prints just

<pages>
<pageSummary>
     XXX
</pageSummary>
</pages>

and does not list any child of the current page.

What you pasted indicate that the space you tried have only one direct child. There is no API to get all children if that’s your question.

Sorry. I am going to clarify the issue:

When I access a space called Development and want to see all direct childs using the link XXX/Development/?viewer=children, then I am getting the expected result. However, when I am going to use the RESTful API via xxx/spaces/Development/pages/WebHome/children, I am getting a wrong result even though all children are a direct child of Development.

That’s because as @gdelhumeau indicated you need to use xxx/spaces/Development/pages/. WebHome is itself a child of space Development (which happen to be used as its home page).

For information, a JIRA issue has been created for this problem but is still open: https://jira.xwiki.org/browse/XWIKI-13830

1 Like