Wiki source code of REST API

Last modified by Vincent Massol on 2026/07/08 10:16

Show last authors
1 {{box cssClass="floatinginfobox" title="**Contents**"}}
2 {{toc depth="2"/}}
3 {{/box}}
4
5 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.
6
7 = Accessing the service =
8
9 By defaut the XWiki RESTful API entrypoint is rooted at the following URI:
10
11 {{code}}
12 https://<host>:<port>/<context>/rest
13 {{/code}}
14
15 Where:
16
17 * ##host## and ##port## are the domain and port where XWiki is installed
18 * ##context## is the Servlet Context under which XWiki is deployed in the Servlet container. By default the value is ##xwiki##, and if XWiki is installed as a "root" web application as in the [[official Docker image>>https://hub.docker.com/_/xwiki/]], the value is empty (and the REST API is then available at {{code language="none"}}https://<host>:<port>/rest{{/code}}).
19
20 All the resource references described in the [[XWiki RESTful API Documentation>>#HXWikiRESTfulAPIDocumentation]] should be intended relative to this URL.
21
22 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##
23
24 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:
25
26 * ##http:~/~/localhost:8080/xwiki/rest/wikis?media=json##
27 * ##curl -H 'Accept: application/json' https:~/~/www.xwiki.org/xwiki/rest/##
28
29 = Dataset =
30
31 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.
32
33 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.
34
35 = Understanding resources and representations =
36
37 "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>>http://en.wikipedia.org/wiki/Representational_State_Transfer#Central_principle]])
38
39 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>>https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-model/src/main/resources/xwiki.rest.model.xsd]].
40
41 Of course the same resource can be represented in many different ways. This is yet to be documented.
42
43 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.
44
45 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.
46
47 [[image:representation||height="430"]]
48
49 == Relations ==
50
51 The available relations that you might find in the XML resource representations are the following:
52
53 |=Rel|=Semantics
54 |{{{http://www.xwiki.org/rel/wikis}}}|The representation containing the list of virtual wikis.
55 |{{{http://www.xwiki.org/rel/spaces}}}|The representation containing the list of spaces in a wiki.
56 |{{{http://www.xwiki.org/rel/pages}}}|The representation containing the list of pages in a space.
57 |{{{http://www.xwiki.org/rel/translation}}}|The representation containing a translation of a page.
58 |{{{http://www.xwiki.org/rel/page}}}|The representation for a page.
59 |{{{http://www.xwiki.org/rel/space}}}|The representation for a space.
60 |{{{http://www.xwiki.org/rel/parent}}}|The representation for the page that is parent of the current resource.
61 |{{{http://www.xwiki.org/rel/home}}}|The representation for the page that is the home of the current resource.
62 |{{{http://www.xwiki.org/rel/attachmentData}}}|The representation of the actual attachment data.
63 |{{{http://www.xwiki.org/rel/comments}}}|The representation of the list of comments associated to the current resource.
64 |{{{http://www.xwiki.org/rel/attachments}}}|The representation of the list of attachments associated to the current resource.
65 |{{{http://www.xwiki.org/rel/objects}}}|The representation of the list of objects associated to the current resource.
66 |{{{http://www.xwiki.org/rel/object}}}|The representation for an object.
67 |{{{http://www.xwiki.org/rel/classes}}}|The representation of the list of classes associated to the current resource.
68 |{{{http://www.xwiki.org/rel/history}}}|The representation of the list of history information associated to the current resource.
69 |{{{http://www.xwiki.org/rel/class}}}|The representation for a class.
70 |{{{http://www.xwiki.org/rel/property}}}|The representation for a property.
71 |{{{http://www.xwiki.org/rel/propertyValues}}}|The representation for the list of property values.
72 |{{{http://www.xwiki.org/rel/properties}}}|The representation of the list of properties associated to the current resource.
73 |{{{http://www.xwiki.org/rel/modifications}}}|The representation of the list of modifications associated to the current resource.
74 |{{{http://www.xwiki.org/rel/children}}}|The representation of the list of children associated to the current resource.
75 |{{{http://www.xwiki.org/rel/tags}}}|The representation of the list of tags associated to the current resource.
76 |{{{http://www.xwiki.org/rel/tag}}}|The representation of a tag.
77 |{{{http://www.xwiki.org/rel/search}}}|The representation for a search resource.
78 |{{{http://www.xwiki.org/rel/syntaxes}}}|The representation for a syntax resource.
79 |{{{http://www.xwiki.org/rel/user}}}|{{version since="18.2.0RC1"}}The representation for a user resource.{{/version}}
80
81 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).
82
83 == The "HATEOAS" Graph ==
84
85 In order to better understand the relations among resources you might have a look at this [[graph>>attach:XWikiHATEOAS.pdf]] that pictures all the resources available in the XWiki RESTful API and the relations among them. In this graph, nodes are [[URI templates>>http://code.google.com/p/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.
86
87 This 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.
88
89 = Interacting with the XWiki RESTful API =
90
91 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!
92 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>>xwiki:Blog.Use the Apache HTTP library to interact with the XWiki RESTful API]] by [[Mohamed Boussaa>>xwiki:XWiki.mouhb]].
93
94 Java users might take advantage of the [[JAXB>>http://jaxb.java.net/]] framework and its [[XJC binding compiler>>http://jaxb.java.net/2.2.4/docs/xjc.html]] in order to generate domain object models directly from the [[XML Schema Definition>>https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-model/src/main/resources/xwiki.rest.model.xsd]], and use them for serializing and de-serializing XML representations.
95
96 If you use this approach (Apache HTTP Client + JAXB) you will find yourself writing some code like this:
97
98 {{code language="java"}}
99 import javax.xml.bind.JAXBContext;
100 import javax.xml.bind.Unmarshaller;
101
102 import org.apache.commons.httpclient.HttpClient;
103 import org.apache.commons.httpclient.methods.GetMethod;
104 import org.xwiki.rest.model.jaxb.Page;
105
106 ...
107 HttpClient httpClient = new HttpClient();
108 JAXBContext context = JAXBContext.newInstance("org.xwiki.rest.model.jaxb");
109 Unmarshaller unmarshaller = context.createUnmarshaller();
110
111 GetMethod getMethod = new GetMethod("http://localhost:8080/xwiki/rest/wikis/xwiki/spaces/Main/pages/WebHome");
112 getMethod.addRequestHeader("Accept", "application/xml");
113 httpClient.executeMethod(getMethod);
114
115 Page page = (Page) unmarshaller.unmarshal(getMethod.getResponseBodyAsStream());
116 {{/code}}
117
118 And you will have all the information about the Main.WebHome page in the Page object, without the need of handling XML directly.
119
120 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>>http://curl.haxx.se]]: a standard command line HTTP client that provides an interface to all the functionalities of the HTTP protocol.
121
122 By using curl, the previous example would have been:
123
124 {{code language="xml"}}
125 $ curl http://localhost:8080/xwiki/rest/wikis/xwiki/spaces/Main/pages/WebHome
126
127 <page xmlns="http://www.xwiki.org">
128 <link rel="http://www.xwiki.org/rel/space" href="http://localhost:8080/xwiki/rest/wikis/xwiki/spaces/Main"/>
129 ...
130 {{/code}}
131
132 == Authentication ==
133
134 The XWiki RESTful API supports several types of authentication:
135
136 * **HTTP BASIC Auth**: You provide your credentials using the Authorization HTTP header
137 * **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.
138 * **Custom authentication methods:** if you have setup a custom authenticator on your wiki (such as [[OIDC>>extensions:Extension.OpenID Connect.WebHome]], or [[Trusted authentication>>extensions:Extension.Trusted authentication framework]] or even your own custom ones), additional authentication methods may be available for the RESTful API, provided by these authenticators.
139
140 If you don't provide any credentials the XWiki RESTful API will recognize you as a XWiki.Guest user.
141
142 So if you have, let's say a Main.PrivatePage, and you try to do:
143
144 {{code language="none"}}
145 $ curl -v http://localhost:8080/xwiki/rest/wikis/xwiki/spaces/Main/pages/PrivatePage
146 ...
147 < HTTP/1.1 401 Unauthorized
148 ...
149 {{/code}}
150
151 You will get an Unauthorized empty response.
152
153 On the contrary, by specifying Admin credentials you gain access to the actual page:
154
155 {{code language="xml"}}
156 $ curl -u Admin:admin http://localhost:8080/xwiki/rest/wikis/xwiki/spaces/Main/pages/PrivatePage
157
158 <page xmlns="http://www.xwiki.org">
159 <link rel="http://www.xwiki.org/rel/space" href="http://localhost:8080/xwiki/rest/wikis/xwiki/spaces/Main"/>
160 ...
161 <content>Only admin can see this</content>
162 </page>
163 {{/code}}
164
165 === CSRF Token ===
166
167 {{version since="14.10.8,15.2"}}
168 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.
169
170 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.
171
172 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.
173 {{/version}}
174
175 == Sending representations ==
176
177 Many resources are modifiable, so you can send representations in order to change the state of those resources (e.g., pages).
178 All modifiable resources accept XML representations that conform to the [[XML Schema Definition>>https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-model/src/main/resources/xwiki.rest.model.xsd]]. However, some other representations might be accepted as well (see the following sections).
179
180 Resource update is usually done by using the PUT method, while resource creation is done via PUT or POST.
181
182 For example, in order to create a page you might do the following:
183
184 {{code language="xml"}}
185 $ curl -u Admin:admin -X PUT --data-binary "@newpage.xml" -H "Content-Type: application/xml" http://localhost:8080/xwiki/rest/wikis/xwiki/spaces/Main/pages/NewPage
186
187 <page xmlns="http://www.xwiki.org">
188 <link rel="http://www.xwiki.org/rel/space" href="http://localhost:8080/xwiki/rest/wikis/xwiki/spaces/Main"/>
189 ...
190 <version>1.1</version>
191 <majorVersion>1</majorVersion>
192 <minorVersion>1</minorVersion>
193 <created>2009-03-21+01:00</created>
194 <creator>XWiki.Admin</creator>
195 <modified>2009-03-21+01:00</modified>
196 <modifier>XWiki.Admin</modifier>
197 <content>This is a new page</content>
198 </page>
199 {{/code}}
200
201 Where newpage.xml is an XML file containing
202
203 {{code language="xml"}}
204
205 <page xmlns="http://www.xwiki.org">
206 <title>Hello world</title>
207 <syntax>xwiki/2.0</syntax>
208 <content>This is a new page</content>
209 </page>
210 {{/code}}
211
212 The page has been created and is accessible. Subsequent PUT requests to the page URI will modify its content.
213
214 You can specify a subset of the three elements {{{title}}}, {{{syntax}}}, and {{{content}}} in the XML when updating/creating a page.
215 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.
216
217 == Overcoming browser limitations ==
218
219 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.
220
221 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.
222
223 This overriding mechanism allows the interaction with the XWiki RESTful API by using any kind of browser.
224
225 == PUT vs POST ==
226
227 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.
228
229 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.
230
231 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.
232
233 == Headers ==
234
235 The response of the REST requests always contain some custom headers that might be useful:
236
237 * ##xwiki-version##: contains the representation of the version returned by of XWiki#getVersion (generally the version of the WAR package)
238 * ##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.
239
240 {{version since="16.10.11,17.4.4,17.7.0RC1"}}
241 == Limits ==
242
243 REST APIs that return data from more than a single page (like searching, listing pages and spaces, …) return at maximum 1000 items per request by default. Specifying a higher limit or -1 (for unlimited) will result in a response with error 400 Bad Request. Pagination needs to be used to retrieve more results. See the [[documentation about query limits>>extensions:Extension.Query Module#HQueryLimits]] how to configure or remove this limit.
244 {{/version}}
245
246 = XWiki RESTful API Documentation =
247
248 In this section you will find the documentation of the whole XWiki RESTful API.
249
250 **application/xml** representations refers to the [[XML Schema Definition>>https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-model/src/main/resources/xwiki.rest.model.xsd]].
251
252 Resource URIs are specified using [[URI templates>>http://code.google.com/p/uri-templates/]]. Bracketed elements are formal parameters and should be instantiated to actual values in order to retrieve the associated resource.
253
254 == Root resources ==
255
256 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)
257
258 === / ===
259
260 * **HTTP Method:** GET
261 ** **Media types:**
262 *** application/xml (XWiki element)
263 ** **Description:** Retrieves the entry root description containing information about the server (currently returns the XWiki product Version).
264 ** **Status codes:**
265 *** 200: If the request was successful.
266
267 === /syntaxes ===
268
269 * **HTTP Method:** GET
270 ** **Media types:**
271 *** application/xml (Syntaxes element)
272 ** **Description:** The list of syntaxes supported by the XWiki instance.
273 ** **Status codes:**
274 *** 200: If the request was successful.
275
276 === /wikis ===
277
278 * **HTTP Method:** GET
279 ** **Media types:**
280 *** application/xml (Wikis element)
281 ** **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'.
282 ** **Status codes:**
283 *** 200: If the request was successful.
284
285 === /wikis/query?q~={query}&wikis~=wikiList[&distinct~={true,false}][&order~={asc,desc}][&start~=n][&number~=n][&prettyNames~={true,false}] ===
286
287 * **HTTP Method:** GET
288 ** **Media types:**
289 *** application/xml (SearchResults element)
290 ** **Description:** Search resources (pages and attachments):
291 *** [since 6.4] using a SOLR query (handled by the [[SOLR Query module>>extensions:Extension.Solr Search Query API]]) on the wikis that are specified as a comma separated list in the //wikis// parameter.
292 *** [before 6.4] using a Lucene query (handled by the [[Lucene Plugin>>extensions:Extension.Lucene Plugin]]) on the wikis that are specified as a comma separated list in the //wikis// parameter.
293 ** **Status codes:**
294 *** 200: If the request was successful.
295
296 === /wikis/{wikiName} ===
297
298 * **HTTP Method:** GET
299 ** **Media types:**
300 *** application/xml (Wiki element)
301 ** **Description:** information about the wiki
302 ** **Status codes:**
303 *** 200: If the request was successful.
304
305 * **HTTP Method:** POST
306 ** **Accepted Media types:**
307 *** octet/stream (A XAR file)
308 ** **Media types:**
309 *** application/xml (Wiki element)
310 ** **Query parameters**
311 *** backup={true/false} - import XAR as a backup XAR
312 *** history={RESET/REPLACE/ADD} - history importing
313 ** **Description:** import a XAR in a wiki.
314 ** **Status codes:**
315 *** 200: If the request was successful.
316
317 === /wikis/{wikiName}/children?[offset~=0][&limit~=-1][&search~=] ===
318
319 {{version since="16.4.0RC1"}}
320 * **HTTP Method:** GET
321 ** **Media types:**
322 *** application/xml (Pages element)
323 ** **Query parameters**
324 *** offset={integer} the index of the first child page to return, defaults to 0
325 *** limit={integer} the maximum number of child pages to return, defaults to -1 which means no limit
326 *** search={string} a search string to filter the child pages by name or title, defaults to empty string which means no filtering
327 ** **Description:** the top level pages in the specified wiki
328 ** **Status codes:**
329 *** 200: If the request was successful.
330 {{/version}}
331
332 === /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}] ===
333
334 * **HTTP Method:** GET
335 ** **Media types:**
336 *** application/xml (SearchResults element)
337 ** **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. The specified keywords are converted to uppercase and used in a HQL LIKE clause (e.g if the scope is ##CONTENT## then the document's content is matched to the specified keywords).{{version since="17.5.0"}}The search for pages by title, name and content is based on Solr by default, the query backend can be changed in the [[configuration>>#HConfiguration]]. When the query is empty and no order field is specified, the last modified pages are returned. Otherwise, pages are sorted by match score when no order field is specified. Matches are based on the provided keywords, for the last part of the query a wildcard search is performed in the title and name scopes to support matching partially typed words.{{/version}}
338 ** **Status codes:**
339 *** 200: If the request was successful.
340
341 === /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] ===
342
343 * **HTTP Method:** GET
344 ** **Media types:**
345 *** application/xml (SearchResults element)
346 ** **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>>Documentation.DevGuide.Scripting.velocityHqlExamples]], [[XWiki Query Language Specification>>dev:Design.XWiki Query Language Specification]], [[Lucene Plugin>>extensions:Extension.Lucene Plugin]] and [[SOLR query API>>extensions:Extension.Solr Search 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. {{version since="17.10.5, 18.2.0"}}By default, only the ##solr## query type is available. Additional query types can be enabled by setting the ##rest.allowedQueryTypes## configuration option in ##xwiki.properties##.{{/version}}
347 ** **Status codes:**
348 *** 200: If the request was successful.
349
350 === /wikimanager (This resource is only available when using the [[multi-wiki>>extensions:Extension.Wiki Application]] feature) ===
351
352 * **HTTP Method:** POST
353 ** **Accepted Media types:**
354 *** application/xml (Wiki element)
355 ** **Media types:**
356 *** application/xml (Wiki element)
357 ** **Query parameters**
358 *** template - the wiki template to be used for initializing the wiki.
359 *** history={RESET/REPLACE/ADD} - history importing
360 ** **Description:** create a new wiki.
361 ** **Status codes:**
362 *** 200: If the request was successful.
363
364 == Space resources ==
365
366 === /wikis/{wikiName}/spaces[?start~=offset&number~=n] ===
367
368 * **HTTP Method:** GET
369 ** **Media types:**
370 *** application/xml (Spaces element)
371 ** **Description:** Retrieves the list of spaces available in the {wikiName} wiki.
372 ** **Status codes:**
373 *** 200: If the request was successful.
374
375 === /wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/search?q~={keywords}~[~[&scope~={name,content,title,objects}...]&number~=n] ===
376
377 * **HTTP Method:** GET
378 ** **Media types:**
379 *** application/xml (Search results element)
380 ** **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}
381 ** **Status codes:**
382 *** 200: If the request was successful.
383 *** 401: If the user is not authorized.
384
385 == Page resources ==
386
387 === /wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages[?start~=offset&number~=n] ===
388
389 * **HTTP Method:** GET
390 ** **Media types:**
391 *** application/xml (Pages element)
392 ** **Description:** The list of pages in the space {spaceName}
393 ** **Status codes:**
394 *** 200: If the request was successful.
395 *** 401: If the user is not authorized.
396
397 === /wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}[?prettyNames~={true,false}&objects~={true,false}&class~={true,false}&attachments~={true,false}&minorRevision~={true,false}[&checkRight~={rightName}]*][&supportedSyntax~={syntaxId}]*] ===
398
399 * **HTTP Method:** GET
400 ** **Media types:**
401 *** application/xml (Page element)
402 ** **Query parameters**
403 *** ##prettyNames##: also return the pretty name for various document information (like the author display name, etc). Disabled by default.
404 *** ##objects##: //[since 7.3M1]// also return the objects. Disabled by default.
405 *** ##class##: //[since 7.3M1]// also return the class. Disabled by default.
406 *** ##attachments##: //[since 7.3M1]// also return the attachments metadatas. Disabled by default.
407 *** {{version since="18.1.0RC1"}}##checkRight##: also return whether the user has the right {rightName} on the page. Multiple checks can be requested. Empty by default.{{/version}}
408 *** {{version since="18.2.0RC1"}}##supportedSyntax##: if set and the pages's syntax is not in the list, also return an HTML rendering of the page. Empty by default.{{/version}}
409 ** **Description:**
410 ** **Status codes:**
411 *** 200: If the request was successful.
412 *** 401: If the user is not authorized.
413
414 * **HTTP Method:** PUT
415 ** **Accepted Media types:**
416 *** application/xml (Page element)
417 *** text/plain (Only page content)
418 *** application/x-www-form-urlencoded (allowed field names: title, parent, hidden //[since 7.3]//, content)
419 ** **Media types:**
420 *** application/xml (Page element)
421 ** **Query parameters**
422 *** ##minorRevision## ({{info}}Since 9.11.4 & 10.2RC1{{/info}}): Create a minor revision for the page. Disabled by default.
423 ** **Description:** Create or updates a page.
424 ** **Status codes:**
425 *** 201: If the page was created.
426 *** 202: If the page was updated.
427 *** 304: If the page was not modified.
428 *** 401: If the user is not authorized.
429
430 * **HTTP Method:** DELETE
431 ** **Media types:**
432 *** application/xml (Page element)
433 ** **Query parameters**
434 *** {{version since="18.6.0RC1"}}##skipRecycleBin##: When ##true## (default is ##false##), the deleted page is not put in the recycle bin.{{/version}}
435 ** **Description:** Delete the page.
436 ** **Status codes:**
437 *** 204: If the request was successful.
438 *** 401: If the user is not authorized.
439
440 === /wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}/history[?start~=offset&number~=n] ===
441
442 * **HTTP Method:** GET
443 ** **Media types:**
444 *** application/xml (History element)
445 ** **Description:** The list of all the versions of the given page.
446 ** **Status codes:**
447 *** 200: If the request was successful.
448 *** 401: If the user is not authorized.
449
450 === /wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}/history/{version} ===
451
452 * **HTTP Method:** GET
453 ** **Media types:**
454 *** application/xml (Page element)
455 ** **Description:** The page at version {version}
456 ** **Status codes:**
457 *** 200: If the request was successful.
458 *** 401: If the user is not authorized.
459
460 ==== /wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}/translations[?start~=offset&number~=n] ====
461
462 * **HTTP Method:** GET
463 ** **Media types:**
464 *** application/xml (Translations element)
465 ** **Description:** The list of available translation for the page
466 ** **Status codes:**
467 *** 200: If the request was successful.
468 *** 401: If the user is not authorized.
469
470 === /wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}/translations/{language}[?minorRevision~={true,false}] ===
471
472 * **HTTP Method:** GET
473 ** **Media types:**
474 *** application/xml (Page element)
475 ** **Description:** The page at in the given {language}.
476 ** **Status codes:**
477 *** 200: If the request was successful.
478 *** 401: If the user is not authorized.
479
480 * **HTTP Method:** PUT
481 ** **Accepted Media types:**
482 *** application/xml (Page element)
483 *** text/plain (Only page content)
484 *** application/x-www-form-urlencoded (allowed field names: title, parent, content)
485 ** **Media types:**
486 *** application/xml (Page element)
487 ** **Query parameters**
488 *** ##minorRevision## ({{info}}Since 9.11.4 & 10.2RC1{{/info}}): Create a minor revision for the page. Disabled by default.
489 ** **Description:** Create or updates a page translation.
490 ** **Status codes:**
491 *** 201: If the page was created.
492 *** 202: If the page was updated.
493 *** 304: If the page was not modified.
494 *** 401: If the user is not authorized.
495
496 * **HTTP Method:** DELETE
497 ** **Media types:**
498 *** application/xml (Page element)
499 ** **Query parameters**
500 *** {{version since="18.6.0RC1"}}##skipRecycleBin##: When ##true## (default is ##false##), the deleted page is not put in the recycle bin.{{/version}}
501 ** **Description:** Delete the page translation.
502 ** **Status codes:**
503 *** 204: If the request was successful.
504 *** 401: If the user is not authorized.
505
506 === /wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}/translations/{language}/history ===
507
508 * **HTTP Method:** GET
509 ** **Media types:**
510 *** application/xml (History element)
511 ** **Description:** The list of all the available revisions of the page in a given {language}.
512 ** **Status codes:**
513 *** 200: If the request was successful.
514 *** 401: If the user is not authorized.
515
516 === /wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}/translations/{lang}/history/{version} ===
517
518 * **HTTP Method:** GET
519 ** **Media types:**
520 *** application/xml (Page element)
521 ** **Description:** A page at a given {version} in a given {language}.
522 ** **Status codes:**
523 *** 200: If the request was successful.
524 *** 401: If the user is not authorized.
525
526 === /wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}/children?[start~=0][&number~=-1][&prettyNames~={false,true}][&hierarchy~={parentchild,nestedpages}][&search~=] ===
527
528 * **HTTP Method:** GET
529 ** **Media types:**
530 *** application/xml (Pages element)
531 ** **Query parameters**
532 *** start={integer} the index of the first child page to return, defaults to 0
533 *** number={integer} the maximum number of child pages to return, defaults to -1 which means no limit
534 *** prettyNames={boolean} whether to include rendered page titles in the response (can slow down the response), defaults to false
535 *** {{version since="16.4.0RC1"}}hierarchy={parentchild,nestedpages} the type of hierarchy to use when searching for child pages; for backwards compatibility, the default hierarchy used is "parentchild"; use "nestedpages" hierarchy if you want results that match the current XWiki UI{{/version}}
536 *** {{version since="16.4.0RC1"}}search={string} a search string to filter the child pages by name or title, defaults to empty string which means no filtering{{/version}}
537 ** **Description:** The list of the children of a given page.
538 ** **Status codes:**
539 *** 200: If the request was successful.
540 *** 401: If the user is not authorized.
541
542 === /wikis/{wikiName}/pages[?name~=paneName&space~=spaceName&author~=authorName] ===
543
544 * **HTTP Method:** GET
545 ** **Media types:**
546 *** application/xml (Pages element)
547 ** **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.
548 ** **Status codes:**
549 *** 200: If the request was successful.
550 *** 401: If the user is not authorized.
551
552 == Tag resources ==
553
554 === /wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}/tags[?minorRevision~={true,false}] ===
555
556 * **HTTP Method:** GET
557 ** **Media types:**
558 *** application/xml (Tags element)
559 ** **Description:** List page tags.
560 ** **Status codes:**
561 *** 200: If the request was successful.
562 *** 401: If the user is not authorized.
563
564 * **HTTP Method:** PUT
565 ** **Accepted Media types:**
566 *** application/xml (Tag element)
567 *** text/plain
568 *** application/x-www-form-urlencoded (allowed field names: tag)
569 ** **Media types:**
570 *** application/xml (Tags element)
571 ** **Query parameters**
572 *** ##minorRevision## ({{info}}Since 9.11.4 & 10.2RC1{{/info}}): Create a minor revision for the page. Disabled by default.
573 ** **Description:** Add a tag to the page.
574 ** **Status codes:**
575 *** 202: If the request was successful.
576 *** 401: If the user is not authorized.
577
578 === /wikis/{wikiName}/tags ===
579
580 * **HTTP Method:** GET
581 ** **Media types:**
582 *** application/xml (Tags element)
583 ** **Description:** The list of all available tags
584 ** **Status codes:**
585 *** 200: If the request was successful.
586 *** 401: If the user is not authorized.
587
588 === /wikis/{wikiName}/tags/{tag1}[,{tag2},{tag3}...][?start~=offset&number~=n] ===
589
590 * **HTTP Method:** GET
591 ** **Media types:**
592 *** application/xml (Pages element)
593 ** **Description:** The list of pages having the specified tags.
594 ** **Status codes:**
595 *** 200: If the request was successful.
596 *** 401: If the user is not authorized.
597
598 == Comments resources ==
599
600 === /wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}/comments[?start~=offset&number~=n] ===
601
602 * **HTTP Method:** GET
603 ** **Media types:**
604 *** application/xml (Comments element)
605 ** **Description:** The list of comments on a given page.
606 ** **Status codes:**
607 *** 200: If the request was successful.
608 *** 401: If the user is not authorized.
609
610 * **HTTP Method:** POST
611 ** **Accepted Media types:**
612 *** application/xml (Comment element)
613 *** text/plain
614 *** application/x-www-form-urlencoded - allowed field names: ##text##, ##replyTo## (object number of the replied comment, since XE 2.3)
615 ** **Media types:**
616 *** application/xml (Comment element)
617 ** **Description:** Create a comment on the given page.
618 ** **Status codes:**
619 *** 201: If the comment was created. (The Location header will contain the URI where the comment has been created.)
620 *** 401: If the user is not authorized.
621
622 === /wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}/comments/{commentId} ===
623
624 * **HTTP Method:** GET
625 ** **Media types:**
626 *** application/xml (Comment element)
627 ** **Description:** A specific comment on a page
628 ** **Status codes:**
629 *** 200: If the request was successful.
630 *** 401: If the user is not authorized.
631
632 === /wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}/history/{version}/comments ===
633
634 * **HTTP Method:** GET
635 ** **Media types:**
636 *** application/xml (Comments element)
637 ** **Description:** The list of comments at a specific page {version}.
638 ** **Status codes:**
639 *** 200: If the request was successful.
640 *** 401: If the user is not authorized.
641
642 === /wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}/history/{version}/comments/{commentId} ===
643
644 * **HTTP Method:** GET
645 ** **Media types:**
646 *** application/xml (Comment element)
647 ** **Description:** A comment at a specific page {version}.
648 ** **Status codes:**
649 *** 200: If the request was successful.
650 *** 401: If the user is not authorized.
651
652 == Attachments resources ==
653
654 === /wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}/attachments[?start~=offset&number~=n] ===
655
656 * **HTTP Method:** GET
657 ** **Media types:**
658 *** application/xml (Attachments element)
659 ** **Description:** The list of attachments of a given page.
660 ** **Status codes:**
661 *** 200: If the request was successful.
662 *** 401: If the user is not authorized.
663
664 === /wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}/attachments/{attachmentName} ===
665
666 * **HTTP Method:** GET
667 ** **Media types:**
668 *** The same of the attachment media type.
669 ** **Description:** The attachment identified by {attachmentName} on a given page.
670 ** **Status codes:**
671 *** 200: If the request was successful.
672 *** 401: If the user is not authorized.
673
674 * **HTTP Method:** PUT
675 ** **Accepted media types:**
676 *** **/**
677 ** **Media types:**
678 *** application/xml (AttachmentSummary element)
679 ** **Description:** Create an attachment identified by {attachmentName} on a given page.
680 ** **Status codes:**
681 *** 201: If the attachment was created.
682 *** 202: If the attachment was updated.
683 *** 401: If the user is not authorized.
684
685 * **HTTP Method:** DELETE
686 ** **Media types:**
687 ** **Description:** Delete the attachment identified by {attachmentName} on a given page.
688 ** **Status codes:**
689 *** 204: If the attachment was deleted.
690 *** 401: If the user is not authorized.
691
692 === /wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}/history/{version}/attachments[?start~=offset&number~=n] ===
693
694 * **HTTP Method:** GET
695 ** **Media types:**
696 *** application/xml (Attachments element)
697 ** **Description:** The list of attachments at a given page {version}.
698 ** **Status codes:**
699 *** 200: If the request was successful.
700 *** 401: If the user is not authorized.
701
702 === /wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}/history/{version}/attachments/{attachmentName} ===
703
704 * **HTTP Method:** GET
705 ** **Media types:**
706 *** The same of the attachment media type.
707 ** **Description:** The attachment identified by {attachmentName} on a given page {version}.
708 ** **Status codes:**
709 *** 200: If the request was successful.
710 *** 401: If the user is not authorized.
711
712 === /wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}/attachments/{attachmentName}/history ===
713
714 * **HTTP Method:** GET
715 ** **Media types:**
716 *** application/xml (Attachments element)
717 ** **Description:** The list of available version for the {attachmentName}
718 ** **Status codes:**
719 *** 200: If the request was successful.
720 *** 401: If the user is not authorized.
721
722 === /wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}/attachments/{attachmentName}/history/{version} ===
723
724 * **HTTP Method:** GET
725 ** **Media types:**
726 *** The same of the attachment media type.
727 ** **Description:** The {attachmentName} at a given {version}
728 ** **Status codes:**
729 *** 200: If the request was successful.
730 *** 401: If the user is not authorized.
731
732 === /wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/attachments[?name~=attachmentName&page~=pageName&author~=authorName&types~=attachmentTypeList&start~=offset&number~=n] ===
733
734 * **HTTP Method:** GET
735 ** **Media types:**
736 *** application/xml (Attachments element)
737 ** **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.
738 ** **Status codes:**
739 *** 200: If the request was successful.
740 *** 401: If the user is not authorized.
741
742 === /wikis/{wikiName}/attachments[?name~=attachmentName&page~=pageName&space~=spaceName&author~=authorName&types~=attachmentTypeList&start~=offset&number~=n] ===
743
744 * **HTTP Method:** GET
745 ** **Media types:**
746 *** application/xml (Attachments element)
747 ** **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.
748 ** **Status codes:**
749 *** 200: If the request was successful.
750 *** 401: If the user is not authorized.
751
752 == Object resources ==
753
754 === /wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}/objects[?start~=offset&number~=n] ===
755
756 * **HTTP Method:** GET
757 ** **Media types:**
758 *** application/xml (Objects element)
759 ** **Description:** The list of objects associated to a page.
760 ** **Status codes:**
761 *** 200: If the request was successful.
762 *** 401: If the user is not authorized.
763
764 * **HTTP Method:** POST
765 ** **Accepted media types:**
766 *** application/xml (Object element)
767 *** application/x-www-form-urlencoded (a set of property#name=value pairs representing properties and a field className)
768 **** e.g. {{code language="none"}}className=XWiki.XWikiUsers&property#first_name=John&property#last_name=Doe{{/code}}
769 ** **Media types:**
770 *** application/xml (Object element)
771 ** **Description:** Create a new object.
772 ** **Status codes:**
773 *** 201: If the object was created (The Location header will contain the URI associated to the newly created object).
774 *** 401: If the user is not authorized.
775
776 === /wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}/objects/{className}[?start~=offset&number~=n] ===
777
778 * **HTTP Method:** GET
779 ** **Media types:**
780 *** application/xml (Objects element)
781 ** **Description:** The list of objects of a given {className} associated to a page.
782 ** **Status codes:**
783 *** 200: If the request was successful.
784 *** 401: If the user is not authorized.
785
786 === /wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}/objects/{className}/{objectNumber}[?minorRevision~={true,false}] ===
787
788 * **HTTP Method:** GET
789 ** **Media types:**
790 *** application/xml (Object element)
791 ** **Description:** The object of type {className} identified by {objectNumber} associated to the given page.
792 ** **Status codes:**
793 *** 200: If the request was successful.
794 *** 401: If the user is not authorized.
795
796 * **HTTP Method:** PUT
797 ** **Accepted media types:**
798 *** application/xml (Object element)
799 *** application/x-www-form-urlencoded (a set of property#name=value pairs representing properties)
800 ** **Media types:**
801 *** application/xml (Object element)
802 ** **Query parameters**
803 *** ##minorRevision## ({{info}}Since 9.11.4 & 10.2RC1{{/info}}): Create a minor revision for the page. Disabled by default.
804 ** **Description:** Modify the object properties.
805 ** **Status codes:**
806 *** 202: If the object was updated.
807 *** 401: If the user is not authorized.
808
809 * **HTTP Method:** DELETE
810 ** **Media types:**
811 ** **Description:** Delete the object.
812 ** **Status codes:**
813 *** 204: If the object was deleted.
814 *** 401: If the user is not authorized.
815
816 === /wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}/objects/{className}/{objectNumber}/properties ===
817
818 * **HTTP Method:** GET
819 ** **Media types:**
820 *** application/xml (Properties element)
821 ** **Description:** The properties of the object of type {className} identified by {objectNumber} associated to the given page.
822 ** **Status codes:**
823 *** 200: If the request was successful.
824 *** 401: If the user is not authorized.
825
826 === /wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}/objects/{className}/{objectNumber}/properties/{propertyName}[?minorRevision~={true,false}] ===
827
828 * **HTTP Method:** GET
829 ** **Media types:**
830 *** application/xml (Properties element)
831 ** **Description:** The property {propertyname} of the object of type {className} identified by {objectNumber} associated to the given page.
832 ** **Status codes:**
833 *** 200: If the request was successful.
834 *** 401: If the user is not authorized.
835
836 * **HTTP Method:** PUT
837 ** **Accepted media types:**
838 *** application/xml (Property element)
839 *** text/plain
840 *** application/x-www-form-urlencoded (a field property#name=value pairs representing a property)
841 ** **Media types:**
842 *** application/xml (Property element)
843 ** **Query parameters**
844 *** ##minorRevision## ({{info}}Since 9.11.4 & 10.2RC1{{/info}}): Create a minor revision for the page. Disabled by default.
845 ** **Description:** Modify the object properties.
846 ** **Status codes:**
847 *** 202: If the object was updated.
848 *** 401: If the user is not authorized.
849
850 === /wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}/history/{version}/objects[?start~=offset&number~=n] ===
851
852 * **HTTP Method:** GET
853 ** **Media types:**
854 *** application/xml (Objects element)
855 ** **Description:** The list of objects associated to a page at a given {version}.
856 ** **Status codes:**
857 *** 200: If the request was successful.
858 *** 401: If the user is not authorized.
859
860 === /wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}/history/{version}/objects/{className}/{objectNumber} ===
861
862 * **HTTP Method:** GET
863 ** **Media types:**
864 *** application/xml (Object element)
865 ** **Description:** The object of type {className} identified by {objectNumber} associated to the given page at a given {version}.
866 ** **Status codes:**
867 *** 200: If the request was successful.
868 *** 401: If the user is not authorized.
869
870 === /wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}/history/{version}/objects/{className}/{objectNumber}/properties ===
871
872 * **HTTP Method:** GET
873 ** **Media types:**
874 *** application/xml (Properties element)
875 ** **Description:** The properties of the object of type {className} identified by {objectNumber} associated to the given page at a given {version}.
876 ** **Status codes:**
877 *** 200: If the request was successful.
878 *** 401: If the user is not authorized.
879
880 === /wikis/{wikiName}/spaces/{spaceName}[/spaces/{nestedSpaceName}]*/pages/{pageName}/history/{version}/objects/{className}/{objectNumber}/properties/{propertyName} ===
881
882 * **HTTP Method:** GET
883 ** **Media types:**
884 *** application/xml (Properties element)
885 ** **Description:** The property {propertyName} of the object of type {className} identified by {objectNumber} associated to the given page at a given {version}.
886 ** **Status codes:**
887 *** 200: If the request was successful.
888 *** 401: If the user is not authorized.
889
890 === /wikis/{wikiName}/classes/{className}/objects[?start~=offset&number~=n] ===
891
892 * **HTTP Method:** GET
893 ** **Media types:**
894 *** application/xml (Objects element)
895 ** **Description:** The list of all the objects of a given {className}.
896 ** **Status codes:**
897 *** 200: If the request was successful.
898 *** 401: If the user is not authorized.
899
900 == Class resources ==
901
902 === /wikis/{wikiName}/classes[?start~=offset&number~=n] ===
903
904 * **HTTP Method:** GET
905 ** **Media types:**
906 *** application/xml (Classes element)
907 ** **Description:** The list of all the classes defined in the wiki {wikiName}
908 ** **Status codes:**
909 *** 200: If the request was successful.
910 *** 401: If the user is not authorized.
911
912 === /wikis/{wikiName}/classes/{className} ===
913
914 * **HTTP Method:** GET
915 ** **Media types:**
916 *** application/xml (Class element)
917 ** **Description:** The {className} definition
918 ** **Status codes:**
919 *** 200: If the request was successful.
920 *** 401: If the user is not authorized.
921
922 === /wikis/{wikiName}/classes/{className}/properties ===
923
924 * **HTTP Method:** GET
925 ** **Media types:**
926 *** application/xml (Properties element)
927 ** **Description:** The properties of the class {className}.
928 ** **Status codes:**
929 *** 200: If the request was successful.
930 *** 401: If the user is not authorized.
931
932 === /wikis/{wikiName}/classes/{className}/properties/{propertyName} ===
933
934 * **HTTP Method:** GET
935 ** **Media types:**
936 *** application/xml (Property element)
937 ** **Description:** The property {propertyName} of the class {className}.
938 ** **Status codes:**
939 *** 200: If the request was successful.
940 *** 401: If the user is not authorized.
941
942 === /wikis/{wikiName}/classes/{className}/properties/{propertyName}/values {{info}}Since 9.8RC1{{/info}} ===
943
944 Request parameters:
945
946 |=Name|=Description|
947 |limit|Limit the number of values returned. Zero or a negative number means no limit.
948 |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.
949
950 * **HTTP Method:** GET
951 ** **Media types:**
952 *** application/xml (Property element)
953 ** **Description:** The list of values for the property {propertyName} of the class {className}. At the moment only Database List properties are supported.
954 ** **Status codes:**
955 *** 200: If the request was successful.
956 *** 401: If the user is not authorized to view the specified property.
957 *** 404: If the specified property doesn't exist.
958
959 == Job resources ==
960
961 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##).
962
963 === /jobstatus/{jobId} {{info}}Since 7.2M3{{/info}} ===
964
965 Request parameters:
966
967 |=Name|=Required|=Values|=Default|=Description|=Version
968 |##request##|no|##true~|false##|##false##|Return also the job request|9.1RC1
969 |##progress##|no|##true~|false##|##true##|Return also the job progress|9.1RC1
970 |##log##|no|##true~|false##|##false##|Return also the job log|9.1RC1
971 |##log_fromLevel##|no|##error~|warn~|info~|debug~|trace##| |Indicate the level from which to return logs|9.1RC1
972
973 * **HTTP Method:** GET
974 ** **Media types:**
975 *** application/xml (JobStatus element)
976 ** **Description:** status of a job
977 ** **Status codes:**
978 *** 200: If the request was successful.
979 *** 404: If the job status has not been found
980
981 === /joblog/{jobId} {{info}}Since 7.2M3{{/info}} ===
982
983 Request parameters:
984
985 |=Name|=Required|=Values|=Default|=Description|=Version
986 |##level##|no|##error~|warn~|info~|debug~|trace##| |Indicate the exact level for which to return logs|7.2M3
987 |##fromLevel##|no|##error~|warn~|info~|debug~|trace##| |Indicate the level from which to return logs|7.2M3
988
989 * **HTTP Method:** GET
990 ** **Media types:**
991 *** application/xml (JobLog element)
992 ** **Description:** log of a job
993 ** **Status codes:**
994 *** 200: If the request was successful.
995 *** 404: If the job status has not been found
996
997 === /jobs {{info}}Since 9.1RC1{{/info}} ===
998
999 Request parameters:
1000
1001 |=Name|=Required|=Values|=Default|=Description|=Version
1002 |##jobType##|yes| | |The type of the job to pass to the Job Executor|9.1RC1
1003 |##async##|no|##true~|false##|##true##|If false, return the response only when the job is done|9.1RC1
1004
1005 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.).
1006
1007 * **HTTP Method:** PUT
1008 ** **Input:**
1009 *** Media Types: ##application/xml## or ##application/json##
1010 *** Input body: ##JobRequest## element
1011 ** **Output:**
1012 *** Media Types: ##application/xml## or ##application/json##
1013 *** Response body: ##JobStatus## element
1014 ** **Description:** Start a new job synchronously or asynchronously
1015 ** **Status codes:**
1016 *** 200: If the job was successfully executed
1017 *** 401: If the user is not authorized (i.e. doesn't have Programming Rights)
1018 *** 500: Failing jobs with ##async=false## return an error 500 (Since 9.7RC1)
1019
1020 Jobs started through the REST API automatically get their runtime context injected with the following REST HTTP request context properties:
1021
1022 * current wiki
1023 * current user
1024 * request URL and parameters
1025
1026 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:
1027
1028 * ask for the status of an existing job to have an hint of how the XML/JSON should look like (see [[jobstatus section>>#H2Fjobstatus2F7BjobId7D]])
1029 * 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/
1030
1031 === Example of Extension Manager installJob ===
1032
1033 Using the attach:installjobrequest.xml 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):
1034
1035 {{code language="none"}}
1036 curl -i --user "Admin:admin" -X PUT -H "Content-Type: text/xml" "http://localhost:8080/xwiki/rest/jobs?jobType=install&async=false" --upload-file installjobrequest.xml
1037 {{/code}}
1038
1039 == Localization resources ==
1040
1041 For more details see the [[Localization Module documentation>>extensions:Extension.Localization.WebHome]].
1042
1043 {{version since="13.3RC1"}}
1044 === /wikis/{wikiName}/localization/translations[?locale~=l&prefix~=p[&key~=k]*] ===
1045
1046 * **HTTP Method**: GET
1047 ** **Media Types:** ##application/xml## or ##application/json##
1048 ** **Description: **The list of translations of the requested keys in a given locale
1049 ** **Query Parameters:**
1050 *** **locale:** (optional) the locale of the returned translation, if missing the locale is resolved from the context
1051 *** **prefix:** (optional) a common prefix concatenated to all the provided keys.
1052 *** **key:** (multiple) a list of translation keys
1053 ** **Status Code:**
1054 *** 200: if the request was successful
1055 ** **Response:**
1056 *** 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).
1057 {{/version}}
1058
1059 == Icon Theme resources ==
1060
1061 For more details see the [[Icon Theme Application>>extensions:Extension.Icon Theme Application]].
1062
1063 {{version since="13.3RC1"}}
1064 === /wikis/{wikiName}/iconThemes/icons[?[name~=n]*] ===
1065
1066 * **HTTP Method**: GET
1067 ** **Media Types:** ##application/xml## or ##application/json##
1068 ** **Description: **Provides the metadata of the icons of the current icon theme in a given ##{wikiName}## wiki
1069 ** **Query Parameters:**
1070 *** **name:** (multiple) the name of the requested icons
1071 ** **Status Code:**
1072 *** 200: if the request was successful
1073 ** **Response:**
1074 *** 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.
1075
1076 === /wikis/{wikiName}/iconThemes/{iconTheme}/icons[?[name~=n]*] ===
1077
1078 * **HTTP Method**: GET
1079 ** **Media Types:** ##application/xml## or ##application/json##
1080 ** **Description: **Provides the metadata of the icons of the ##{iconTheme}## icon theme in a given ##{wikiName}## wiki
1081 ** **Query Parameters:**
1082 *** **name:** (multiple) the name of the requested icons
1083 ** **Status Code:**
1084 *** 200: if the request was successful
1085 ** **Response:**
1086 *** 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.
1087 {{/version}}
1088
1089 == User resources ==
1090
1091 {{version since="18.2.0RC1"}}
1092 === /wikis/{wikiName}/user[?preferences~={true,false}] ===
1093
1094 * **HTTP Method:** GET
1095 ** **Media types:**
1096 *** application/xml (User element)
1097 ** **Query parameters:**
1098 *** ##preferences##: also return the preferences. Disabled by default.
1099 ** **Description:** The user performing the request
1100 ** **Status codes:**
1101 *** 200: If the request was successful.
1102 *** 401: If the user is not authorized on {wikiName}.
1103
1104 === /wikis/{wikiName}/users/{userId}[?preferences~={true,false}] ===
1105
1106 * **HTTP Method:** GET
1107 ** **Media types:**
1108 *** application/xml (User element)
1109 ** **Query parameters:**
1110 *** ##preferences##: also return the preferences. Disabled by default and might require specific rights.
1111 ** **Description:** The user that corresponds to {userId} when resolved from {wikiName}. The format of {userId} is intentionally left unspecified and depends on the available resolvers on the instance. For example, with a user stored as a document ##XWiki.someUser## on the default wiki, {userId} could be either ##someUser## or one of the more technical syntaxes listed in the [[User API documentation>>extensions:Extension.User Module.API.WebHome#HBridge]].
1112 ** **Status codes:**
1113 *** 200: If the request was successful.
1114 *** 401: If the user is not authorized on {wikiName} or does not have access to the requested user's profile.
1115 *** 404: If the requested user could not be found.
1116 {{/version}}
1117
1118 == Other resources ==
1119
1120 === /wikis/{wikiName}/modifications[?start~=offset&number~=n&date~=t] ===
1121
1122 * **HTTP Method:** GET
1123 ** **Media types:**
1124 *** application/xml (Modifications element)
1125 ** **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)
1126 ** **Status codes:**
1127 *** 200: If the request was successful.
1128 *** 401: If the user is not authorized.
1129
1130 = Custom resources =
1131
1132 == In Wiki Pages ==
1133
1134 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:
1135
1136 {{code language="velocity"}}
1137 {{velocity}}
1138 #if ("$!request.space" != '')
1139 #set ($discard = $response.setContentType('text/xml'))
1140
1141 <pages>
1142 #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"))
1143 #set ($spaceReferenceString = $request.space)
1144 #set ($spaceLike = $spaceReferenceString.replaceAll('([%_!])', '!$1').concat('.%'))
1145 #set ($query = $query.bindValue('spacelike', $spaceLike))
1146 #set ($query = $query.bindValue('space', $spaceReferenceString))
1147 #foreach ($item in $query.execute())
1148 <page>$item</page>
1149 #end
1150 </pages>
1151 #end
1152 {{/velocity}}
1153 {{/code}}
1154
1155 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:
1156
1157 {{code language="none"}}
1158 <pages>
1159 <page>Sandbox.Test.WebHome</page>
1160 <page>Sandbox.TestPage2</page>
1161 <page>Sandbox.ApplicationsPanelEntry</page>
1162 <page>Sandbox.TestPage3</page>
1163 <page>Sandbox.TestPage1</page>
1164 <page>Sandbox.WebPreferences</page>
1165 <page>Sandbox.WebHome</page>
1166 </pages>
1167 {{/code}}
1168
1169 == In Java ==
1170
1171 It's possible to easily add any REST resource by registering a ##org.xwiki.rest.XWikiResource## java component on your wiki (see [[Component guide>>Documentation.DevGuide.Tutorials.WritingComponents]] for more details).
1172
1173 {{code language="java"}}
1174 package org.xwiki.contrib.rest;
1175
1176 import javax.ws.rs.DefaultValue;
1177 import javax.ws.rs.GET;
1178 import javax.ws.rs.Path;
1179
1180 import org.xwiki.component.annotation.Component;
1181 import org.xwiki.rest.XWikiResource;
1182
1183 @Component("org.xwiki.contrib.rest.HelloWorldResource")
1184 @Path("/myresources/{myresourcename}")
1185 public class HelloWorldResource extends XWikiResource {
1186 @GET
1187 public String get(@PathParam("myresourcename") @DefaultValue("world") String myresourcename)
1188 {
1189 return "Hello " + myresourcename;
1190 }
1191 }
1192 {{/code}}
1193
1194 The name of the component has to be the class FQN.
1195
1196 You can find more examples on [[this page>>https://github.com/xwiki/xwiki-platform/tree/master/xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-server/src/main/java/org/xwiki/rest]].
1197
1198 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.
1199
1200 Starting from release 4.3M2, the RESTful API modules have been refactored so that now resource declarations are available in a separate module.
1201 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.
1202
1203 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:
1204
1205 * Another platform module that wants to generate responses with links to existing resources.
1206 * HTTP clients that wants to make requests to the RESTful API.
1207
1208 The xwiki-platform-rest-api module can be also seen as an authoritative reference for the REST API.
1209
1210 = Generate a REST URL for a resource =
1211
1212 If you need to generate a REST URL as String for a resource inside a script, you can use the REST script services:
1213
1214 {{code language="velocity"}}
1215 ## Return a relative URL String unless the reference wiki is different from the current wiki
1216 $services.rest.url($entityReference)
1217
1218 ## Force returning an external form URL String, false as second parameter would have the same effect that the previous call
1219 $services.rest.url($entityReference, true)
1220
1221 ## String parameter automaticallly converter to entity reference
1222 $services.rest.url('MySpace.MyPage')
1223 $services.rest.url('document:MySpace.MyPage')
1224 $services.rest.url('space:MySpace')
1225 {{/code}}
1226
1227 Where ##$entityReference## could be:
1228
1229 * a ##DocumentReference##
1230 * a ##SpaceReference##
1231
1232 We plan to add more supported entities in the future (ObjectReference, ClassReference, etc...).
1233
1234 = Using the RESTful API =
1235
1236 {{info}}
1237 The examples below are using the ##~-~-data## (##-d##) parameter of the curl command to provide the data sent with the request, which may do some alteration on the content being actually sent (newlines, character set, etc.)
1238 There may be cases where you may need / want to use the ##~-~-data-binary## parameter, in order to send the data as-is, especially when manipulating page content, in which the newlines are relevant.
1239 {{/info}}
1240
1241 == Creating an XWiki Object ==
1242
1243 In this example we will use the [[curl>>http://curl.haxx.se/]] utility as the HTTP client.
1244
1245 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##.
1246
1247 So, on the command line, you have to do the following:
1248
1249 {{code}}
1250 $ curl -u Admin:admin
1251 -X POST
1252 -H "Content-type: application/xml"
1253 -H "Accept: application/xml"
1254 -d "@test.xml"
1255 http://localhost/xwiki/rest/wikis/xwiki/spaces/Test/pages/Test/objects
1256 {{/code}}
1257
1258 where ##test.xml## is:
1259
1260 {{code language="xml"}}
1261 <object xmlns="http://www.xwiki.org">
1262 <className>XWiki.TestClass</className>
1263 <property name="text">
1264 <value>Whatever you want to put here</value>
1265 </property>
1266 </object>
1267 {{/code}}
1268
1269 Alternatively you can use the less verbose ##application/x-www-form-urlencoded format##:
1270
1271 {{code}}
1272 $ curl -u Admin:admin
1273 -X POST
1274 -H "Content-type: application/x-www-form-urlencoded"
1275 -H "Accept: application/xml"
1276 -d "@test.txt"
1277 http://localhost/xwiki/rest/wikis/xwiki/spaces/Test/pages/Test/objects
1278 {{/code}}
1279
1280 where ##test.txt## contains something like:
1281
1282 {{code}}
1283 className=XWiki.TestClass&property#test=Whatever+you+want
1284 {{/code}}
1285
1286 Or, better, you can use directly curl to specify these parameters
1287 using multiple ##-d## switches:
1288
1289 {{code}}
1290 $ curl -u Admin:admin
1291 -X POST -H "Content-type: application/x-www-form-urlencoded"
1292 -H "Accept: application/xml"
1293 -d "className=XWiki.TestClass"
1294 -d "property#test=Whatever you want"
1295 http://localhost/xwiki/rest/wikis/xwiki/spaces/Test/pages/Test/objects
1296 {{/code}}
1297
1298 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.
1299
1300 === Remarks: ===
1301
1302 * 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.
1303
1304 * The information you get back when you retrieve an object (i.e., all
1305 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.
1306
1307 * 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.
1308
1309 == Formats of files ==
1310
1311 A XSD schema exists for XWiki (look [[here>>https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-model/src/main/resources/xwiki.rest.model.xsd]] for the source).
1312
1313 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.
1314
1315 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.
1316
1317 === Example of a file for a ##wiki## ===
1318
1319 {{code language="xml"}}
1320
1321 <wiki xmlns="http://www.xwiki.org">
1322 <id>xwiki</id>
1323 <name>xwiki</name>
1324 <description>Some description of the wiki</description>
1325 <owner>Admin</owner>
1326 </wiki>
1327 {{/code}}
1328
1329 === Example of a file for a ##space## ===
1330
1331 {{code language="xml"}}
1332
1333 <space xmlns="http://www.xwiki.org">
1334 <id>xwiki:Main</id>
1335 <wiki>xwiki</wiki>
1336 <name>Main</name>
1337 <home>xwiki:Main.WebHome</home>
1338 <xwikiRelativeUrl>http://localhost:8080/xwiki/bin/view/Main/</xwikiRelativeUrl>
1339 <xwikiAbsoluteUrl>http://localhost:8080/xwiki/bin/view/Main/</xwikiAbsoluteUrl>
1340 </space>
1341 {{/code}}
1342
1343 === Example of a file for a ##page## ===
1344
1345 {{code language="xml"}}
1346
1347 <page xmlns="http://www.xwiki.org">
1348 <id>xwiki:Main.WebHome</id>
1349 <fullName>Main.WebHome</fullName>
1350 <wiki>xwiki</wiki>
1351 <space>Main</space>
1352 <name>WebHome</name>
1353 <title>Home</title>
1354 <parent></parent>
1355 <parentId></parentId>
1356 <version>1.1</version>
1357 <author>XWiki.Admin</author>
1358 <authorName>Administrator</authorName>
1359 <xwikiRelativeUrl>http://localhost:8080/xwiki/bin/view/Main/</xwikiRelativeUrl>
1360 <xwikiAbsoluteUrl>http://localhost:8080/xwiki/bin/view/Main/</xwikiAbsoluteUrl>
1361 <translations></translations>
1362 <syntax>xwiki/2.0</syntax>
1363 <language></language>
1364 <majorVersion>1</majorVersion>
1365 <minorVersion>1</minorVersion>
1366 <hidden>false</hidden>
1367 <created>2009-09-09T02:00:00+02:00</created>
1368 <creator>XWiki.Admin</creator>
1369 <creatorName>Administrator</creatorName>
1370 <modified>2015-10-29T11:19:02+01:00</modified>
1371 <modifier>XWiki.Admin</modifier>
1372 <modifierName>Administrator</modifierName>
1373 <comment>Imported from XAR</comment>
1374 <content>{{include reference="Dashboard.WebHome" context="new"/}}</content>
1375 </page>
1376 {{/code}}
1377
1378 === Example of a file for a ##tag## ===
1379
1380 {{code language="xml"}}
1381 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
1382 <tags xmlns="http://www.xwiki.org">
1383 <tag name="food"></tag>
1384 </tags>
1385 {{/code}}
1386
1387 === Example of a file for a ##comment## ===
1388
1389 {{code language="xml"}}
1390 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
1391 <comments xmlns="http://www.xwiki.org">
1392 <comment>
1393 <id>0</id>
1394 <pageId>xwiki:Main.WebHome</pageId>
1395 <author>XWiki.Admin</author>
1396 <authorName>Administrator</authorName>
1397 <date>2015-11-13T18:20:51.936+01:00</date>
1398 <highlight></highlight>
1399 <text>This is a comment</text>
1400 <replyTo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"></replyTo>
1401 </comment>
1402 </comments>
1403 {{/code}}
1404
1405 === Example of a file for an ##object## ===
1406
1407 {{code language="xml"}}
1408 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
1409 <object xmlns="http://www.xwiki.org">
1410 <id>xwiki:Main.WebHome:c170a0a8-cc17-41cd-aa1e-6f6faf1d9f28</id>
1411 <guid>c170a0a8-cc17-41cd-aa1e-6f6faf1d9f28</guid>
1412 <pageId>xwiki:Main.WebHome</pageId>
1413 <pageVersion>1.1</pageVersion>
1414 <wiki>xwiki</wiki>
1415 <space>Main</space>
1416 <pageName>WebHome</pageName>
1417 <pageAuthor>XWiki.superadmin</pageAuthor>
1418 <className>XWiki.EditModeClass</className>
1419 <number>0</number>
1420 <headline>edit</headline>
1421 <property name="defaultEditMode" type="String">
1422 <attribute name="name" value="defaultEditMode"></attribute>
1423 <attribute name="prettyName" value="Default Edit Mode"></attribute>
1424 <attribute name="unmodifiable" value="0"></attribute>
1425 <attribute name="disabled" value="0"></attribute>
1426 <attribute name="size" value="15"></attribute>
1427 <attribute name="number" value="1"></attribute>
1428 <value>edit</value>
1429 </property>
1430 </object>
1431 {{/code}}
1432
1433 === Example of a file for a ##property## ===
1434
1435 {{code language="xml"}}
1436 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
1437 <property xmlns="http://www.xwiki.org" name="defaultEditMode" type="String">
1438 <attribute name="name" value="defaultEditMode"></attribute>
1439 <attribute name="prettyName" value="Default Edit Mode"></attribute>
1440 <attribute name="unmodifiable" value="0"></attribute>
1441 <attribute name="disabled" value="0"></attribute>
1442 <attribute name="size" value="15"></attribute>
1443 <attribute name="number" value="1"></attribute>
1444 <value>edit</value>
1445 </property>
1446 {{/code}}
1447
1448 = Examples =
1449
1450 == Getting the list of users ==
1451
1452 Since Users are stored as Objects, you can do a search of the type ##XWiki.XWikiUsers##. For example:
1453
1454 {{code}}
1455 http://<server>/xwiki/rest/wikis/query?q=object:XWiki.XWikiUsers
1456 {{/code}}
1457
1458 == Getting the list of users using XWQL ==
1459
1460 Using the parameter "className" the result includes the data for the first object of the ##XWiki.XWikiUsers##:
1461
1462 {{code}}
1463 http://<server>/xwiki/rest/wikis/xwiki/query?q=,doc.object(XWiki.XWikiUsers) as obj&type=xwql&className=XWiki.XWikiUsers
1464 {{/code}}
1465
1466 == Getting the list of inactive users using XWQL ==
1467
1468 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##:
1469
1470 {{code}}
1471 http://<server>/xwiki/rest/wikis/xwiki/query?q=where doc.object(XWiki.XWikiUsers).active=0&type=xwql&className=XWiki.XWikiUsers
1472 {{/code}}
1473
1474 {{version since="17.5.0"}}
1475 = Configuration =
1476
1477 You can configure the backend that is used for keyword search at the [[wiki>>#H2Fwikis2F7BwikiName7D2Fsearch3Fq3D7Bkeywords7D5B5B26scope3D7Bname2Ccontent2Ctitle2Cobjects7D...5D26start3Dn5D5B26number3Dn5D5B26orderField3Dfield26order3D7Basc2Cdesc7D5D5Bdistinct3D7Btrue2Cfalse7D5D5B26prettyNames3D7Btrue2Cfalse7D5D]] and [[space>>#H2Fwikis2F7BwikiName7D2Fspaces2F7BspaceName7D5B2Fspaces2F7BnestedSpaceName7D5D2A2Fsearch3Fq3D7Bkeywords7D5B5B26scope3D7Bname2Ccontent2Ctitle2Cobjects7D...5D26number3Dn5D]] level in the ##xwiki.properties## configuration file. By default, the backend is Solr as it is more scalable in particular for big installations with more than 100k documents in a single wiki. For backwards-compatibility, you can change the backend to "database" to restore the exact behavior from before XWiki 17.5.0:
1478
1479 {{code language="none"}}
1480 #-# [Since 17.5.0]
1481 #-# The default source for keyword search results at the space and wiki level in the REST API.
1482 #-# Supported values: database, solr
1483 #-# Before 17.5.0, the database provided the search results. Since 17.5.0, the default "solr" source is the default
1484 #-# which provides much better performance in particular for large installations and allows more flexible queries.
1485 #-# You can change this back to "database" to restore the old behavior.
1486 # rest.keywordSearchSource=solr
1487 {{/code}}
1488 {{/version}}

Get Connected