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

Get Connected