Wiki source code of The XWiki RESTful API

Version 29.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:**
Fabio Mancinelli 1.1 280 *** 200: If the request was successful
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
Vincent Massol 14.2 415 == Tag resources ==
Fabio Mancinelli 1.1 416
Vincent Massol 14.2 417 === /wikis/{wikiName}/spaces/{spaceName}/pages/{pageName}/tags ===
Silvia Macovei 9.1 418
419 * **HTTP Method:** GET
420 ** **Media types:**
Fabio Mancinelli 1.1 421 *** application/xml (Tags element)
Silvia Macovei 9.1 422 ** **Description:** List page tags.
423 ** **Status codes:**
Fabio Mancinelli 1.1 424 *** 200: If the request was successful.
425 *** 401: If the user is not authorized.
Silvia Macovei 9.1 426
427 \\
428
429 * **HTTP Method:** PUT
430 ** **Accepted Media types:**
Fabio Mancinelli 1.1 431 *** application/xml (Tag element)
432 *** text/plain
433 *** application/x-www-form-urlencoded (allowed field names: tag)
Silvia Macovei 9.1 434 ** **Media types:**
Fabio Mancinelli 1.1 435 *** application/xml (Tags element)
Silvia Macovei 9.1 436 ** **Description:** Add a tag to the page.
437 ** **Status codes:**
Fabio Mancinelli 1.1 438 *** 202: If the request was successful.
439 *** 401: If the user is not authorized.
440
Vincent Massol 14.2 441 === /wikis/{wikiName}/tags ===
Silvia Macovei 9.1 442
443 * **HTTP Method:** GET
444 ** **Media types:**
Fabio Mancinelli 1.1 445 *** application/xml (Tags element)
Silvia Macovei 9.1 446 ** **Description:** The list of all available tags
447 ** **Status codes:**
Fabio Mancinelli 1.1 448 *** 200: If the request was successful.
449 *** 401: If the user is not authorized.
450
Vincent Massol 14.2 451 === /wikis/{wikiName}/tags/{tag1}[,{tag2},{tag3}...][?start~=offset&number~=n] ===
Silvia Macovei 9.1 452
453 * **HTTP Method:** GET
454 ** **Media types:**
Fabio Mancinelli 1.1 455 *** application/xml (Pages element)
Silvia Macovei 9.1 456 ** **Description:** The list of pages having the specified 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 == Comments resources ==
Fabio Mancinelli 1.1 462
Vincent Massol 14.2 463 === /wikis/{wikiName}/spaces/{spaceName}/pages/{pageName}/comments[?start~=offset&number~=n] ===
Silvia Macovei 9.1 464
465 * **HTTP Method:** GET
466 ** **Media types:**
Fabio Mancinelli 1.1 467 *** application/xml (Comments element)
Silvia Macovei 9.1 468 ** **Description:** The list of comments on a given page.
469 ** **Status codes:**
Fabio Mancinelli 1.1 470 *** 200: If the request was successful.
471 *** 401: If the user is not authorized.
Silvia Macovei 9.1 472
473 \\
474
475 * **HTTP Method:** POST
476 ** **Accepted Media types:**
Fabio Mancinelli 1.1 477 *** application/xml (Comment element)
478 *** text/plain
Jerome 20.1 479 *** application/x-www-form-urlencoded - allowed field names: ##text##, ##replyTo## (object number of the replied comment, since XE 2.3)
Silvia Macovei 9.1 480 ** **Media types:**
Fabio Mancinelli 1.1 481 *** application/xml (Comment element)
Silvia Macovei 9.1 482 ** **Description:** Create a comment on the given page.
483 ** **Status codes:**
Fabio Mancinelli 1.1 484 *** 201: If the comment was created. (The Location header will contain the URI where the comment has been created.)
485 *** 401: If the user is not authorized.
486
Vincent Massol 14.2 487 === /wikis/{wikiName}/spaces/{spaceName}/pages/{pageName}/comments/{commentId} ===
Silvia Macovei 9.1 488
489 * **HTTP Method:** GET
490 ** **Media types:**
Fabio Mancinelli 1.1 491 *** application/xml (Comment element)
Silvia Macovei 9.1 492 ** **Description:** A specific comment on a page
493 ** **Status codes:**
Fabio Mancinelli 1.1 494 *** 200: If the request was successful.
495 *** 401: If the user is not authorized.
496
Vincent Massol 14.2 497 === /wikis/{wikiName}/spaces/{spaceName}/pages/{pageName}/history/{version}/comments ===
Silvia Macovei 9.1 498
499 * **HTTP Method:** GET
500 ** **Media types:**
Fabio Mancinelli 1.1 501 *** application/xml (Comments element)
Silvia Macovei 9.1 502 ** **Description:** The list of comments at a specific page {version}.
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/{commentId} ===
Silvia Macovei 9.1 508
509 * **HTTP Method:** GET
510 ** **Media types:**
Fabio Mancinelli 1.1 511 *** application/xml (Comment element)
Silvia Macovei 9.1 512 ** **Description:** A comment 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 == Attachments resources ==
Fabio Mancinelli 1.1 518
Vincent Massol 14.2 519 === /wikis/{wikiName}/spaces/{spaceName}/pages/{pageName}/attachments[?start~=offset&number~=n] ===
Silvia Macovei 9.1 520
521 * **HTTP Method:** GET
522 ** **Media types:**
Fabio Mancinelli 1.1 523 *** application/xml (Attachments element)
Silvia Macovei 9.1 524 ** **Description:** The list of attachments of a given page.
525 ** **Status codes:**
Fabio Mancinelli 1.1 526 *** 200: If the request was successful.
527 *** 401: If the user is not authorized.
528
Eduard Moraru 29.2 529 === /wikis/{wikiName}/spaces/{spaceName}/pages/{pageName}/attachments/{attachmentName} ===
Silvia Macovei 9.1 530
531 * **HTTP Method:** GET
532 ** **Media types:**
Fabio Mancinelli 1.1 533 *** The same of the attachment media type.
Silvia Macovei 9.1 534 ** **Description:** The attachment identified by {attachmentName} on 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.
Silvia Macovei 9.1 538
539 \\
540
541 * **HTTP Method:** PUT
542 ** **Accepted media types:**
543 *** **/**
544 ** **Media types:**
Fabio Mancinelli 1.1 545 *** application/xml (AttachmentSummary element)
Silvia Macovei 9.1 546 ** **Description:** Create an attachment identified by {attachmentName} on a given page.
547 ** **Status codes:**
Fabio Mancinelli 1.1 548 *** 201: If the attachment was created.
549 *** 202: If the attachment was updated.
550 *** 401: If the user is not authorized.
Silvia Macovei 9.1 551
552 \\
553
554 * **HTTP Method:** DELETE
555 ** **Media types:**
556 ** **Description:** Delete the attachment identified by {attachmentName} on a given page.
557 ** **Status codes:**
Fabio Mancinelli 1.1 558 *** 204: If the attachment was deleted.
559 *** 401: If the user is not authorized.
560
Vincent Massol 14.2 561 === /wikis/{wikiName}/spaces/{spaceName}/pages/{pageName}/history/{version}/attachments[?start~=offset&number~=n] ===
Silvia Macovei 9.1 562
563 * **HTTP Method:** GET
564 ** **Media types:**
Fabio Mancinelli 1.1 565 *** application/xml (Attachments element)
Silvia Macovei 9.1 566 ** **Description:** The list of attachments at a given page {version}.
567 ** **Status codes:**
Fabio Mancinelli 1.1 568 *** 200: If the request was successful.
569 *** 401: If the user is not authorized.
570
Vincent Massol 14.2 571 === /wikis/{wikiName}/spaces/{spaceName}/pages/{pageName}/history/{version}/attachments/{attachmentName} ===
Silvia Macovei 9.1 572
573 * **HTTP Method:** GET
574 ** **Media types:**
Fabio Mancinelli 1.1 575 *** The same of the attachment media type.
Silvia Macovei 9.1 576 ** **Description:** The attachment identified by {attachmentName} on 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}/attachments/{attachmentName}/history ===
Silvia Macovei 9.1 582
583 * **HTTP Method:** GET
584 ** **Media types:**
Chamika Weerasinghe 28.6 585 *** application/xml (Attachments element)
Silvia Macovei 9.1 586 ** **Description:** The list of available version for the {attachmentName}
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/{version} ===
Silvia Macovei 9.1 592
593 * **HTTP Method:** GET
594 ** **Media types:**
Fabio Mancinelli 1.1 595 *** The same of the attachment media type.
Silvia Macovei 9.1 596 ** **Description:** The {attachmentName} at a given {version}
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 == Object resources ==
Fabio Mancinelli 1.1 602
Vincent Massol 14.2 603 === /wikis/{wikiName}/spaces/{spaceName}/pages/{pageName}/objects[?start~=offset&number~=n] ===
Silvia Macovei 9.1 604
605 * **HTTP Method:** GET
606 ** **Media types:**
Fabio Mancinelli 1.1 607 *** application/xml (Objects element)
Silvia Macovei 9.1 608 ** **Description:** The list of objects associated to a page.
609 ** **Status codes:**
Fabio Mancinelli 1.1 610 *** 200: If the request was successful.
611 *** 401: If the user is not authorized.
Silvia Macovei 9.1 612
613 \\
614
615 * **HTTP Method:** POST
616 ** **Accepted media types:**
Fabio Mancinelli 1.1 617 *** application/xml (Object element)
Anca Luca 29.1 618 *** application/x-www-form-urlencoded (a set of property#name=value pairs representing properties and a field className)
Silvia Macovei 9.1 619 ** **Media types:**
620 *** application/xml (Object element)
621 ** **Description:** Create a new object.
622 ** **Status codes:**
Fabio Mancinelli 1.1 623 *** 201: If the object was created (The Location header will contain the URI associated to the newly created object).
624 *** 401: If the user is not authorized.
625
Vincent Massol 14.2 626 === /wikis/{wikiName}/spaces/{spaceName}/pages/{pageName}/objects/{className}[?start~=offset&number~=n] ===
Silvia Macovei 9.1 627
628 * **HTTP Method:** GET
629 ** **Media types:**
Fabio Mancinelli 1.1 630 *** application/xml (Objects element)
Silvia Macovei 9.1 631 ** **Description:** The list of objects of a given {className} associated to a page.
632 ** **Status codes:**
Fabio Mancinelli 1.1 633 *** 200: If the request was successful.
634 *** 401: If the user is not authorized.
635
Vincent Massol 14.2 636 === /wikis/{wikiName}/spaces/{spaceName}/pages/{pageName}/objects/{className}/{objectNumber} ===
Silvia Macovei 9.1 637
638 * **HTTP Method:** GET
639 ** **Media types:**
Fabio Mancinelli 1.1 640 *** application/xml (Object element)
Silvia Macovei 9.1 641 ** **Description:** The object of type {className} identified by {objectNumber} associated to the given page.
642 ** **Status codes:**
Fabio Mancinelli 1.1 643 *** 200: If the request was successful.
644 *** 401: If the user is not authorized.
Silvia Macovei 9.1 645
646 \\
647
648 * **HTTP Method:** PUT
649 ** **Accepted media types:**
Fabio Mancinelli 1.1 650 *** application/xml (Object element)
Anca Luca 29.1 651 *** application/x-www-form-urlencoded (a set of property#name=value pairs representing properties)
Silvia Macovei 9.1 652 ** **Media types:**
653 *** application/xml (Object element)
654 ** **Description:** Modify the object properties.
655 ** **Status codes:**
Fabio Mancinelli 1.1 656 *** 202: If the object was updated.
657 *** 401: If the user is not authorized.
Silvia Macovei 9.1 658
659 \\
660
661 * **HTTP Method:** DELETE
662 ** **Media types:**
663 ** **Description:** Delete the object.
664 ** **Status codes:**
Fabio Mancinelli 1.1 665 *** 204: If the object was deleted.
666 *** 401: If the user is not authorized.
667
Vincent Massol 14.2 668 === /wikis/{wikiName}/spaces/{spaceName}/pages/{pageName}/objects/{className}/{objectNumber}/properties ===
Silvia Macovei 9.1 669
670 * **HTTP Method:** GET
671 ** **Media types:**
Fabio Mancinelli 1.1 672 *** application/xml (Properties element)
Silvia Macovei 9.1 673 ** **Description:** The properties of the object of type {className} identified by {objectNumber} associated to the given page.
674 ** **Status codes:**
Fabio Mancinelli 1.1 675 *** 200: If the request was successful.
676 *** 401: If the user is not authorized.
677
Vincent Massol 14.2 678 === /wikis/{wikiName}/spaces/{spaceName}/pages/{pageName}/objects/{className}/{objectNumber}/properties/{propertyName} ===
Silvia Macovei 9.1 679
680 * **HTTP Method:** GET
681 ** **Media types:**
Fabio Mancinelli 1.1 682 *** application/xml (Properties element)
Silvia Macovei 9.1 683 ** **Description:** The property {propertyname} of the object of type {className} identified by {objectNumber} associated to the given page.
684 ** **Status codes:**
Fabio Mancinelli 1.1 685 *** 200: If the request was successful.
686 *** 401: If the user is not authorized.
Silvia Macovei 9.1 687
688 \\
689
690 * **HTTP Method:** PUT
691 ** **Accepted media types:**
Fabio Mancinelli 1.1 692 *** application/xml (Property element)
693 *** text/plain
Anca Luca 29.1 694 *** application/x-www-form-urlencoded (a field property#name=value pairs representing a property)
Silvia Macovei 9.1 695 ** **Media types:**
696 *** application/xml (Property element)
697 ** **Description:** Modify the object properties.
698 ** **Status codes:**
Fabio Mancinelli 1.1 699 *** 202: If the object was updated.
700 *** 401: If the user is not authorized.
701
Vincent Massol 14.2 702 === /wikis/{wikiName}/spaces/{spaceName}/pages/{pageName}/history/{version}/objects[?start~=offset&number~=n] ===
Silvia Macovei 9.1 703
704 * **HTTP Method:** GET
705 ** **Media types:**
Fabio Mancinelli 1.1 706 *** application/xml (Objects element)
Silvia Macovei 9.1 707 ** **Description:** The list of objects associated to a page at a given {version}.
708 ** **Status codes:**
Fabio Mancinelli 1.1 709 *** 200: If the request was successful.
710 *** 401: If the user is not authorized.
711
Vincent Massol 14.2 712 === /wikis/{wikiName}/spaces/{spaceName}/pages/{pageName}/history/{version}/objects/{className}/{objectNumber} ===
Silvia Macovei 9.1 713
714 * **HTTP Method:** GET
715 ** **Media types:**
Fabio Mancinelli 1.1 716 *** application/xml (Object element)
Silvia Macovei 9.1 717 ** **Description:** The object of type {className} identified by {objectNumber} associated to the given page at a given {version}.
718 ** **Status codes:**
Fabio Mancinelli 1.1 719 *** 200: If the request was successful.
720 *** 401: If the user is not authorized.
721
Vincent Massol 14.2 722 === /wikis/{wikiName}/spaces/{spaceName}/pages/{pageName}/history/{version}/objects/{className}/{objectNumber}/properties ===
Silvia Macovei 9.1 723
724 * **HTTP Method:** GET
725 ** **Media types:**
Fabio Mancinelli 1.1 726 *** application/xml (Properties element)
Silvia Macovei 9.1 727 ** **Description:** The properties of the object of type {className} identified by {objectNumber} associated to the given page at a given {version}.
728 ** **Status codes:**
Fabio Mancinelli 1.1 729 *** 200: If the request was successful.
730 *** 401: If the user is not authorized.
731
Vincent Massol 14.2 732 === /wikis/{wikiName}/spaces/{spaceName}/pages/{pageName}/history/{version}/objects/{className}/{objectNumber}/properties/{propertyName} ===
Silvia Macovei 9.1 733
734 * **HTTP Method:** GET
735 ** **Media types:**
Fabio Mancinelli 1.1 736 *** application/xml (Properties element)
Silvia Macovei 9.1 737 ** **Description:** The property {propertyname} of the object of type {className} identified by {objectNumber} associated to the given 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}/class/{className}/objects ===
Silvia Macovei 9.1 743
744 * **HTTP Method:** GET
745 ** **Media types:**
Fabio Mancinelli 1.1 746 *** application/xml (Objects element)
Silvia Macovei 9.1 747 ** **Description:** The list of all the objects of a given {className}.
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 == Class resources ==
Fabio Mancinelli 1.1 753
Vincent Massol 14.2 754 === /wikis/{wikiName}/classes[?start~=offset&number~=n] ===
Silvia Macovei 9.1 755
756 * **HTTP Method:** GET
757 ** **Media types:**
Fabio Mancinelli 1.1 758 *** application/xml (Classes element)
Silvia Macovei 9.1 759 ** **Description:** The list of all the classes defined in the wiki {wikiName}
760 ** **Status codes:**
Fabio Mancinelli 1.1 761 *** 200: If the request was successful.
762 *** 401: If the user is not authorized.
763
Vincent Massol 14.2 764 === /wikis/{wikiName}/classes/{className} ===
Silvia Macovei 9.1 765
766 * **HTTP Method:** GET
767 ** **Media types:**
Fabio Mancinelli 1.1 768 *** application/xml (Class element)
Silvia Macovei 9.1 769 ** **Description:** The {className} definition
770 ** **Status codes:**
Fabio Mancinelli 1.1 771 *** 200: If the request was successful.
772 *** 401: If the user is not authorized.
773
Vincent Massol 14.2 774 === /wikis/{wikiName}/classes/{className}/properties ===
Silvia Macovei 9.1 775
776 * **HTTP Method:** GET
777 ** **Media types:**
Fabio Mancinelli 1.1 778 *** application/xml (Properties element)
Silvia Macovei 9.1 779 ** **Description:** The properties of the class {className}.
780 ** **Status codes:**
Fabio Mancinelli 1.1 781 *** 200: If the request was successful.
782 *** 401: If the user is not authorized.
783
Vincent Massol 14.2 784 === /wikis/{wikiName}/classes/{className}/properties/{property} ===
Silvia Macovei 9.1 785
786 * **HTTP Method:** GET
787 ** **Media types:**
Fabio Mancinelli 1.1 788 *** application/xml (Property element)
Silvia Macovei 9.1 789 ** **Description:** The property {property} of the class {className}.
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 == Other resources ==
Fabio Mancinelli 1.1 795
Ludovic Dubost 21.1 796 === /wikis/{wikiName}/modifications[?start~=offset&number~=n&date~=t] ===
Silvia Macovei 9.1 797
798 * **HTTP Method:** GET
799 ** **Media types:**
Fabio Mancinelli 1.1 800 *** application/xml (Modifications element)
Silvia Macovei 9.1 801 ** **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)
802 ** **Status codes:**
Fabio Mancinelli 1.1 803 *** 200: If the request was successful.
804 *** 401: If the user is not authorized.
Thomas Mortagne 22.1 805
806 = Custom resources =
807
Thomas Mortagne 24.1 808 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 809
Thomas Mortagne 23.1 810 {{code language="java"}}
Thomas Mortagne 22.1 811 package org.xwiki.contrib.rest;
812
813 import javax.ws.rs.DefaultValue;
814 import javax.ws.rs.GET;
815 import javax.ws.rs.Path;
816
817 import org.xwiki.component.annotation.Component;
818 import org.xwiki.rest.XWikiResource;
819
820 @Component("org.xwiki.contrib.rest.HelloWordResource")
821 @Path("/myresources/{myresourcename}")
822 class HelloWorldResource extends XWikiResource {
823 @GET
824 public String get(@PathParam("myresourcename") @DefaultValue("world") String myresourcename)
825 {
826 return "Hello " + myresourcename;
827 }
828 }
Thomas Mortagne 23.1 829 {{/code}}
Thomas Mortagne 22.1 830
831 The name of the component has to be the class FQN.
832
Vincent Massol 28.5 833 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