REST API
XWiki provides fine-grain access to virtually every element through an API that is based on HTTP semantics, i.e., a RESTful API. In this page you will find all the details to take advantage of this API and the instructions to use it at its full potential.
Accessing the service
By defaut the XWiki RESTful API entrypoint is rooted at the following URI:
http://host:port/xwiki/rest
All the resource references described in the XWiki RESTful API Documentation should be intended relative to this URL.
For example the /wikis resources on a server running on localhost on port 8080 can be retrieved using the following URL : http://localhost:8080/xwiki/rest/wikis
In addition to retrieving content in XML format, you can also retrieve it in JSON format by adding the parameter ?media=json in the URL or by setting the Accept header in the request to application/json. For example:
- http://localhost:8080/xwiki/rest/wikis?media=json
- curl -H 'Accept: application/json' https://www.xwiki.org/xwiki/rest/
Dataset
This section contains a brief and high-level description of the XWiki data set that should serve as a basis for presenting resources and their associated operations.
XWiki has pages organized in spaces. Each page is available in multiple versions (its history) and translations. Translated pages have their own versions and history which are independent. Each page might have attachments. Each attachment has its own history. Attachments are shared among all the different translations of a page (i.e., the same set of attachments is the same regardless of the page language). Pages can have one or more objects. Objects are instances of a class that contains a set of properties. Some objects might be directly exposed as first class entities, such as comments and tags. Objects, as attachments, are shared among all page translations.
Understanding resources and representations
"An important concept in REST is the existence of resources (sources of specific information), each of which is referenced with a global identifier (e.g., an URI in HTTP). In order to manipulate these resources, components of the network (user agents and origin servers) communicate via a standardized interface (e.g., HTTP) and exchange representations of these resources (the actual documents conveying the information)." (Wikipedia)
Resources in XWiki are pages, attachments, objects, properties, spaces, and all the things we described in the previous section. XWiki has a default way of conveying the information about these resources, i.e., by providing well defined XML representations that contain all the information associated to the resource in an XML format. This format is described using an XML Schema Definition file.
Of course the same resource can be represented in many different ways. This is yet to be documented.
Another important aspect of representations is that they contain useful information for linking related resources. This is a realization of the Hypermedia As The Engine Of The Application State (HATEOAS) principle. In XML representations this information is conveyed through the <link> tag. This tag has two important parameters: rel and href. rel specifies the "semantics" of the link, while href is the URI of the linked resource.
For example, in the representation of a page, we can have links to the comments, tags, attachments which are independent resources associated to the current page. These links are provided in the XML representation of a page and allow a client to navigate to related resources... Like we do every day when we click on a link in a web page.
Relations
The available relations that you might find in the XML resource representations are the following:
Rel | Semantics |
---|---|
http://www.xwiki.org/rel/wikis | The representation containing the list of virtual wikis. |
http://www.xwiki.org/rel/spaces | The representation containing the list of spaces in a wiki. |
http://www.xwiki.org/rel/pages | The representation containing the list of pages in a space. |
http://www.xwiki.org/rel/translation | The representation containing a translation of a page. |
http://www.xwiki.org/rel/page | The representation for a page. |
http://www.xwiki.org/rel/space | The representation for a space. |
http://www.xwiki.org/rel/parent | The representation for the page that is parent of the current resource. |
http://www.xwiki.org/rel/home | The representation for the page that is the home of the current resource. |
http://www.xwiki.org/rel/attachmentData | The representation of the actual attachment data. |
http://www.xwiki.org/rel/comments | The representation of the list of comments associated to the current resource. |
http://www.xwiki.org/rel/attachments | The representation of the list of attachments associated to the current resource. |
http://www.xwiki.org/rel/objects | The representation of the list of objects associated to the current resource. |
http://www.xwiki.org/rel/object | The representation for an object. |
http://www.xwiki.org/rel/classes | The representation of the list of classes associated to the current resource. |
http://www.xwiki.org/rel/history | The representation of the list of history information associated to the current resource. |
http://www.xwiki.org/rel/class | The representation for a class. |
http://www.xwiki.org/rel/property | The representation for a property. |
http://www.xwiki.org/rel/propertyValues | The representation for the list of property values. |
http://www.xwiki.org/rel/properties | The representation of the list of properties associated to the current resource. |
http://www.xwiki.org/rel/modifications | The representation of the list of modifications associated to the current resource. |
http://www.xwiki.org/rel/children | The representation of the list of children associated to the current resource. |
http://www.xwiki.org/rel/tags | The representation of the list of tags associated to the current resource. |
http://www.xwiki.org/rel/tag | The representation of a tag. |
http://www.xwiki.org/rel/search | The representation for a search resource. |
http://www.xwiki.org/rel/syntaxes | The representation for a syntax resource. |
Relations are defined as URIs in order to provide a sort of namespace. Currently these URIs are not links to real web pages but, in the future, they might point to descriptions of their semantics on actual web pages (or other kinds of representations).
The "HATEOAS" Graph
In order to better understand the relations among resources you might have a look at this URI templates representing classes of resources. Edges are the possible links that you might find in a representation of a given resource, and their associated relations.
that pictures all the resources available in the XWiki RESTful API and the relations among them. In this graph, nodes areThis graph shows that by starting from the API entry-point a client can navigate and discover all the resources just by following the links provided in representations (and by knowing their semantics). This was exactly the way how this graph was generated.
Interacting with the XWiki RESTful API
The XWiki RESTful API is accessible through HTTP so, in principle, you can use every client that is capable of "speaking" HTTP in order to interact with it. Even a web browser!
If you want to write more complex programs you might download an HTTP library for your favorite language (e.g., http://hc.apache.org/), see this post by Mohamed Boussaa.
Java users might take advantage of the JAXB framework and its XJC binding compiler in order to generate domain object models directly from the XML Schema Definition, and use them for serializing and de-serializing XML representations.
If you use this approach (Apache HTTP Client + JAXB) you will find yourself writing some code like this:
import javax.xml.bind.Unmarshaller;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.GetMethod;
import org.xwiki.rest.model.jaxb.Page;
...
HttpClient httpClient = new HttpClient();
JAXBContext context = JAXBContext.newInstance("org.xwiki.rest.model.jaxb");
Unmarshaller unmarshaller = context.createUnmarshaller();
GetMethod getMethod = new GetMethod("http://localhost:8080/xwiki/rest/wikis/xwiki/spaces/Main/pages/WebHome");
getMethod.addRequestHeader("Accept", "application/xml");
httpClient.executeMethod(getMethod);
Page page = (Page) unmarshaller.unmarshal(getMethod.getResponseBodyAsStream());
And you will have all the information about the Main.WebHome page in the Page object, without the need of handling XML directly.
Because of the wide variety of HTTP frameworks available we don't provide a full tutorial about using them. However, in order to show you how to interact with the XWiki RESTful API, we will use curl: a standard command line HTTP client that provides an interface to all the functionalities of the HTTP protocol.
By using curl, the previous example would have been:
<page xmlns="http://www.xwiki.org">
<link rel="http://www.xwiki.org/rel/space" href="http://localhost:8080/xwiki/rest/wikis/xwiki/spaces/Main"/>
...
Authentication
The XWiki RESTful API supports several types of authentication:
- HTTP BASIC Auth: You provide your credentials using the Authorization HTTP header
- XWiki session: If you are logged in XWiki and you use the cookies provided by the authentication mechanism, you will also be authenticated to the XWiki RESTful API. This is useful, for example, when you are interacting with the API using the XMLHttpRequest object of a browser using Javascript.
- Custom authentication methods: if you have setup a custom authenticator on your wiki (such as OIDC, or Trusted authentication or even your own custom ones), additional authentication methods may be available for the RESTful API, provided by these authenticators.
If you don't provide any credentials the XWiki RESTful API will recognize you as a XWiki.Guest user.
So if you have, let's say a Main.PrivatePage, and you try to do:
...
< HTTP/1.1 401 Unauthorized
...
You will get an Unauthorized empty response.
On the contrary, by specifying Admin credentials you gain access to the actual page:
<page xmlns="http://www.xwiki.org">
<link rel="http://www.xwiki.org/rel/space" href="http://localhost:8080/xwiki/rest/wikis/xwiki/spaces/Main"/>
...
<content>Only admin can see this</content>
</page>
CSRF Token
XWiki 14.10.8+, 15.2+
When using a POST request with a content type of text/plain, multipart/form-data or application/www-form-urlencoded, a form token needs to be sent in the header XWiki-Form-Token to prevent cross-site request forgery. The form token is provided in every response in the same header so a GET request to any supported endpoint can be used to obtain a form token. If the form token is missing or wrong, a response with status code 403 and "Invalid or missing form token." as body of type text/plain is sent. As of XWiki 15.2, the form token will stay the same for a user until the server is restarted. As server restarts might happen at any time, API clients should handle this response code and re-try the request with the form token that is returned in the error response. When the form token is provided in a request where it isn't necessary, it won't be checked for validity so it doesn't hurt to just send the token in every request.
It cannot be excluded that in the future, the form token might depend on the user's session. Therefore, for compatibility with future versions, it might be a good idea to store and send cookies.
When using the REST API in JavaScript code from within XWiki's UI, the form token is automatically sent in every same-origin request initiated through fetch or XMLHttpRequest. Therefore, no special steps should be needed for REST requests to the current XWiki instance.
Sending representations
Many resources are modifiable, so you can send representations in order to change the state of those resources (e.g., pages).
All modifiable resources accept XML representations that conform to the XML Schema Definition. However, some other representations might be accepted as well (see the following sections).
Resource update is usually done by using the PUT method, while resource creation is done via PUT or POST.
For example, in order to create a page you might do the following:
<page xmlns="http://www.xwiki.org">
<link rel="http://www.xwiki.org/rel/space" href="http://localhost:8080/xwiki/rest/wikis/xwiki/spaces/Main"/>
...
<version>1.1</version>
<majorVersion>1</majorVersion>
<minorVersion>1</minorVersion>
<created>2009-03-21+01:00</created>
<creator>XWiki.Admin</creator>
<modified>2009-03-21+01:00</modified>
<modifier>XWiki.Admin</modifier>
<content>This is a new page</content>
</page>
Where newpage.xml is an XML file containing
<page xmlns="http://www.xwiki.org">
<title>Hello world</title>
<syntax>xwiki/2.0</syntax>
<content>This is a new page</content>
</page>
The page has been created and is accessible. Subsequent PUT requests to the page URI will modify its content.
You can specify a subset of the three elements title, syntax, and content in the XML when updating/creating a page.
For example, if you just want to change the title, it is sufficient to specify only the title element. The current content and the syntax of the page will be left unchanged.
Overcoming browser limitations
As said before, it could be useful to send information by using browser's XmlHttpRequest objects. However, currently many browsers only support GET and POST methods, so it is impossible to send, for example, PUT requests. In order to overcome this limitation you can override the HTTP Method by specifying a method parameter in the URI query string.
In the previous example, if you send a POST request to the http://localhost:8080/xwiki/rest/wikis/xwiki/spaces/Main/pages/NewPage?method=PUT it will be interpreted as if it were an actual PUT request.
This overriding mechanism allows the interaction with the XWiki RESTful API by using any kind of browser.
PUT vs POST
In the following sections you will see that sometimes resources are created by using PUT and sometimes by using POST. The general principle is that if the client is responsible for choosing the resource URI then PUT is used. If it's the server that bears this responsibility, then POST is used.
To be clearer, when a client wants to create a page it knows where that page should go, so it is able to communicate the server the target URI. PUT is used.
A client, on the contrary, cannot know beforehand what will be the URI of a comment, since comment URIs contains the ID of the comment and this information is generated by the server. In this case the client will do a POST and the server, in response, will communicate the URI it generated for the newly created comment.
Headers
The response of the REST requests always contain some custom headers that might be useful:
- xwiki-version: contains the representation of the version of XWiki defined in version.properties (e.g. 14.4.6)
- xwiki-user: contains the reference of the user used to perform the request (e.g. xwiki:XWiki.JohnDoe). If the request is performed as guest, the header won't be present.
XWiki RESTful API Documentation
In this section you will find the documentation of the whole XWiki RESTful API.
application/xml representations refers to the XML Schema Definition.
Resource URIs are specified using URI templates. Bracketed elements are formal parameters and should be instantiated to actual values in order to retrieve the associated resource.
Root resources
By defaut all the resources of the RESTful API are rooted at the following URI: http://server:port/xwiki/rest/ (depending on where your XWiki is running)
/
- HTTP Method: GET
- Media types:
- application/xml (XWiki element)
- Description: Retrieves the entry root description containing information about the server (currently returns the XWiki product Version).
- Status codes:
- 200: If the request was successful.
- Media types:
/syntaxes
- HTTP Method: GET
- Media types:
- application/xml (Syntaxes element)
- Description: The list of syntaxes supported by the XWiki instance.
- Status codes:
- 200: If the request was successful.
- Media types:
/wikis
- HTTP Method: GET
- Media types:
- application/xml (Wikis element)
- Description: The list of wikis available on the XWiki instance. Unless the wiki is configured to be a wiki farm, this list is usually made of a single element 'xwiki'.
- Status codes:
- 200: If the request was successful.
- Media types:
/wikis/query?q={query}&wikis=wikiList[&distinct={true,false}][&order={asc,desc}][&start=n][&number=n][&prettyNames={true,false}]
- HTTP Method: GET
- Media types:
- application/xml (SearchResults element)
- Description: Search resources (pages and attachments):
- [since 6.4] using a SOLR query (handled by the SOLR Query module) on the wikis that are specified as a comma separated list in the wikis parameter.
- [before 6.4] using a Lucene query (handled by the Lucene Plugin) on the wikis that are specified as a comma separated list in the wikis parameter.
- Status codes:
- 200: If the request was successful.
- Media types:
/wikis/{wikiName}
- HTTP Method: GET
- Media types:
- application/xml (Wiki element)
- Description: information about the wiki
- Status codes:
- 200: If the request was successful.
- Media types:
- HTTP Method: POST
- Accepted Media types:
- octet/stream (A XAR file)
- Media types:
- application/xml (Wiki element)
- Query parameters
- backup={true/false} - import XAR as a backup XAR
- history={RESET/REPLACE/ADD} - history importing
- Description: import a XAR in a wiki.
- Status codes:
- 200: If the request was successful.
- Accepted Media types:
/wikis/{wikiName}/search?q={keywords}[[&scope={name,content,title,objects}...]&start=n][&number=n][&orderField=field&order={asc,desc}][distinct={true,false}][&prettyNames={true,false}]
- HTTP Method: GET
- Media types:
- application/xml (SearchResults element)
- Description: Returns the list of pages and objects that contain the {keywords} in the specified {scope}s. Multiple scopes can be specified. Search results are relative to the whole {wikiName} and are obtained via a HQL query.
- Status codes:
- 200: If the request was successful.
- Media types:
/wikis/{wikiName}/query?q={query}&type={hql,xwql,lucene,solr}[&distinct={true,false}]~[&order={asc,desc}][&start=n][&number=n][&prettyNames={true,false}][&className=className]
- HTTP Method: GET
- Media types:
- application/xml (SearchResults element)
- Description: Allow to execute HQL, XWQL, Lucene or SOLR queries on the given {wikiName}. The q parameter contains the corresponding query. See HQL Query Examples in Velocity, XWiki Query Language Specification, Lucene Plugin and SOLR query API examples of the queries that can be specified in this parameter. If type is hql or xwql and className is specified, the result will also contain the data for the first object of the corresponding class.
- Status codes:
- 200: If the request was successful.
- Media types:
/wikimanager (This resource is only available when using the multi-wiki feature)
- HTTP Method: POST
- Accepted Media types:
- application/xml (Wiki element)
- Media types:
- application/xml (Wiki element)
- Query parameters
- template - the wiki template to be used for initializing the wiki.
- history={RESET/REPLACE/ADD} - history importing
- Description: create a new wiki.
- Status codes:
- 200: If the request was successful.
- Accepted Media types:
Space resources
/wikis/{wikiName}/spaces[?start=offset&number=n]
- HTTP Method: GET
- Media types:
- application/xml (Spaces element)
- Description: Retrieves the list of spaces available in the {wikiName} wiki.
- Status codes:
- 200: If the request was successful.
- Media types:
/wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/search?q={keywords}[[&scope={name,content,title,objects}...]&number=n]
- HTTP Method: GET
- Media types:
- application/xml (Search results element)
- Description: The list of pages and objects that contain the {keywords} in the specified {scope}s. Multiple scopes can be specified. Search results are relative to space {spaceName}
- Status codes:
- 200: If the request was successful.
- 401: If the user is not authorized.
- Media types:
Page resources
/wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages[?start=offset&number=n]
- HTTP Method: GET
- Media types:
- application/xml (Pages element)
- Description: The list of pages in the space {spaceName}
- Status codes:
- 200: If the request was successful.
- 401: If the user is not authorized.
- Media types:
/wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}[?prettyNames={true,false}&objects={true,false}&class={true,false}&attachments={true,false}&minorRevision={true,false}]
- HTTP Method: GET
- Media types:
- application/xml (Page element)
- Query parameters
- prettyNames: also return the pretty name for various document information (like the author display name, etc). Disabled by default.
- objects: [since 7.3M1] also return the objects. Disabled by default.
- class: [since 7.3M1] also return the class. Disabled by default.
- attachments: [since 7.3M1] also return the attachments metadatas. Disabled by default.
- Description:
- Status codes:
- 200: If the request was successful.
- 401: If the user is not authorized.
- Media types:
- HTTP Method: PUT
- Accepted Media types:
- application/xml (Page element)
- text/plain (Only page content)
- application/x-www-form-urlencoded (allowed field names: title, parent, hidden [since 7.3], content)
- Media types:
- application/xml (Page element)
- Query parameters
- minorRevision ( ): Create a minor revision for the page. Disabled by default.
- Description: Create or updates a page.
- Status codes:
- 201: If the page was created.
- 202: If the page was updated.
- 304: If the page was not modified.
- 401: If the user is not authorized.
- Accepted Media types:
- HTTP Method: DELETE
- Media types:
- application/xml (Page element)
- Description: Delete the page.
- Status codes:
- 204: If the request was successful.
- 401: If the user is not authorized.
- Media types:
/wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}/history[?start=offset&number=n]
- HTTP Method: GET
- Media types:
- application/xml (History element)
- Description: The list of all the versions of the given page.
- Status codes:
- 200: If the request was successful.
- 401: If the user is not authorized.
- Media types:
/wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}/history/{version}
- HTTP Method: GET
- Media types:
- application/xml (Page element)
- Description: The page at version {version}
- Status codes:
- 200: If the request was successful.
- 401: If the user is not authorized.
- Media types:
/wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}/translations[?start=offset&number=n]
- HTTP Method: GET
- Media types:
- application/xml (Translations element)
- Description: The list of available translation for the page
- Status codes:
- 200: If the request was successful.
- 401: If the user is not authorized.
- Media types:
/wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}/translations/{language}[?minorRevision={true,false}]
- HTTP Method: GET
- Media types:
- application/xml (Page element)
- Description: The page at in the given {language}.
- Status codes:
- 200: If the request was successful.
- 401: If the user is not authorized.
- Media types:
- HTTP Method: PUT
- Accepted Media types:
- application/xml (Page element)
- text/plain (Only page content)
- application/x-www-form-urlencoded (allowed field names: title, parent, content)
- Media types:
- application/xml (Page element)
- Query parameters
- minorRevision ( ): Create a minor revision for the page. Disabled by default.
- Description: Create or updates a page translation.
- Status codes:
- 201: If the page was created.
- 202: If the page was updated.
- 304: If the page was not modified.
- 401: If the user is not authorized.
- Accepted Media types:
- HTTP Method: DELETE
- Media types:
- application/xml (Page element)
- Description: Delete the page translation.
- Status codes:
- 204: If the request was successful.
- 401: If the user is not authorized.
- Media types:
/wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}/translations/{language}/history
- HTTP Method: GET
- Media types:
- application/xml (History element)
- Description: The list of all the available revisions of the page in a given {language}.
- Status codes:
- 200: If the request was successful.
- 401: If the user is not authorized.
- Media types:
/wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}/translations/{lang}/history/{version}
- HTTP Method: GET
- Media types:
- application/xml (Page element)
- Description: A page at a given {version} in a given {language}.
- Status codes:
- 200: If the request was successful.
- 401: If the user is not authorized.
- Media types:
/wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}/children
- HTTP Method: GET
- Media types:
- application/xml (Pages element)
- Description: The list of the children of a given page.
- Status codes:
- 200: If the request was successful.
- 401: If the user is not authorized.
- Media types:
/wikis/{wikiName}/pages[?name=paneName&space=spaceName&author=authorName]
- HTTP Method: GET
- Media types:
- application/xml (Pages element)
- Description: The list of pages in the wiki {wikiName}. Filters can be set for the name, space and/or author to include only pages that match the given filters. This resource can be used to search for pages in a wiki.
- Status codes:
- 200: If the request was successful.
- 401: If the user is not authorized.
- Media types:
Tag resources
/wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}/tags[?minorRevision={true,false}]
- HTTP Method: GET
- Media types:
- application/xml (Tags element)
- Description: List page tags.
- Status codes:
- 200: If the request was successful.
- 401: If the user is not authorized.
- Media types:
- HTTP Method: PUT
- Accepted Media types:
- application/xml (Tag element)
- text/plain
- application/x-www-form-urlencoded (allowed field names: tag)
- Media types:
- application/xml (Tags element)
- Query parameters
- minorRevision ( ): Create a minor revision for the page. Disabled by default.
- Description: Add a tag to the page.
- Status codes:
- 202: If the request was successful.
- 401: If the user is not authorized.
- Accepted Media types:
/wikis/{wikiName}/tags
- HTTP Method: GET
- Media types:
- application/xml (Tags element)
- Description: The list of all available tags
- Status codes:
- 200: If the request was successful.
- 401: If the user is not authorized.
- Media types:
/wikis/{wikiName}/tags/{tag1}[,{tag2},{tag3}...][?start=offset&number=n]
- HTTP Method: GET
- Media types:
- application/xml (Pages element)
- Description: The list of pages having the specified tags.
- Status codes:
- 200: If the request was successful.
- 401: If the user is not authorized.
- Media types:
Comments resources
/wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}/comments[?start=offset&number=n]
- HTTP Method: GET
- Media types:
- application/xml (Comments element)
- Description: The list of comments on a given page.
- Status codes:
- 200: If the request was successful.
- 401: If the user is not authorized.
- Media types:
- HTTP Method: POST
- Accepted Media types:
- application/xml (Comment element)
- text/plain
- application/x-www-form-urlencoded - allowed field names: text, replyTo (object number of the replied comment, since XE 2.3)
- Media types:
- application/xml (Comment element)
- Description: Create a comment on the given page.
- Status codes:
- 201: If the comment was created. (The Location header will contain the URI where the comment has been created.)
- 401: If the user is not authorized.
- Accepted Media types:
/wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}/comments/{commentId}
- HTTP Method: GET
- Media types:
- application/xml (Comment element)
- Description: A specific comment on a page
- Status codes:
- 200: If the request was successful.
- 401: If the user is not authorized.
- Media types:
/wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}/history/{version}/comments
- HTTP Method: GET
- Media types:
- application/xml (Comments element)
- Description: The list of comments at a specific page {version}.
- Status codes:
- 200: If the request was successful.
- 401: If the user is not authorized.
- Media types:
/wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}/history/{version}/comments/{commentId}
- HTTP Method: GET
- Media types:
- application/xml (Comment element)
- Description: A comment at a specific page {version}.
- Status codes:
- 200: If the request was successful.
- 401: If the user is not authorized.
- Media types:
Attachments resources
/wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}/attachments[?start=offset&number=n]
- HTTP Method: GET
- Media types:
- application/xml (Attachments element)
- Description: The list of attachments of a given page.
- Status codes:
- 200: If the request was successful.
- 401: If the user is not authorized.
- Media types:
/wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}/attachments/{attachmentName}
- HTTP Method: GET
- Media types:
- The same of the attachment media type.
- Description: The attachment identified by {attachmentName} on a given page.
- Status codes:
- 200: If the request was successful.
- 401: If the user is not authorized.
- Media types:
- HTTP Method: PUT
- Accepted media types:
- /
- Media types:
- application/xml (AttachmentSummary element)
- Description: Create an attachment identified by {attachmentName} on a given page.
- Status codes:
- 201: If the attachment was created.
- 202: If the attachment was updated.
- 401: If the user is not authorized.
- Accepted media types:
- HTTP Method: DELETE
- Media types:
- Description: Delete the attachment identified by {attachmentName} on a given page.
- Status codes:
- 204: If the attachment was deleted.
- 401: If the user is not authorized.
/wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}/history/{version}/attachments[?start=offset&number=n]
- HTTP Method: GET
- Media types:
- application/xml (Attachments element)
- Description: The list of attachments at a given page {version}.
- Status codes:
- 200: If the request was successful.
- 401: If the user is not authorized.
- Media types:
/wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}/history/{version}/attachments/{attachmentName}
- HTTP Method: GET
- Media types:
- The same of the attachment media type.
- Description: The attachment identified by {attachmentName} on a given page {version}.
- Status codes:
- 200: If the request was successful.
- 401: If the user is not authorized.
- Media types:
/wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}/attachments/{attachmentName}/history
- HTTP Method: GET
- Media types:
- application/xml (Attachments element)
- Description: The list of available version for the {attachmentName}
- Status codes:
- 200: If the request was successful.
- 401: If the user is not authorized.
- Media types:
/wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}/attachments/{attachmentName}/history/{version}
- HTTP Method: GET
- Media types:
- The same of the attachment media type.
- Description: The {attachmentName} at a given {version}
- Status codes:
- 200: If the request was successful.
- 401: If the user is not authorized.
- Media types:
/wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/attachments[?name=attachmentName&page=pageName&author=authorName&types=attachmentTypeList&start=offset&number=n]
- HTTP Method: GET
- Media types:
- application/xml (Attachments element)
- Description: The list of attachments of pages located in a given {spaceName}. Filters can be set for the name, page, author and/or types (comma separated list of strings) to include only attachments that match the given filters. This resource can be used to search for attachments in a space.
- Status codes:
- 200: If the request was successful.
- 401: If the user is not authorized.
- Media types:
/wikis/{wikiName}/attachments[?name=attachmentName&page=pageName&space=spaceName&author=authorName&types=attachmentTypeList&start=offset&number=n]
- HTTP Method: GET
- Media types:
- application/xml (Attachments element)
- Description: The list of attachments in a given {wikiName}. Filters can be set for the name, page, space, author and/or type (comma separated list of strings) to include only attachments that match the given filters. This resource can be used to search for attachments in a wiki.
- Status codes:
- 200: If the request was successful.
- 401: If the user is not authorized.
- Media types:
Object resources
/wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}/objects[?start=offset&number=n]
- HTTP Method: GET
- Media types:
- application/xml (Objects element)
- Description: The list of objects associated to a page.
- Status codes:
- 200: If the request was successful.
- 401: If the user is not authorized.
- Media types:
- HTTP Method: POST
- Accepted media types:
- application/xml (Object element)
- application/x-www-form-urlencoded (a set of property#name=value pairs representing properties and a field className)
- e.g. className=XWiki.XWikiUsers&property#first_name=John&property#last_name=Doe
- Media types:
- application/xml (Object element)
- Description: Create a new object.
- Status codes:
- 201: If the object was created (The Location header will contain the URI associated to the newly created object).
- 401: If the user is not authorized.
- Accepted media types:
/wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}/objects/{className}[?start=offset&number=n]
- HTTP Method: GET
- Media types:
- application/xml (Objects element)
- Description: The list of objects of a given {className} associated to a page.
- Status codes:
- 200: If the request was successful.
- 401: If the user is not authorized.
- Media types:
/wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}/objects/{className}/{objectNumber}[?minorRevision={true,false}]
- HTTP Method: GET
- Media types:
- application/xml (Object element)
- Description: The object of type {className} identified by {objectNumber} associated to the given page.
- Status codes:
- 200: If the request was successful.
- 401: If the user is not authorized.
- Media types:
- HTTP Method: PUT
- Accepted media types:
- application/xml (Object element)
- application/x-www-form-urlencoded (a set of property#name=value pairs representing properties)
- Media types:
- application/xml (Object element)
- Query parameters
- minorRevision ( ): Create a minor revision for the page. Disabled by default.
- Description: Modify the object properties.
- Status codes:
- 202: If the object was updated.
- 401: If the user is not authorized.
- Accepted media types:
- HTTP Method: DELETE
- Media types:
- Description: Delete the object.
- Status codes:
- 204: If the object was deleted.
- 401: If the user is not authorized.
/wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}/objects/{className}/{objectNumber}/properties
- HTTP Method: GET
- Media types:
- application/xml (Properties element)
- Description: The properties of the object of type {className} identified by {objectNumber} associated to the given page.
- Status codes:
- 200: If the request was successful.
- 401: If the user is not authorized.
- Media types:
/wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}/objects/{className}/{objectNumber}/properties/{propertyName}[?minorRevision={true,false}]
- HTTP Method: GET
- Media types:
- application/xml (Properties element)
- Description: The property {propertyname} of the object of type {className} identified by {objectNumber} associated to the given page.
- Status codes:
- 200: If the request was successful.
- 401: If the user is not authorized.
- Media types:
- HTTP Method: PUT
- Accepted media types:
- application/xml (Property element)
- text/plain
- application/x-www-form-urlencoded (a field property#name=value pairs representing a property)
- Media types:
- application/xml (Property element)
- Query parameters
- minorRevision ( ): Create a minor revision for the page. Disabled by default.
- Description: Modify the object properties.
- Status codes:
- 202: If the object was updated.
- 401: If the user is not authorized.
- Accepted media types:
/wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}/history/{version}/objects[?start=offset&number=n]
- HTTP Method: GET
- Media types:
- application/xml (Objects element)
- Description: The list of objects associated to a page at a given {version}.
- Status codes:
- 200: If the request was successful.
- 401: If the user is not authorized.
- Media types:
/wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}/history/{version}/objects/{className}/{objectNumber}
- HTTP Method: GET
- Media types:
- application/xml (Object element)
- Description: The object of type {className} identified by {objectNumber} associated to the given page at a given {version}.
- Status codes:
- 200: If the request was successful.
- 401: If the user is not authorized.
- Media types:
/wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}/history/{version}/objects/{className}/{objectNumber}/properties
- HTTP Method: GET
- Media types:
- application/xml (Properties element)
- Description: The properties of the object of type {className} identified by {objectNumber} associated to the given page at a given {version}.
- Status codes:
- 200: If the request was successful.
- 401: If the user is not authorized.
- Media types:
/wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}/history/{version}/objects/{className}/{objectNumber}/properties/{propertyName}
- HTTP Method: GET
- Media types:
- application/xml (Properties element)
- Description: The property {propertyName} of the object of type {className} identified by {objectNumber} associated to the given page at a given {version}.
- Status codes:
- 200: If the request was successful.
- 401: If the user is not authorized.
- Media types:
/wikis/{wikiName}/classes/{className}/objects[?start=offset&number=n]
- HTTP Method: GET
- Media types:
- application/xml (Objects element)
- Description: The list of all the objects of a given {className}.
- Status codes:
- 200: If the request was successful.
- 401: If the user is not authorized.
- Media types:
Class resources
/wikis/{wikiName}/classes[?start=offset&number=n]
- HTTP Method: GET
- Media types:
- application/xml (Classes element)
- Description: The list of all the classes defined in the wiki {wikiName}
- Status codes:
- 200: If the request was successful.
- 401: If the user is not authorized.
- Media types:
/wikis/{wikiName}/classes/{className}
- HTTP Method: GET
- Media types:
- application/xml (Class element)
- Description: The {className} definition
- Status codes:
- 200: If the request was successful.
- 401: If the user is not authorized.
- Media types:
/wikis/{wikiName}/classes/{className}/properties
- HTTP Method: GET
- Media types:
- application/xml (Properties element)
- Description: The properties of the class {className}.
- Status codes:
- 200: If the request was successful.
- 401: If the user is not authorized.
- Media types:
/wikis/{wikiName}/classes/{className}/properties/{propertyName}
- HTTP Method: GET
- Media types:
- application/xml (Property element)
- Description: The property {propertyName} of the class {className}.
- Status codes:
- 200: If the request was successful.
- 401: If the user is not authorized.
- Media types:
/wikis/{wikiName}/classes/{className}/properties/{propertyName}/values
Request parameters:
Name | Description | |
---|---|---|
limit | Limit the number of values returned. Zero or a negative number means no limit. | |
fp | Filter parameters, used to filter the returned values. You can pass multiple filter values by repeating the query string parameter. The way in which the property values are filtered depends on the property type. |
- HTTP Method: GET
- Media types:
- application/xml (Property element)
- Description: The list of values for the property {propertyName} of the class {className}. At the moment only Database List properties are supported.
- Status codes:
- 200: If the request was successful.
- 401: If the user is not authorized to view the specified property.
- 404: If the specified property doesn't exist.
- Media types:
Job resources
A job is identified by an ID (jobId) which is a list of strings. In the REST URL, you have to represent the ID with a list of strings separated by /. (eg: refactoring/delete/11451).
/jobstatus/{jobId}
Request parameters:
Name | Required | Values | Default | Description | Version |
---|---|---|---|---|---|
request | no | true|false | false | Return also the job request | 9.1RC1 |
progress | no | true|false | true | Return also the job progress | 9.1RC1 |
log | no | true|false | false | Return also the job log | 9.1RC1 |
log_fromLevel | no | error|warn|info|debug|trace | Indicate the level from which to return logs | 9.1RC1 |
- HTTP Method: GET
- Media types:
- application/xml (JobStatus element)
- Description: status of a job
- Status codes:
- 200: If the request was successful.
- 404: If the job status has not been found
- Media types:
/joblog/{jobId}
Request parameters:
Name | Required | Values | Default | Description | Version |
---|---|---|---|---|---|
level | no | error|warn|info|debug|trace | Indicate the exact level for which to return logs | 7.2M3 | |
fromLevel | no | error|warn|info|debug|trace | Indicate the level from which to return logs | 7.2M3 |
- HTTP Method: GET
- Media types:
- application/xml (JobLog element)
- Description: log of a job
- Status codes:
- 200: If the request was successful.
- 404: If the job status has not been found
- Media types:
/jobs
Request parameters:
Name | Required | Values | Default | Description | Version |
---|---|---|---|---|---|
jobType | yes | The type of the job to pass to the Job Executor | 9.1RC1 | ||
async | no | true|false | true | If false, return the response only when the job is done | 9.1RC1 |
This API is designed to be a REST clone of the JobExecutor Java API (the only real difference right now being way to deal with asynchronous jobs) documented on http://extensions.xwiki.org/xwiki/bin/view/Extension/Job+Module#HUseanexistingjob so the concepts (job type, job request) are the same and the exact information to put in the job request depends on the job you want to run and are usually documented in the extension this job is coming from (extension module, refactoring, etc.).
- HTTP Method: PUT
- Input:
- Media Types: application/xml or application/json
- Input body: JobRequest element
- Output:
- Media Types: application/xml or application/json
- Response body: JobStatus element
- Description: Start a new job synchronously or asynchronously
- Status codes:
- 200: If the job was successfully executed
- 401: If the user is not authorized (i.e. doesn't have Programming Rights)
- 500: Failing jobs with async=false return an error 500 (Since 9.7RC1)
- Input:
Jobs started through the REST API automatically get their runtime context injected with the following REST HTTP request context properties:
- current wiki
- current user
- request URL and parameters
There is JAXB objects provided to make easy to create a request for Java and other JVM based clients. For other use cases the hard part is generally generating the XML to send as content and you can either:
- ask for the status of an existing job to have an hint of how the XML/JSON should look like (see jobstatus section)
- generate this XML in a script in a wiki page, you can look at the following example to help with that: https://snippets.xwiki.org/xwiki/bin/view/Extension/Generate%20Refactoring%20Job%20REST%20request%20XML/
Example of Extension Manager installJob
Using the
file you can use a request like the following one to ask for the installation of an extension (in this example the XWiki OIDC module version 1.28):Localization resources
For more details see the Localization Module documentation.
XWiki 13.3+
/wikis/{wikiName}/localization/translations[?locale=l&prefix=p[&key=k]*]
- HTTP Method: GET
- Media Types: application/xml or application/json
- Description: The list of translations of the requested keys in a given locale
- Query Parameters:
- locale: (optional) the locale of the returned translation, if missing the locale is resolved from the context
- prefix: (optional) a common prefix concatenated to all the provided keys.
- key: (multiple) a list of translation keys
- Status Code:
- 200: if the request was successful
- Response:
- a list of translation objects, each containing the translation key (concatenated with the prefix) and the resolved raw sources (the translation values without the parameters resolved).
Icon Theme resources
For more details see the Icon Theme Application.
XWiki 13.3+
/wikis/{wikiName}/iconThemes/icons[?[name=n]*]
- HTTP Method: GET
- Media Types: application/xml or application/json
- Description: Provides the metadata of the icons of the current icon theme in a given {wikiName} wiki
- Query Parameters:
- name: (multiple) the name of the requested icons
- Status Code:
- 200: if the request was successful
- Response:
- An object with two attributes: icon is a list of the requested icons metadata, and missingIcons an array of names of requested icons that couldn't be found in the current theme.
/wikis/{wikiName}/iconThemes/{iconTheme}/icons[?[name=n]*]
- HTTP Method: GET
- Media Types: application/xml or application/json
- Description: Provides the metadata of the icons of the {iconTheme} icon theme in a given {wikiName} wiki
- Query Parameters:
- name: (multiple) the name of the requested icons
- Status Code:
- 200: if the request was successful
- Response:
- An object with two attributes: icon is a list of the requested icons metadata, and missingIcons an array of names of requested icons that couldn't be found in the requested theme.
Other resources
/wikis/{wikiName}/modifications[?start=offset&number=n&date=t]
- HTTP Method: GET
- Media types:
- application/xml (Modifications element)
- Description: The list of the latest modification made to the wiki {wikiName} starting from time t (t is expressed in milliseconds from 1970 of the starting date)
- Status codes:
- 200: If the request was successful.
- 401: If the user is not authorized.
- Media types:
Custom resources
In Wiki Pages
If you can't find an existing REST endpoint for your needs, you can create your own own by creating a wiki page and putting script in it. For example let's imagine you'd like to get a list of all pages under a given space. You could write a page, say GetChildren with the following content:
#if ("$!request.space" != '')
#set ($discard = $response.setContentType('text/xml'))
<pages>
#set ($query = $services.query.xwql("select doc.fullName from Document doc where ((doc.space like :spacelike escape '!') or (doc.space = :space)) and language='' order by doc.date desc"))
#set ($spaceReferenceString = $request.space)
#set ($spaceLike = $spaceReferenceString.replaceAll('([%_!])', '!$1').concat('.%'))
#set ($query = $query.bindValue('spacelike', $spaceLike))
#set ($query = $query.bindValue('space', $spaceReferenceString))
#foreach ($item in $query.execute())
<page>$item</page>
#end
</pages>
#end
{{/velocity}}
The calling it for example with the following URL http://localhost:8080/xwiki/bin/get/GetChildren/?space=Sandbox&xpage=plain&outputSyntax=plain would give something like:
<page>Sandbox.Test.WebHome</page>
<page>Sandbox.TestPage2</page>
<page>Sandbox.ApplicationsPanelEntry</page>
<page>Sandbox.TestPage3</page>
<page>Sandbox.TestPage1</page>
<page>Sandbox.WebPreferences</page>
<page>Sandbox.WebHome</page>
</pages>
In Java
It's possible to easily add any REST resource by registering a org.xwiki.rest.XWikiResource java component on your wiki (see Component guide for more details).
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import org.xwiki.component.annotation.Component;
import org.xwiki.rest.XWikiResource;
@Component("org.xwiki.contrib.rest.HelloWorldResource")
@Path("/myresources/{myresourcename}")
public class HelloWorldResource extends XWikiResource {
@GET
public String get(@PathParam("myresourcename") @DefaultValue("world") String myresourcename)
{
return "Hello " + myresourcename;
}
}
The name of the component has to be the class FQN.
You can find more examples on this page.
The resource is expected to follow JAX-RS 1 specifications before XWiki 16.2.0 and JAX-RS 2.1 starting with XWiki 16.2.0.
Starting from release 4.3M2, the RESTful API modules have been refactored so that now resource declarations are available in a separate module.
This means that all the information about resources, i.e., URI Paths, supported methods, query parameters, and so on, are available to module developers without having to include the big REST Server module.
Clients willing to access/use the REST API can then declare a dependency on xwiki-platform-rest-api and have all this information available for interacting with it. There are two use cases for this:
- Another platform module that wants to generate responses with links to existing resources.
- HTTP clients that wants to make requests to the RESTful API.
The xwiki-platform-rest-api module can be also seen as an authoritative reference for the REST API.
Generate a REST URL for a resource
If you need to generate a REST URL as String for a resource inside a script, you can use the REST script services:
$services.rest.url($entityReference)
## Force returning an external form URL String, false as second parameter would have the same effect that the previous call
$services.rest.url($entityReference, true)
## String parameter automaticallly converter to entity reference
$services.rest.url('MySpace.MyPage')
$services.rest.url('document:MySpace.MyPage')
$services.rest.url('space:MySpace')
Where $entityReference could be:
- a DocumentReference
- a SpaceReference
We plan to add more supported entities in the future (ObjectReference, ClassReference, etc...).
Using the RESTful API
Tutorial
See this tutorial by Fabio Mancinelli.
Creating an XWiki Object
In this example we will use the curl utility as the HTTP client.
Imagine that you want to create on the page Test.Test a new object of the class XWiki.TestClass, supposing that the class has a property called text.
So, on the command line, you have to do the following:
-X POST
-H "Content-type: application/xml"
-H "Accept: application/xml"
-d "@test.xml"
http://localhost/xwiki/rest/wikis/xwiki/spaces/Test/pages/Test/objects
where test.xml is:
<className>XWiki.TestClass</className>
<property name="text">
<value>Whatever you want to put here</value>
</property>
</object>
Alternatively you can use the less verbose application/x-www-form-urlencoded format:
-X POST
-H "Content-type: application/x-www-form-urlencoded"
-H "Accept: application/xml"
-d "@test.txt"
http://localhost/xwiki/rest/wikis/xwiki/spaces/Test/pages/Test/objects
where test.txt contains something like:
Or, better, you can use directly curl to specify these parameters
using multiple -d switches:
-X POST -H "Content-type: application/x-www-form-urlencoded"
-H "Accept: application/xml"
-d "className=XWiki.TestClass"
-d "property#test=Whatever you want"
http://localhost/xwiki/rest/wikis/xwiki/spaces/Test/pages/Test/objects
The advantage of the second approach is that curl will take care of url-encode your content, while if you send a file you are responsible for this.
Remarks:
- In the application/x-www-form-urlencoded format the "property#" is a standard immutable prefix that is used to distinguish attributes referring to property values from the attributes referring to the object. For example if we had className=XYZ&Text=FOO we would have had an ambiguity on className because we couldn't understand if className is a property of the object to be set to XYZ or an attribute that describes the object itself (i.e., its metadata like the className). By having the property# prefix this ambiguity is resolved.
- The information you get back when you retrieve an object (i.e., all
the <attribute> elements) are useful when clients need to understand the type of data contained in an object (e.g., when they want to display it). They are not necessary when creating an object because the system already has this information. That's why the XML to be sent is smaller. Actually the only information needed is the <className> and a set of <property name="..."><value> elements.
- How do you know what kind of information you can send with the XML? You can discover it by using the class description URI. If you go to http://localhost:8080/xwiki/rest/wikis/xwiki/classes you will get a list of all the classes defined in the Wiki. By looking at this you will understand what are the properties defined by each class, their types and attributes. In that way you will know what you're allowed to put in the <property><value> elements of the XML you send.
Formats of files
A XSD schema exists for XWiki (look here for the source).
However, you may not know exactly how to write the XML files to use when using the PUT method. First thing to know, you may try to get examples by using GET HTTP request to the REST service using cURL or similar tools.
But in order to help you, you'll find below the different formats that you can use. Note that the following XML files are exhaustive files but not all the elements are required.
Example of a file for a wiki
<wiki xmlns="http://www.xwiki.org">
<id>xwiki</id>
<name>xwiki</name>
<description>Some description of the wiki</description>
<owner>Admin</owner>
</wiki>
Example of a file for a space
<space xmlns="http://www.xwiki.org">
<id>xwiki:Main</id>
<wiki>xwiki</wiki>
<name>Main</name>
<home>xwiki:Main.WebHome</home>
<xwikiRelativeUrl>http://localhost:8080/xwiki/bin/view/Main/</xwikiRelativeUrl>
<xwikiAbsoluteUrl>http://localhost:8080/xwiki/bin/view/Main/</xwikiAbsoluteUrl>
</space>
Example of a file for a page
<page xmlns="http://www.xwiki.org">
<id>xwiki:Main.WebHome</id>
<fullName>Main.WebHome</fullName>
<wiki>xwiki</wiki>
<space>Main</space>
<name>WebHome</name>
<title>Home</title>
<parent></parent>
<parentId></parentId>
<version>1.1</version>
<author>XWiki.Admin</author>
<authorName>Administrator</authorName>
<xwikiRelativeUrl>http://localhost:8080/xwiki/bin/view/Main/</xwikiRelativeUrl>
<xwikiAbsoluteUrl>http://localhost:8080/xwiki/bin/view/Main/</xwikiAbsoluteUrl>
<translations></translations>
<syntax>xwiki/2.0</syntax>
<language></language>
<majorVersion>1</majorVersion>
<minorVersion>1</minorVersion>
<hidden>false</hidden>
<created>2009-09-09T02:00:00+02:00</created>
<creator>XWiki.Admin</creator>
<creatorName>Administrator</creatorName>
<modified>2015-10-29T11:19:02+01:00</modified>
<modifier>XWiki.Admin</modifier>
<modifierName>Administrator</modifierName>
<comment>Imported from XAR</comment>
<content>{{include reference="Dashboard.WebHome" context="new"/}}</content>
</page>
Example of a file for a tag
<tags xmlns="http://www.xwiki.org">
<tag name="food"></tag>
</tags>
Example of a file for a comment
<comments xmlns="http://www.xwiki.org">
<comment>
<id>0</id>
<pageId>xwiki:Main.WebHome</pageId>
<author>XWiki.Admin</author>
<authorName>Administrator</authorName>
<date>2015-11-13T18:20:51.936+01:00</date>
<highlight></highlight>
<text>This is a comment</text>
<replyTo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"></replyTo>
</comment>
</comments>
Example of a file for an object
<object xmlns="http://www.xwiki.org">
<id>xwiki:Main.WebHome:c170a0a8-cc17-41cd-aa1e-6f6faf1d9f28</id>
<guid>c170a0a8-cc17-41cd-aa1e-6f6faf1d9f28</guid>
<pageId>xwiki:Main.WebHome</pageId>
<pageVersion>1.1</pageVersion>
<wiki>xwiki</wiki>
<space>Main</space>
<pageName>WebHome</pageName>
<pageAuthor>XWiki.superadmin</pageAuthor>
<className>XWiki.EditModeClass</className>
<number>0</number>
<headline>edit</headline>
<property name="defaultEditMode" type="String">
<attribute name="name" value="defaultEditMode"></attribute>
<attribute name="prettyName" value="Default Edit Mode"></attribute>
<attribute name="unmodifiable" value="0"></attribute>
<attribute name="disabled" value="0"></attribute>
<attribute name="size" value="15"></attribute>
<attribute name="number" value="1"></attribute>
<value>edit</value>
</property>
</object>
Example of a file for a property
<property xmlns="http://www.xwiki.org" name="defaultEditMode" type="String">
<attribute name="name" value="defaultEditMode"></attribute>
<attribute name="prettyName" value="Default Edit Mode"></attribute>
<attribute name="unmodifiable" value="0"></attribute>
<attribute name="disabled" value="0"></attribute>
<attribute name="size" value="15"></attribute>
<attribute name="number" value="1"></attribute>
<value>edit</value>
</property>
Examples
Getting the list of users
Since Users are stored as Objects, you can do a search of the type XWiki.XWikiUsers. For example:
Getting the list of users using XWQL
Using the parameter "className" the result includes the data for the first object of the XWiki.XWikiUsers:
Getting the list of inactive users using XWQL
Using the property "active" where the value is 0 (by replacing with value 1 result will include active users) the result includes the data for all objects of the XWiki.XWikiUsers: