Wiki source code of The XWiki RESTful API

Version 11.1 by Jerome on 2009/12/10

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

Get Connected