Hi Juan,
You got it almost right, but you need to read
http://platform.xwiki.org/xwiki/bin/view/Features/ContentOrganization/ ,
especially the part that explains the difference between terminal and
non-terminal pages.
On Wed, Mar 1, 2017 at 11:13 PM, Juan Huerta <juan.huerta(a)gmail.com> wrote:
Hi,
I'm quite new in XWiki and trying to use the RestAPI to create pages, and
pages inside pages (which I think is called spaces). I have the feeling
that 'spaces' is a legacy term, and that in the current XWiki (Enterprise
9.1), an space is just a page that contains other pages. Kindly correct me
if I'm wrong, but I have not find anywhere how to create an space.
Below the 2 URLs I'm using to create the pages. In both cases, when I use
PUT to call the 2 urls, I pass as data a content and a title. I have no
problem with the title and the content, both are being created correctly.
My end goal is to create pages, and pages withing pages.
"http://localhost:8080/xwiki/rest/wikis/xwiki/spaces/2017-
2020/pages/madrid
This creates a terminal page "madrid".
"
"
<http://localhost:8080/xwiki/rest/wikis/xwiki/spaces/2017-2020/spaces/madrid/pages/cibeles>
This creates a terminal page "cibeles" inside a non-terminal page
"madrid".
"
In both cases, I'm using PUT and I'm able to create pages successfully,
however, not as I want:
- "
http://localhost:8080/xwiki/rest/wikis/xwiki/spaces/2017-2020/pages/madrid
"
This one creates a page called "madrid" (with the content I pass)
- "
http://localhost:8080/xwiki/rest/wikis/xwiki/spaces/2017-
2020/spaces/madrid/pages/cibeles
"
I would expect this one to create a page named "cibeles" inside the
previous "madrid" page.
Instead, it creates a new "madrid" page (without any text in the content,
which is fine as I dont pass anything), and inside this page, the "cibeles"
page (with the content I expect)
So, I end up having TWO pages named
"madrid"
Exactly. One is terminal and the other one is non-terminal. The actual
references (identifiers) are:
xwiki:2017-2020.madrid <--- this is the terminal page (can't have child
pages)
xwiki:2017-2020.madrid.WebHome <--- this is the non-terminal page (can have
child page)
Hope this helps,
Marius
One points to "http://localhost:8080/xwiki/bin/view/2017-2020/madrid/"
(and have inside a page named cibeles) . This "madrid" page displays this
text: "The requested page could not be found.", although inthe hierarchy
tree I see it has a page inside.
The other (without a nested page), points to: "
http://localhost:8080/xwiki/bin/view/2017-2020/madrid" and has a proper
content (which I passed in the PUT request)
(notice the / at the end of the URL, "madrid" vs "madrid/" )
How to indicate that the page should be created in an existing page
without the need to create this new parent page? Or even if I have to
create first the parent page, how to tell that the child page should be
inside that existing parent page?
Thanks for your help,
Juan