How to use REST interface to create a space/page instead of just a page?

We need to create a new page using XWiki’s REST interface. We already have a working solution to add page “beta" to an existing page “Labbook.jsnow.WebHome” using

/rest/wikis/xwiki/spaces/Labbook/spaces/jsnow/pages/beta

with

<?xml version="1.0" encoding="utf-8"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.xwiki.org">
<name>beta</name>
<title>beta</title>
<author>XWiki.user</author>
<authorName>John Snow</authorName>
<majorVersion>0</majorVersion>
<minorVersion>0</minorVersion>
<hidden>false</hidden>
<created>2023-11-27T00:25:21+01:00</created>
<creator>XWiki.user</creator>
<syntax>xwiki/2.0</syntax>
<creatorName>XWiki.user</creatorName>
<modified>2023-11-27T00:25:21+01:00</modified>
<comment></comment>
<content>Groundbreaking research about beta.</content>
</page>

However, what we really want to create is “Labbook.jsnow.beta.WebHome” so that the new beta page can also have child pages. Can we change the page-xml above so that it also creates a “space” for beta? Many thanks in advance!

Hi @svollmar,

In order to create non-terminal pages using REST, you would use as many spaces as you want in you request (spaces/Labbook/spaces/jsnow/spaces/beta) and at the end use /pages/WebHome.

Hope it helps,
Alex

EXCELLENT - that was the solution - thank you!