I have a problem regarding the Wiki Manager API

Hi,

my problem is about the API of the Wiki Manager, because i want to automate the creation and deletion of wikis.
I want to create and delete Wikis by sending simple http requests. Until now i am kinda able to do that but it doesn’t seem right, how the create request is handled by Xwiki. The documentation of API calls is also quite flavorless :drum:, so i am kinda at a dead end right now.

I am using a webextension, RESTED, at the moment to test the request functionality though everytime i send the request, Wxiki tells me the following:

The wiki is sort of created but only the basics, so as soon as i click on it, i am led to the wizard to install a flavor.

But when i send the request again it kinda works and the wiki gets created, though it is not 100% reproducable. (The same lines appear as in the first image, but then the whole installation process similar to the basic installation through the frontend wizard happens)

This is my request body:
wikiprettyname=testwiki123&wikiname=testwiki123&wikialias=&description=test+description&template=&flavor=org.xwiki.platform%3Axwiki-platform-distribution-flavor-wiki%3A%3A%3A16.5.0&set_as_template=&form_token=vJ7nfHDDDxUZlDdgUodFcw&ownerId=XWiki.sdcloud-admin&userScope=global_only&membershipType=open&members=&step=create

Is there a more stable way of using the Wiki Manager or something in the works ? Because i cannot use this.

Thanks in advance :smiley:
Thorben

@tmortagne i saw on your profile, that you are responsible for the API implementation, so i wanted to ask, whether you know of a better way to automate this REST request.

Thanks in advance :smile:
Thorben

It’s not really clear which “REST API” you used, the screenshot suggests you actually use the request used by the wiki creation UI, which starts a background wiki creation job and immediately returns. It usually takes a bit of time to create a wiki.

There is a generic Jobs REST API which allows trigerring and controller this kind of jobs is a more REST oriented way but it’s not always easy to craft the right Job Request to sent to it and your target use case is not documented in much details right now. It’s a lot easier in Java thanks to JAXB and you could take inspiration from the tool we use to create wikis during integration tests.

Thanks for your reply @tmortagne,

My understanding is that the Wiki Manager should be responsible for the creation and deletion of wikis. By sending requests to the /wikimanager endpoint, XWiki would then create a job that executes the request.

Goal:
We want to include XWiki for our product as an alternative for Confluence. Automating behaviour of XWiki through REST calls is therefore very important for us.

As of now many API’s work for us (e.g. editing users/roles/pages/…), though the core functionality for us would be the API for the WikiManager (create/delete/manage wikis…).


Because there is not much documentation on what the WikiManager accepts as parameters, i made this simple approach by just checking what is being sent back and forth, when manually creating a Wiki.

ISSUE:

  • My approach is currently not a robust solution, because it doesn’t work every time.
  • We need to set the flavor automatically aswell, therefore the following convention is not sufficient:
<wiki xmlns="http://www.xwiki.org">
  <id>xwiki</id>
  <name>xwiki</name>
  <description>Some description of the wiki</description>
  <owner>Admin</owner>
</wiki>

Questions:

  1. It would be very helpful for us, if you could provide us with the information, that we miss on the parameters for the REST call.
  2. And i wanted to ask, whether the REST documentation will be updated in the near future (e.g. examples for each endpoint), so that one can get a better understanding of each endpoint

Thanks in advance :grin:
Thorben

I continued this post inside the xwiki element chat and found out, that there is a hidden extension in xwiki, which would enable the /wikimanager endpoint.

It is located at <address>:<port>/xwiki/bin/admin/XWiki/XWikiPreferences?section=XWiki.Extensions&search=&recommended=false&indexed=true&compatible=true
then click on advanced search and search for the extension id org.xwiki.platform:xwiki-platform-wiki-rest-default with the respective version of your xwiki (e.g. 16.6.0 or so)

Install it and after that the /wikimanager endpoint is enabled :+1: