Wiki source code of The XWiki RESTful API

Version 31.2 by Eduard Moraru on 2011/07/21

Hide last authors
Jerome 20.1 1 {{box cssClass="floatinginfobox" title="**Contents**"}}
2 {{toc depth="2"/}}
3 {{/box}}
Fabio Mancinelli 1.1 4
Silvia Macovei 10.5 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.
Fabio Mancinelli 1.1 6
Vincent Massol 28.1 7 See also this [[tutorial by Fabio Mancinelli>>http://blog.fabiomancinelli.org/2011/03/07/XWikis_RESTful_API.html]].
8
Jerome 20.1 9 = Accessing the service =
Fabio Mancinelli 16.1 10
Fabio Mancinelli 17.1 11 By defaut the XWiki RESTful API entrypoint is rooted at the following URI:
12
13 {{code}}
14
15 http://host:port/xwiki/rest
16
17 {{/code}}
18
Vincent Massol 17.2 19 All the resource references described in the [[XWiki RESTful API Documentation>>#HXWikiRESTfulAPIDocumentation]] should be intended relative to this URL.
Fabio Mancinelli 17.1 20
Vincent Massol 28.2 21 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##
Fabio Mancinelli 17.1 22
Vincent Massol 26.2 23 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. For example: ##http:~/~/localhost:8080/xwiki/rest/wikis?media=json##
Ludovic Dubost 25.1 24
Vincent Massol 14.2 25 = Dataset =
Fabio Mancinelli 1.1 26
27 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.
28
Silvia Macovei 10.3 29 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.
Fabio Mancinelli 1.1 30
Vincent Massol 14.2 31 = Understanding resources and representations =
Fabio Mancinelli 1.1 32
Silvia Macovei 10.4 33 "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#REST.27s_central_principle:_resources]])
Fabio Mancinelli 1.1 34
Vincent Massol 28.3 35 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 that can be found 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]]
Fabio Mancinelli 1.1 36
Silvia Macovei 10.4 37 Of course the same resource can be represented in many different ways. This is yet to be documented.
Fabio Mancinelli 1.1 38
Silvia Macovei 10.4 39 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.
Silvia Macovei 9.2 40
Fabio Mancinelli 1.1 41 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.
Silvia Macovei 9.2 42
Silvia Macovei 9.1 43 [[image:representation||height="430"]]
Fabio Mancinelli 1.1 44
Vincent Massol 14.2 45 == Relations ==
Fabio Mancinelli 1.1 46
Fabio Mancinelli 5.1 47 The available relations that you might find in the XML resource representations are the following:
Fabio Mancinelli 1.1 48
Silvia Macovei 9.1 49 |=Rel|=Semantics
Fabio Mancinelli 15.1 50 |{{{http://www.xwiki.org/rel/wikis}}}|The representation containing the list of virtual wikis.
51 |{{{http://www.xwiki.org/rel/spaces}}}|The representation containing the list of spaces in a wiki.
52 |{{{http://www.xwiki.org/rel/pages}}}|The representation containing the list of pages in a space.
53 |{{{http://www.xwiki.org/rel/translation}}}|The representation containing a translation of a page.
54 |{{{http://www.xwiki.org/rel/page}}}|The representation for a page.
55 |{{{http://www.xwiki.org/rel/space}}}|The representation for a space.
56 |{{{http://www.xwiki.org/rel/parent}}}|The representation for the page that is parent of the current resource.
57 |{{{http://www.xwiki.org/rel/home}}}|The representation for the page that is the home of the current resource.
58 |{{{http://www.xwiki.org/rel/attachmentData}}}|The representation of the actual attachment data.
59 |{{{http://www.xwiki.org/rel/comments}}}|The representation of the list of comments associated to the current resource.
60 |{{{http://www.xwiki.org/rel/attachments}}}|The representation of the list of attachments associated to the current resource.
61 |{{{http://www.xwiki.org/rel/objects}}}|The representation of the list of objects associated to the current resource.
62 |{{{http://www.xwiki.org/rel/object}}}|The representation for an object.
63 |{{{http://www.xwiki.org/rel/classes}}}|The representation of the list of classes associated to the current resource.
64 |{{{http://www.xwiki.org/rel/history}}}|The representation of the list of history information associated to the current resource.
65 |{{{http://www.xwiki.org/rel/class}}}|The representation for a class.
66 |{{{http://www.xwiki.org/rel/property}}}|The representation for a property.
67 |{{{http://www.xwiki.org/rel/properties}}}|The representation of the list of properties associated to the current resource.
68 |{{{http://www.xwiki.org/rel/modifications}}}|The representation of the list of modifications associated to the current resource.
69 |{{{http://www.xwiki.org/rel/children}}}|The representation of the list of children associated to the current resource.
70 |{{{http://www.xwiki.org/rel/tags}}}|The representation of the list of tags associated to the current resource.
71 |{{{http://www.xwiki.org/rel/tag}}}|The representation of a tag.
72 |{{{http://www.xwiki.org/rel/search}}}|The representation for a search resource.
Silvia Macovei 9.2 73
Silvia Macovei 8.3 74 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).
Fabio Mancinelli 1.1 75
Vincent Massol 14.2 76 == The "HATEOAS" Graph ==
Fabio Mancinelli 1.1 77
Jerome 20.1 78 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://bitworking.org/projects/URI-Templates/spec/draft-gregorio-uritemplate-03.txt]] representing classes of resources. Edges are the possible links that you might find in a representation of a given resource, and their associated relations.
Silvia Macovei 9.2 79
Fabio Mancinelli 1.1 80 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.
81
Vincent Massol 14.2 82 = Interacting with the XWiki RESTful API =
Silvia Macovei 8.2 83
Oana Florea 9.5 84 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!
Silvia Macovei 9.1 85 If you want to write more complex programs you might download an HTTP library for your favorite language (e.g., [[http://hc.apache.org/]]).
Silvia Macovei 9.2 86
Vincent Massol 28.4 87 Java users might take advantage of the [[JAXB>>https://jaxb.dev.java.net]] framework and its [[XJC binding compiler>>https://jaxb.dev.java.net/jaxb20-ea3/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.
Silvia Macovei 9.2 88
Fabio Mancinelli 5.1 89 If you use this approach (Apache HTTP Client + JAXB) you will find yourself writing some code like this:
Fabio Mancinelli 1.1 90
Fabio Mancinelli 19.1 91 {{code language="java"}}
92 import javax.xml.bind.JAXBContext;
93 import javax.xml.bind.Unmarshaller;
94
95 import org.apache.commons.httpclient.HttpClient;
96 import org.apache.commons.httpclient.methods.GetMethod;
97 import org.xwiki.rest.model.jaxb.Page;
98
99 ...
Fabio Mancinelli 1.1 100 HttpClient httpClient = new HttpClient();
Ludovic Dubost 18.1 101 JAXBContext context = JAXBContext.newInstance("org.xwiki.rest.model.jaxb");
Fabio Mancinelli 19.1 102 Unmarshaller unmarshaller = context.createUnmarshaller();
Fabio Mancinelli 1.1 103
104 GetMethod getMethod = new GetMethod("http://localhost:8080/xwiki/rest/wikis/xwiki/spaces/Main/pages/WebHome");
105 getMethod.addRequestHeader("Accept", "application/xml");
106 httpClient.executeMethod(getMethod);
107
108 Page page = (Page) unmarshaller.unmarshal(getMethod.getResponseBodyAsStream());
Silvia Macovei 9.1 109 {{/code}}
Fabio Mancinelli 1.1 110
Fabio Mancinelli 5.1 111 And you will have all the information about the Main.WebHome page in the Page object, without the need of handling XML directly.
Silvia Macovei 9.2 112
Silvia Macovei 9.1 113 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.
Silvia Macovei 9.2 114
Fabio Mancinelli 5.1 115 By using curl, the previous example would have been:
Fabio Mancinelli 1.1 116
Fabio Mancinelli 19.1 117 {{code language="xml"}}
Fabio Mancinelli 1.1 118 $ curl http://localhost:8080/xwiki/rest/wikis/xwiki/spaces/Main/pages/WebHome
119 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
120 <page xmlns="http://www.xwiki.org">
121 <link rel="http://www.xwiki.org/rel/space" href="http://localhost:8080/xwiki/rest/wikis/xwiki/spaces/Main"/>
122 ...
Silvia Macovei 9.1 123 {{/code}}
Fabio Mancinelli 1.1 124
Vincent Massol 14.2 125 == Authentication ==
Fabio Mancinelli 1.1 126
Fabio Mancinelli 5.1 127 The XWiki RESTful API supports two types of authentication:
Fabio Mancinelli 1.1 128
Silvia Macovei 9.1 129 * **HTTP BASIC Auth**: You provide your credentials using the Authorization HTTP header
130 * **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.
Silvia Macovei 9.2 131
Fabio Mancinelli 5.1 132 If you don't provide any credentials the XWiki RESTful API will recognize you as a XWiki.Guest user.
Silvia Macovei 9.2 133
Fabio Mancinelli 5.1 134 So if you have, let's say a Main.PrivatePage, and you try to do:
Fabio Mancinelli 1.1 135
Silvia Macovei 10.6 136 {{code language="none"}}
Fabio Mancinelli 1.1 137 $ curl -v http://localhost:8080/xwiki/rest/wikis/xwiki/spaces/Main/pages/PrivatePage
138 ...
139 < HTTP/1.1 401 Unauthorized
140 ...
Silvia Macovei 9.1 141 {{/code}}
Fabio Mancinelli 1.1 142
Silvia Macovei 9.3 143 You will get an Unauthorized empty response.
Silvia Macovei 9.2 144
Fabio Mancinelli 1.1 145 On the contrary, by specifying Admin credentials you gain access to the actual page:
146
Fabio Mancinelli 19.1 147 {{code language="xml"}}
Fabio Mancinelli 1.1 148 $ curl -u Admin:admin http://localhost:8080/xwiki/rest/wikis/xwiki/spaces/Main/pages/PrivatePage
149 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
150 <page xmlns="http://www.xwiki.org">
151 <link rel="http://www.xwiki.org/rel/space" href="http://localhost:8080/xwiki/rest/wikis/xwiki/spaces/Main"/>
152 ...
153 <content>Only admin can see this</content>
154 </page>
Silvia Macovei 9.1 155 {{/code}}
Fabio Mancinelli 1.1 156
Vincent Massol 14.2 157 == Sending representations ==
Fabio Mancinelli 1.1 158
159 Many resources are modifiable, so you can send representations in order to change the state of those resources (e.g., pages).
Vincent Massol 28.4 160 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).
Silvia Macovei 9.2 161
Fabio Mancinelli 1.1 162 Resource update is usually done by using the PUT method, while resource creation is done via PUT or POST.
Silvia Macovei 9.2 163
Fabio Mancinelli 1.1 164 For example, in order to create a page you might do the following:
165
Fabio Mancinelli 19.1 166 {{code language="xml"}}
Sergiu Dumitriu 20.2 167 $ 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
Fabio Mancinelli 1.1 168 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
169 <page xmlns="http://www.xwiki.org">
170 <link rel="http://www.xwiki.org/rel/space" href="http://localhost:8080/xwiki/rest/wikis/xwiki/spaces/Main"/>
171 ...
172 <version>1.1</version>
173 <majorVersion>1</majorVersion>
174 <minorVersion>1</minorVersion>
175 <created>2009-03-21+01:00</created>
176 <creator>XWiki.Admin</creator>
177 <modified>2009-03-21+01:00</modified>
178 <modifier>XWiki.Admin</modifier>
179 <content>This is a new page</content>
180 </page>
Silvia Macovei 9.1 181 {{/code}}
Fabio Mancinelli 1.1 182
183 Where newpage.xml is an XML file containing
184
Fabio Mancinelli 19.1 185 {{code language="xml"}}
Fabio Mancinelli 1.1 186 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
187 <page xmlns="http://www.xwiki.org">
188 <title>Hello world</title>
189 <content>This is a new page</content>
190 </page>
Silvia Macovei 9.1 191 {{/code}}
Fabio Mancinelli 1.1 192
193 The page has been created and is accessible. Subsequent PUT requests to the page URI will modify its content.
194
Vincent Massol 14.2 195 == Overcoming browser limitations ==
Fabio Mancinelli 1.1 196
Silvia Macovei 10.4 197 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.
Silvia Macovei 9.2 198
Silvia Macovei 10.4 199 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.
Fabio Mancinelli 1.1 200
201 This overriding mechanism allows the interaction with the XWiki RESTful API by using any kind of browser.
202
Vincent Massol 14.2 203 == PUT vs POST ==
Fabio Mancinelli 1.1 204
Silvia Macovei 10.4 205 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.
Fabio Mancinelli 1.1 206
Silvia Macovei 10.4 207 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.
Fabio Mancinelli 1.1 208
Oana Florea 9.5 209 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.
Fabio Mancinelli 1.1 210
Vincent Massol 14.2 211 = XWiki RESTful API Documentation =
Silvia Macovei 8.4 212
Oana Florea 9.5 213 In this section you will find the documentation of the whole XWiki RESTful API.
Fabio Mancinelli 1.1 214
Vincent Massol 28.4 215 **application/xml** representations refers to the XML Schema Definition at the following location: [[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]]
Fabio Mancinelli 1.1 216
Silvia Macovei 9.1 217 Resource URIs are specified using [[URI templates>>http://bitworking.org/projects/URI-Templates/spec/draft-gregorio-uritemplate-03.txt]]. Bracketed elements are formal parameters and should be instantiated to actual values in order to retrieve the associated resource.
Fabio Mancinelli 1.1 218
Vincent Massol 14.2 219 == Root resources ==
Fabio Mancinelli 1.1 220
Jerome 20.1 221 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)
Fabio Mancinelli 16.1 222
Vincent Massol 14.2 223 === / ===
Silvia Macovei 9.1 224
225 * **HTTP Method:** GET
226 ** **Media types:**
Fabio Mancinelli 1.1 227 *** application/xml (XWiki element)
Silvia Macovei 9.1 228 ** **Description:** Retrieves the entry root description containing information about the server.
229 ** **Status codes:**
Fabio Mancinelli 1.1 230 *** 200: If the request was successful.
231
Vincent Massol 14.2 232 === /wikis ===
Silvia Macovei 9.1 233
234 * **HTTP Method:** GET
235 ** **Media types:**
Fabio Mancinelli 1.1 236 *** application/xml (Wikis element)
Silvia Macovei 9.1 237 ** **Description:** Retrieves the entry root description containing information about the server.
238 ** **Status codes:**
Fabio Mancinelli 1.1 239 *** 200: If the request was successful.
240
Jerome 20.1 241 === /wikis/{wikiName}/search?q~={keywords}~[~[&scope~={name,content,title,objects}...]&number~=n] ===
Silvia Macovei 9.1 242
243 * **HTTP Method:** GET
244 ** **Media types:**
Fabio Mancinelli 1.1 245 *** application/xml (SearchResults element)
Silvia Macovei 9.1 246 ** **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 the whole {wikiName}
247 ** **Status codes:**
Fabio Mancinelli 1.1 248 *** 200: If the request was successful.
249
Vincent Massol 14.2 250 == Space resources ==
Fabio Mancinelli 1.1 251
Vincent Massol 14.2 252 === /wikis/{wikiName}/spaces[?start~=offset&number~=n] ===
Silvia Macovei 9.1 253
254 * **HTTP Method:** GET
255 ** **Media types:**
Fabio Mancinelli 1.1 256 *** application/xml (Spaces element)
Silvia Macovei 9.1 257 ** **Description:** Retrieves the list of spaces available in the {wikiName} wiki.
258 ** **Status codes:**
Fabio Mancinelli 1.1 259 *** 200: If the request was successful.
260
Jerome 20.1 261 === /wikis/{wikiName}/spaces/{spaceName}/search?q~={keywords}~[~[&scope~={name,content,title,objects}...]&number~=n] ===
Silvia Macovei 9.1 262
263 * **HTTP Method:** GET
264 ** **Media types:**
Fabio Mancinelli 1.1 265 *** application/xml (Search results element)
Silvia Macovei 9.1 266 ** **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}
267 ** **Status codes:**
Fabio Mancinelli 1.1 268 *** 200: If the request was successful.
269 *** 401: If the user is not authorized.
270
Vincent Massol 14.2 271 == Page resources ==
Fabio Mancinelli 1.1 272
Vincent Massol 14.2 273 === /wikis/{wikiName}/spaces/{spaceName}/pages[?start~=offset&number~=n] ===
Silvia Macovei 9.1 274
275 * **HTTP Method:** GET
276 ** **Media types:**
Fabio Mancinelli 1.1 277 *** application/xml (Pages element)
Silvia Macovei 9.1 278 ** **Description:** The list of pages in the space {spaceName}
279 ** **Status codes:**
Eduard Moraru 31.1 280 *** 200: If the request was successful.
Fabio Mancinelli 1.1 281 *** 401: If the user is not authorized.
282
Vincent Massol 14.2 283 === /wikis/{wikiName}/spaces/{spaceName}/pages/{pageName} ===
Silvia Macovei 9.1 284
285 * **HTTP Method:** GET
286 ** **Media types:**
Fabio Mancinelli 1.1 287 *** application/xml (Page element)
Silvia Macovei 9.1 288 ** **Description:**
289 ** **Status codes:**
Fabio Mancinelli 1.1 290 *** 200: If the request was successful.
291 *** 401: If the user is not authorized.
Silvia Macovei 9.1 292
293 \\
294
295 * **HTTP Method:** PUT
296 ** **Accepted Media types:**
Fabio Mancinelli 1.1 297 *** application/xml (Page element)
298 *** text/plain (Only page content)
299 *** application/x-www-form-urlencoded (allowed field names: title, parent, content)
Silvia Macovei 9.1 300 ** **Media types:**
Fabio Mancinelli 1.1 301 *** application/xml (Page element)
Silvia Macovei 9.1 302 ** **Description:** Create or updates a page.
303 ** **Status codes:**
Fabio Mancinelli 1.1 304 *** 201: If the page was created.
305 *** 202: If the page was updated.
306 *** 304: If the page was not modified.
307 *** 401: If the user is not authorized.
Silvia Macovei 9.1 308
309 \\
310
311 * **HTTP Method:** DELETE
312 ** **Media types:**
Fabio Mancinelli 1.1 313 *** application/xml (Page element)
Silvia Macovei 9.1 314 ** **Description:** Delete the page.
315 ** **Status codes:**
Fabio Mancinelli 1.1 316 *** 204: If the request was successful.
317 *** 401: If the user is not authorized.
318
Vincent Massol 14.2 319 === /wikis/{wikiName}/spaces/{spaceName}/pages/{pageName}/history[?start~=offset&number~=n] ===
Silvia Macovei 9.1 320
321 * **HTTP Method:** GET
322 ** **Media types:**
Fabio Mancinelli 1.1 323 *** application/xml (History element)
Silvia Macovei 9.1 324 ** **Description:** The list of all the versions of the given page.
325 ** **Status codes:**
Fabio Mancinelli 1.1 326 *** 200: If the request was successful.
327 *** 401: If the user is not authorized.
328
Vincent Massol 14.2 329 === /wikis/{wikiName}/spaces/{spaceName}/pages/{pageName}/history/{version} ===
Silvia Macovei 9.1 330
331 * **HTTP Method:** GET
332 ** **Media types:**
Fabio Mancinelli 1.1 333 *** application/xml (Page element)
Silvia Macovei 9.1 334 ** **Description:** The page at version {version}
335 ** **Status codes:**
Fabio Mancinelli 1.1 336 *** 200: If the request was successful.
337 *** 401: If the user is not authorized.
338
Silvia Macovei 10.1 339 ==== /wikis/{wikiName}/spaces/{spaceName}/pages/{pageName}/translations[?start~=offset&number~=n] ====
Silvia Macovei 9.1 340
341 * **HTTP Method:** GET
342 ** **Media types:**
Fabio Mancinelli 1.1 343 *** application/xml (Translations element)
Silvia Macovei 9.1 344 ** **Description:** The list of available translation for the page
345 ** **Status codes:**
Fabio Mancinelli 1.1 346 *** 200: If the request was successful.
347 *** 401: If the user is not authorized.
348
Vincent Massol 14.2 349 === /wikis/{wikiName}/spaces/{spaceName}/pages/{pageName}/translations/{language} ===
Silvia Macovei 9.1 350
351 * **HTTP Method:** GET
352 ** **Media types:**
Fabio Mancinelli 1.1 353 *** application/xml (Page element)
Silvia Macovei 9.1 354 ** **Description:** The page at in the given {language}.
355 ** **Status codes:**
Fabio Mancinelli 1.1 356 *** 200: If the request was successful.
357 *** 401: If the user is not authorized.
Silvia Macovei 9.1 358
359 \\
360
361 * **HTTP Method:** PUT
362 ** **Accepted Media types:**
Fabio Mancinelli 1.1 363 *** application/xml (Page element)
364 *** text/plain (Only page content)
365 *** application/x-www-form-urlencoded (allowed field names: title, parent, content)
Silvia Macovei 9.1 366 ** **Media types:**
Fabio Mancinelli 1.1 367 *** application/xml (Page element)
Silvia Macovei 9.1 368 ** **Description:** Create or updates a page translation.
369 ** **Status codes:**
Fabio Mancinelli 1.1 370 *** 201: If the page was created.
371 *** 202: If the page was updated.
372 *** 304: If the page was not modified.
373 *** 401: If the user is not authorized.
Silvia Macovei 9.1 374
375 \\
376
377 * **HTTP Method:** DELETE
378 ** **Media types:**
Fabio Mancinelli 1.1 379 *** application/xml (Page element)
Silvia Macovei 9.1 380 ** **Description:** Delete the page translation.
381 ** **Status codes:**
Fabio Mancinelli 1.1 382 *** 204: If the request was successful.
383 *** 401: If the user is not authorized.
384
Vincent Massol 14.2 385 === /wikis/{wikiName}/spaces/{spaceName}/pages/{pageName}/translations/{language}/history ===
Silvia Macovei 9.1 386
387 * **HTTP Method:** GET
388 ** **Media types:**
Fabio Mancinelli 1.1 389 *** application/xml (History element)
Silvia Macovei 9.1 390 ** **Description:** The list of all the available revisions of the page in a given {language}.
391 ** **Status codes:**
Fabio Mancinelli 1.1 392 *** 200: If the request was successful.
393 *** 401: If the user is not authorized.
394
Vincent Massol 14.2 395 === /wikis/{wikiName}/spaces/{spaceName}/pages/{pageName}/translations/{lang}/history/{version} ===
Silvia Macovei 9.1 396
397 * **HTTP Method:** GET
398 ** **Media types:**
Fabio Mancinelli 1.1 399 *** application/xml (Page element)
Silvia Macovei 9.1 400 ** **Description:** A page at a given {version} in a given {language}.
401 ** **Status codes:**
Fabio Mancinelli 1.1 402 *** 200: If the request was successful.
403 *** 401: If the user is not authorized.
404
Vincent Massol 14.2 405 === /wikis/{wikiName}/spaces/{spaceName}/pages/{pageName}/children ===
Silvia Macovei 9.1 406
407 * **HTTP Method:** GET
408 ** **Media types:**
Fabio Mancinelli 1.1 409 *** application/xml (Pages element)
Silvia Macovei 9.1 410 ** **Description:** The list of the children of a given page.
411 ** **Status codes:**
Fabio Mancinelli 1.1 412 *** 200: If the request was successful.
413 *** 401: If the user is not authorized.
414
Eduard Moraru 31.1 415 === /wikis/{wikiName}/pages[?name~=paneName&space~=spaceName&author~=authorName] ===
416
417 * **HTTP Method:** GET
418 ** **Media types:**
419 *** application/xml (Pages element)
420 ** **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.
421 ** **Status codes:**
422 *** 200: If the request was successful.
423 *** 401: If the user is not authorized.
424
Vincent Massol 14.2 425 == Tag resources ==
Fabio Mancinelli 1.1 426
Vincent Massol 14.2 427 === /wikis/{wikiName}/spaces/{spaceName}/pages/{pageName}/tags ===
Silvia Macovei 9.1 428
429 * **HTTP Method:** GET
430 ** **Media types:**
Fabio Mancinelli 1.1 431 *** application/xml (Tags element)
Silvia Macovei 9.1 432 ** **Description:** List page tags.
433 ** **Status codes:**
Fabio Mancinelli 1.1 434 *** 200: If the request was successful.
435 *** 401: If the user is not authorized.
Silvia Macovei 9.1 436
437 \\
438
439 * **HTTP Method:** PUT
440 ** **Accepted Media types:**
Fabio Mancinelli 1.1 441 *** application/xml (Tag element)
442 *** text/plain
443 *** application/x-www-form-urlencoded (allowed field names: tag)
Silvia Macovei 9.1 444 ** **Media types:**
Fabio Mancinelli 1.1 445 *** application/xml (Tags element)
Silvia Macovei 9.1 446 ** **Description:** Add a tag to the page.
447 ** **Status codes:**
Fabio Mancinelli 1.1 448 *** 202: If the request was successful.
449 *** 401: If the user is not authorized.
450
Vincent Massol 14.2 451 === /wikis/{wikiName}/tags ===
Silvia Macovei 9.1 452
453 * **HTTP Method:** GET
454 ** **Media types:**
Fabio Mancinelli 1.1 455 *** application/xml (Tags element)
Silvia Macovei 9.1 456 ** **Description:** The list of all available tags
457 ** **Status codes:**
Fabio Mancinelli 1.1 458 *** 200: If the request was successful.
459 *** 401: If the user is not authorized.
460
Vincent Massol 14.2 461 === /wikis/{wikiName}/tags/{tag1}[,{tag2},{tag3}...][?start~=offset&number~=n] ===
Silvia Macovei 9.1 462
463 * **HTTP Method:** GET
464 ** **Media types:**
Fabio Mancinelli 1.1 465 *** application/xml (Pages element)
Silvia Macovei 9.1 466 ** **Description:** The list of pages having the specified tags.
467 ** **Status codes:**
Fabio Mancinelli 1.1 468 *** 200: If the request was successful.
469 *** 401: If the user is not authorized.
470
Vincent Massol 14.2 471 == Comments resources ==
Fabio Mancinelli 1.1 472
Vincent Massol 14.2 473 === /wikis/{wikiName}/spaces/{spaceName}/pages/{pageName}/comments[?start~=offset&number~=n] ===
Silvia Macovei 9.1 474
475 * **HTTP Method:** GET
476 ** **Media types:**
Fabio Mancinelli 1.1 477 *** application/xml (Comments element)
Silvia Macovei 9.1 478 ** **Description:** The list of comments on a given page.
479 ** **Status codes:**
Fabio Mancinelli 1.1 480 *** 200: If the request was successful.
481 *** 401: If the user is not authorized.
Silvia Macovei 9.1 482
483 \\
484
485 * **HTTP Method:** POST
486 ** **Accepted Media types:**
Fabio Mancinelli 1.1 487 *** application/xml (Comment element)
488 *** text/plain
Jerome 20.1 489 *** application/x-www-form-urlencoded - allowed field names: ##text##, ##replyTo## (object number of the replied comment, since XE 2.3)
Silvia Macovei 9.1 490 ** **Media types:**
Fabio Mancinelli 1.1 491 *** application/xml (Comment element)
Silvia Macovei 9.1 492 ** **Description:** Create a comment on the given page.
493 ** **Status codes:**
Fabio Mancinelli 1.1 494 *** 201: If the comment was created. (The Location header will contain the URI where the comment has been created.)
495 *** 401: If the user is not authorized.
496
Vincent Massol 14.2 497 === /wikis/{wikiName}/spaces/{spaceName}/pages/{pageName}/comments/{commentId} ===
Silvia Macovei 9.1 498
499 * **HTTP Method:** GET
500 ** **Media types:**
Fabio Mancinelli 1.1 501 *** application/xml (Comment element)
Silvia Macovei 9.1 502 ** **Description:** A specific comment on a page
503 ** **Status codes:**
Fabio Mancinelli 1.1 504 *** 200: If the request was successful.
505 *** 401: If the user is not authorized.
506
Vincent Massol 14.2 507 === /wikis/{wikiName}/spaces/{spaceName}/pages/{pageName}/history/{version}/comments ===
Silvia Macovei 9.1 508
509 * **HTTP Method:** GET
510 ** **Media types:**
Fabio Mancinelli 1.1 511 *** application/xml (Comments element)
Silvia Macovei 9.1 512 ** **Description:** The list of comments at a specific page {version}.
513 ** **Status codes:**
Fabio Mancinelli 1.1 514 *** 200: If the request was successful.
515 *** 401: If the user is not authorized.
516
Vincent Massol 14.2 517 === /wikis/{wikiName}/spaces/{spaceName}/pages/{pageName}/history/{version}/comments/{commentId} ===
Silvia Macovei 9.1 518
519 * **HTTP Method:** GET
520 ** **Media types:**
Fabio Mancinelli 1.1 521 *** application/xml (Comment element)
Silvia Macovei 9.1 522 ** **Description:** A comment at a specific page {version}.
523 ** **Status codes:**
Fabio Mancinelli 1.1 524 *** 200: If the request was successful.
525 *** 401: If the user is not authorized.
526
Vincent Massol 14.2 527 == Attachments resources ==
Fabio Mancinelli 1.1 528
Vincent Massol 14.2 529 === /wikis/{wikiName}/spaces/{spaceName}/pages/{pageName}/attachments[?start~=offset&number~=n] ===
Silvia Macovei 9.1 530
531 * **HTTP Method:** GET
532 ** **Media types:**
Fabio Mancinelli 1.1 533 *** application/xml (Attachments element)
Silvia Macovei 9.1 534 ** **Description:** The list of attachments of a given page.
535 ** **Status codes:**
Fabio Mancinelli 1.1 536 *** 200: If the request was successful.
537 *** 401: If the user is not authorized.
538
Eduard Moraru 29.2 539 === /wikis/{wikiName}/spaces/{spaceName}/pages/{pageName}/attachments/{attachmentName} ===
Silvia Macovei 9.1 540
541 * **HTTP Method:** GET
542 ** **Media types:**
Fabio Mancinelli 1.1 543 *** The same of the attachment media type.
Silvia Macovei 9.1 544 ** **Description:** The attachment identified by {attachmentName} on a given page.
545 ** **Status codes:**
Fabio Mancinelli 1.1 546 *** 200: If the request was successful.
547 *** 401: If the user is not authorized.
Silvia Macovei 9.1 548
549 \\
550
551 * **HTTP Method:** PUT
552 ** **Accepted media types:**
553 *** **/**
554 ** **Media types:**
Fabio Mancinelli 1.1 555 *** application/xml (AttachmentSummary element)
Silvia Macovei 9.1 556 ** **Description:** Create an attachment identified by {attachmentName} on a given page.
557 ** **Status codes:**
Fabio Mancinelli 1.1 558 *** 201: If the attachment was created.
559 *** 202: If the attachment was updated.
560 *** 401: If the user is not authorized.
Silvia Macovei 9.1 561
562 \\
563
564 * **HTTP Method:** DELETE
565 ** **Media types:**
566 ** **Description:** Delete the attachment identified by {attachmentName} on a given page.
567 ** **Status codes:**
Fabio Mancinelli 1.1 568 *** 204: If the attachment was deleted.
569 *** 401: If the user is not authorized.
570
Vincent Massol 14.2 571 === /wikis/{wikiName}/spaces/{spaceName}/pages/{pageName}/history/{version}/attachments[?start~=offset&number~=n] ===
Silvia Macovei 9.1 572
573 * **HTTP Method:** GET
574 ** **Media types:**
Fabio Mancinelli 1.1 575 *** application/xml (Attachments element)
Silvia Macovei 9.1 576 ** **Description:** The list of attachments at a given page {version}.
577 ** **Status codes:**
Fabio Mancinelli 1.1 578 *** 200: If the request was successful.
579 *** 401: If the user is not authorized.
580
Vincent Massol 14.2 581 === /wikis/{wikiName}/spaces/{spaceName}/pages/{pageName}/history/{version}/attachments/{attachmentName} ===
Silvia Macovei 9.1 582
583 * **HTTP Method:** GET
584 ** **Media types:**
Fabio Mancinelli 1.1 585 *** The same of the attachment media type.
Silvia Macovei 9.1 586 ** **Description:** The attachment identified by {attachmentName} on a given page {version}.
587 ** **Status codes:**
Fabio Mancinelli 1.1 588 *** 200: If the request was successful.
589 *** 401: If the user is not authorized.
590
Vincent Massol 14.2 591 === /wikis/{wikiName}/spaces/{spaceName}/pages/{pageName}/attachments/{attachmentName}/history ===
Silvia Macovei 9.1 592
593 * **HTTP Method:** GET
594 ** **Media types:**
Chamika Weerasinghe 28.6 595 *** application/xml (Attachments element)
Silvia Macovei 9.1 596 ** **Description:** The list of available version for the {attachmentName}
597 ** **Status codes:**
Fabio Mancinelli 1.1 598 *** 200: If the request was successful.
599 *** 401: If the user is not authorized.
600
Vincent Massol 14.2 601 === /wikis/{wikiName}/spaces/{spaceName}/pages/{pageName}/attachments/{attachmentName}/history/{version} ===
Silvia Macovei 9.1 602
603 * **HTTP Method:** GET
604 ** **Media types:**
Fabio Mancinelli 1.1 605 *** The same of the attachment media type.
Silvia Macovei 9.1 606 ** **Description:** The {attachmentName} at a given {version}
607 ** **Status codes:**
Fabio Mancinelli 1.1 608 *** 200: If the request was successful.
609 *** 401: If the user is not authorized.
610
Eduard Moraru 30.1 611 === /wikis/{wikiName}/spaces/{spaceName}/attachments[?name~=attachmentName&page~=pageName&author~=authorName&types~=attachmentTypeList&start~=offset&number~=n] ===
612
613 * **HTTP Method:** GET
614 ** **Media types:**
615 *** application/xml (Attachments element)
Eduard Moraru 31.2 616 ** **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.
Eduard Moraru 30.1 617 ** **Status codes:**
618 *** 200: If the request was successful.
619 *** 401: If the user is not authorized.
620
Eduard Moraru 30.2 621 === /wikis/{wikiName}/attachments[?name~=attachmentName&page~=pageName&space~=spaceName&author~=authorName&types~=attachmentTypeList&start~=offset&number~=n] ===
Eduard Moraru 30.1 622
623 * **HTTP Method:** GET
624 ** **Media types:**
625 *** application/xml (Attachments element)
Eduard Moraru 31.2 626 ** **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.
Eduard Moraru 30.1 627 ** **Status codes:**
628 *** 200: If the request was successful.
629 *** 401: If the user is not authorized.
630
Vincent Massol 14.2 631 == Object resources ==
Fabio Mancinelli 1.1 632
Vincent Massol 14.2 633 === /wikis/{wikiName}/spaces/{spaceName}/pages/{pageName}/objects[?start~=offset&number~=n] ===
Silvia Macovei 9.1 634
635 * **HTTP Method:** GET
636 ** **Media types:**
Fabio Mancinelli 1.1 637 *** application/xml (Objects element)
Silvia Macovei 9.1 638 ** **Description:** The list of objects associated to a page.
639 ** **Status codes:**
Fabio Mancinelli 1.1 640 *** 200: If the request was successful.
641 *** 401: If the user is not authorized.
Silvia Macovei 9.1 642
643 \\
644
645 * **HTTP Method:** POST
646 ** **Accepted media types:**
Fabio Mancinelli 1.1 647 *** application/xml (Object element)
Anca Luca 29.1 648 *** application/x-www-form-urlencoded (a set of property#name=value pairs representing properties and a field className)
Silvia Macovei 9.1 649 ** **Media types:**
650 *** application/xml (Object element)
651 ** **Description:** Create a new object.
652 ** **Status codes:**
Fabio Mancinelli 1.1 653 *** 201: If the object was created (The Location header will contain the URI associated to the newly created object).
654 *** 401: If the user is not authorized.
655
Vincent Massol 14.2 656 === /wikis/{wikiName}/spaces/{spaceName}/pages/{pageName}/objects/{className}[?start~=offset&number~=n] ===
Silvia Macovei 9.1 657
658 * **HTTP Method:** GET
659 ** **Media types:**
Fabio Mancinelli 1.1 660 *** application/xml (Objects element)
Silvia Macovei 9.1 661 ** **Description:** The list of objects of a given {className} associated to a page.
662 ** **Status codes:**
Fabio Mancinelli 1.1 663 *** 200: If the request was successful.
664 *** 401: If the user is not authorized.
665
Vincent Massol 14.2 666 === /wikis/{wikiName}/spaces/{spaceName}/pages/{pageName}/objects/{className}/{objectNumber} ===
Silvia Macovei 9.1 667
668 * **HTTP Method:** GET
669 ** **Media types:**
Fabio Mancinelli 1.1 670 *** application/xml (Object element)
Silvia Macovei 9.1 671 ** **Description:** The object of type {className} identified by {objectNumber} associated to the given page.
672 ** **Status codes:**
Fabio Mancinelli 1.1 673 *** 200: If the request was successful.
674 *** 401: If the user is not authorized.
Silvia Macovei 9.1 675
676 \\
677
678 * **HTTP Method:** PUT
679 ** **Accepted media types:**
Fabio Mancinelli 1.1 680 *** application/xml (Object element)
Anca Luca 29.1 681 *** application/x-www-form-urlencoded (a set of property#name=value pairs representing properties)
Silvia Macovei 9.1 682 ** **Media types:**
683 *** application/xml (Object element)
684 ** **Description:** Modify the object properties.
685 ** **Status codes:**
Fabio Mancinelli 1.1 686 *** 202: If the object was updated.
687 *** 401: If the user is not authorized.
Silvia Macovei 9.1 688
689 \\
690
691 * **HTTP Method:** DELETE
692 ** **Media types:**
693 ** **Description:** Delete the object.
694 ** **Status codes:**
Fabio Mancinelli 1.1 695 *** 204: If the object was deleted.
696 *** 401: If the user is not authorized.
697
Vincent Massol 14.2 698 === /wikis/{wikiName}/spaces/{spaceName}/pages/{pageName}/objects/{className}/{objectNumber}/properties ===
Silvia Macovei 9.1 699
700 * **HTTP Method:** GET
701 ** **Media types:**
Fabio Mancinelli 1.1 702 *** application/xml (Properties element)
Silvia Macovei 9.1 703 ** **Description:** The properties of the object of type {className} identified by {objectNumber} associated to the given page.
704 ** **Status codes:**
Fabio Mancinelli 1.1 705 *** 200: If the request was successful.
706 *** 401: If the user is not authorized.
707
Vincent Massol 14.2 708 === /wikis/{wikiName}/spaces/{spaceName}/pages/{pageName}/objects/{className}/{objectNumber}/properties/{propertyName} ===
Silvia Macovei 9.1 709
710 * **HTTP Method:** GET
711 ** **Media types:**
Fabio Mancinelli 1.1 712 *** application/xml (Properties element)
Silvia Macovei 9.1 713 ** **Description:** The property {propertyname} of the object of type {className} identified by {objectNumber} associated to the given page.
714 ** **Status codes:**
Fabio Mancinelli 1.1 715 *** 200: If the request was successful.
716 *** 401: If the user is not authorized.
Silvia Macovei 9.1 717
718 \\
719
720 * **HTTP Method:** PUT
721 ** **Accepted media types:**
Fabio Mancinelli 1.1 722 *** application/xml (Property element)
723 *** text/plain
Anca Luca 29.1 724 *** application/x-www-form-urlencoded (a field property#name=value pairs representing a property)
Silvia Macovei 9.1 725 ** **Media types:**
726 *** application/xml (Property element)
727 ** **Description:** Modify the object properties.
728 ** **Status codes:**
Fabio Mancinelli 1.1 729 *** 202: If the object was updated.
730 *** 401: If the user is not authorized.
731
Vincent Massol 14.2 732 === /wikis/{wikiName}/spaces/{spaceName}/pages/{pageName}/history/{version}/objects[?start~=offset&number~=n] ===
Silvia Macovei 9.1 733
734 * **HTTP Method:** GET
735 ** **Media types:**
Fabio Mancinelli 1.1 736 *** application/xml (Objects element)
Silvia Macovei 9.1 737 ** **Description:** The list of objects associated to a page at a given {version}.
738 ** **Status codes:**
Fabio Mancinelli 1.1 739 *** 200: If the request was successful.
740 *** 401: If the user is not authorized.
741
Vincent Massol 14.2 742 === /wikis/{wikiName}/spaces/{spaceName}/pages/{pageName}/history/{version}/objects/{className}/{objectNumber} ===
Silvia Macovei 9.1 743
744 * **HTTP Method:** GET
745 ** **Media types:**
Fabio Mancinelli 1.1 746 *** application/xml (Object element)
Silvia Macovei 9.1 747 ** **Description:** The object of type {className} identified by {objectNumber} associated to the given page at a given {version}.
748 ** **Status codes:**
Fabio Mancinelli 1.1 749 *** 200: If the request was successful.
750 *** 401: If the user is not authorized.
751
Vincent Massol 14.2 752 === /wikis/{wikiName}/spaces/{spaceName}/pages/{pageName}/history/{version}/objects/{className}/{objectNumber}/properties ===
Silvia Macovei 9.1 753
754 * **HTTP Method:** GET
755 ** **Media types:**
Fabio Mancinelli 1.1 756 *** application/xml (Properties element)
Silvia Macovei 9.1 757 ** **Description:** The properties of the object of type {className} identified by {objectNumber} associated to the given page at a given {version}.
758 ** **Status codes:**
Fabio Mancinelli 1.1 759 *** 200: If the request was successful.
760 *** 401: If the user is not authorized.
761
Vincent Massol 14.2 762 === /wikis/{wikiName}/spaces/{spaceName}/pages/{pageName}/history/{version}/objects/{className}/{objectNumber}/properties/{propertyName} ===
Silvia Macovei 9.1 763
764 * **HTTP Method:** GET
765 ** **Media types:**
Fabio Mancinelli 1.1 766 *** application/xml (Properties element)
Silvia Macovei 9.1 767 ** **Description:** The property {propertyname} of the object of type {className} identified by {objectNumber} associated to the given page at a given {version}.
768 ** **Status codes:**
Fabio Mancinelli 1.1 769 *** 200: If the request was successful.
770 *** 401: If the user is not authorized.
771
Vincent Massol 14.2 772 === /wikis/{wikiName}/class/{className}/objects ===
Silvia Macovei 9.1 773
774 * **HTTP Method:** GET
775 ** **Media types:**
Fabio Mancinelli 1.1 776 *** application/xml (Objects element)
Silvia Macovei 9.1 777 ** **Description:** The list of all the objects of a given {className}.
778 ** **Status codes:**
Fabio Mancinelli 1.1 779 *** 200: If the request was successful.
780 *** 401: If the user is not authorized.
781
Vincent Massol 14.2 782 == Class resources ==
Fabio Mancinelli 1.1 783
Vincent Massol 14.2 784 === /wikis/{wikiName}/classes[?start~=offset&number~=n] ===
Silvia Macovei 9.1 785
786 * **HTTP Method:** GET
787 ** **Media types:**
Fabio Mancinelli 1.1 788 *** application/xml (Classes element)
Silvia Macovei 9.1 789 ** **Description:** The list of all the classes defined in the wiki {wikiName}
790 ** **Status codes:**
Fabio Mancinelli 1.1 791 *** 200: If the request was successful.
792 *** 401: If the user is not authorized.
793
Vincent Massol 14.2 794 === /wikis/{wikiName}/classes/{className} ===
Silvia Macovei 9.1 795
796 * **HTTP Method:** GET
797 ** **Media types:**
Fabio Mancinelli 1.1 798 *** application/xml (Class element)
Silvia Macovei 9.1 799 ** **Description:** The {className} definition
800 ** **Status codes:**
Fabio Mancinelli 1.1 801 *** 200: If the request was successful.
802 *** 401: If the user is not authorized.
803
Vincent Massol 14.2 804 === /wikis/{wikiName}/classes/{className}/properties ===
Silvia Macovei 9.1 805
806 * **HTTP Method:** GET
807 ** **Media types:**
Fabio Mancinelli 1.1 808 *** application/xml (Properties element)
Silvia Macovei 9.1 809 ** **Description:** The properties of the class {className}.
810 ** **Status codes:**
Fabio Mancinelli 1.1 811 *** 200: If the request was successful.
812 *** 401: If the user is not authorized.
813
Vincent Massol 14.2 814 === /wikis/{wikiName}/classes/{className}/properties/{property} ===
Silvia Macovei 9.1 815
816 * **HTTP Method:** GET
817 ** **Media types:**
Fabio Mancinelli 1.1 818 *** application/xml (Property element)
Silvia Macovei 9.1 819 ** **Description:** The property {property} of the class {className}.
820 ** **Status codes:**
Fabio Mancinelli 1.1 821 *** 200: If the request was successful.
822 *** 401: If the user is not authorized.
823
Vincent Massol 14.2 824 == Other resources ==
Fabio Mancinelli 1.1 825
Ludovic Dubost 21.1 826 === /wikis/{wikiName}/modifications[?start~=offset&number~=n&date~=t] ===
Silvia Macovei 9.1 827
828 * **HTTP Method:** GET
829 ** **Media types:**
Fabio Mancinelli 1.1 830 *** application/xml (Modifications element)
Silvia Macovei 9.1 831 ** **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)
832 ** **Status codes:**
Fabio Mancinelli 1.1 833 *** 200: If the request was successful.
834 *** 401: If the user is not authorized.
Thomas Mortagne 22.1 835
836 = Custom resources =
837
Thomas Mortagne 24.1 838 It's possible to easily add any REST resource by registering a ##org.xwiki.rest.XWikiResource## java component on your wiki (see [[Component guide>>DevGuide.WritingComponents]] for more details).
Thomas Mortagne 22.1 839
Thomas Mortagne 23.1 840 {{code language="java"}}
Thomas Mortagne 22.1 841 package org.xwiki.contrib.rest;
842
843 import javax.ws.rs.DefaultValue;
844 import javax.ws.rs.GET;
845 import javax.ws.rs.Path;
846
847 import org.xwiki.component.annotation.Component;
848 import org.xwiki.rest.XWikiResource;
849
850 @Component("org.xwiki.contrib.rest.HelloWordResource")
851 @Path("/myresources/{myresourcename}")
852 class HelloWorldResource extends XWikiResource {
853 @GET
854 public String get(@PathParam("myresourcename") @DefaultValue("world") String myresourcename)
855 {
856 return "Hello " + myresourcename;
857 }
858 }
Thomas Mortagne 23.1 859 {{/code}}
Thomas Mortagne 22.1 860
861 The name of the component has to be the class FQN.
862
Vincent Massol 28.5 863 You can find more examples on [[https://github.com/xwiki/xwiki-platform/tree/master/xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-server/src/main/java/org/xwiki/rest/resources]].

Get Connected