Wiki source code of The XWiki RESTful API

Version 12.1 by Jerome on 2009/12/10

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

Get Connected