How to create objects of a class using the xWiki default API

Hello everyone :smiley:

First of all, I want to thank all developers from XWiki and all contributors for providing this awesome platform.

I’ve been checking out the REST API and generally speaking, it works great, by folllowing this Doc: https://www.xwiki.org/xwiki/bin/view/Documentation/UserGuide/Features/XWikiRESTfulAPI

But something doesn’t work for me:

Is it possible to create objects in the Wiki using the default xWiki API?

For example, I have classes created within my Wiki and I would like to create an object of that class using the default xWiki API, how can I do this process? Or is it not possible?

Any help, comments or additional documentation would be greatly appreciated.

It’s definitely possible. Have you tried https://www.xwiki.org/xwiki/bin/view/Documentation/UserGuide/Features/XWikiRESTfulAPI#HCreatinganXWikiObject ?

Thank you very much for your answer :smiley:

Yes, I finally figured it out, now it works.

For anyone who has the same question, to make it work doing this:

  1. Make a PUT call so it first create the page into the space you want.

  2. Once you have created the page, make a POST request to the page you create earlier in order to create the objects of a class inside the created page.

Thank you very much! @tmortagne

1 Like