Rest WikiPages » History » Version 4

Kevin Saliou, 2012-11-13 11:58

1 1 Jean-Philippe Lang
h1. Wiki Pages
2 1 Jean-Philippe Lang
3 1 Jean-Philippe Lang
{{>toc}}
4 1 Jean-Philippe Lang
5 1 Jean-Philippe Lang
h2. Getting the pages list of a wiki
6 1 Jean-Philippe Lang
7 1 Jean-Philippe Lang
<pre>
8 1 Jean-Philippe Lang
GET /projects/foo/wiki/index.xml
9 1 Jean-Philippe Lang
</pre>
10 1 Jean-Philippe Lang
11 1 Jean-Philippe Lang
Returns the list of all pages in a project wiki.
12 1 Jean-Philippe Lang
13 1 Jean-Philippe Lang
+Response+:
14 1 Jean-Philippe Lang
15 1 Jean-Philippe Lang
<pre>
16 1 Jean-Philippe Lang
<?xml version="1.0"?>
17 1 Jean-Philippe Lang
<wiki_pages type="array">
18 1 Jean-Philippe Lang
  <wiki_page>
19 1 Jean-Philippe Lang
    <title>UsersGuide</title>
20 1 Jean-Philippe Lang
    <version>2</version>
21 1 Jean-Philippe Lang
    <created_on>2008-03-09T12:07:08Z</created_on>
22 1 Jean-Philippe Lang
    <updated_on>2008-03-09T23:41:33+01:00</updated_on>
23 1 Jean-Philippe Lang
  </wiki_page>
24 1 Jean-Philippe Lang
  ...
25 1 Jean-Philippe Lang
</wiki_pages>
26 1 Jean-Philippe Lang
</pre>
27 1 Jean-Philippe Lang
28 1 Jean-Philippe Lang
h2. Getting a wiki page
29 1 Jean-Philippe Lang
30 1 Jean-Philippe Lang
<pre>
31 1 Jean-Philippe Lang
GET /projects/foo/wiki/UsersGuide.xml
32 1 Jean-Philippe Lang
</pre>
33 1 Jean-Philippe Lang
34 1 Jean-Philippe Lang
Returns the details of a wiki page.
35 1 Jean-Philippe Lang
36 1 Jean-Philippe Lang
+Includable+:
37 1 Jean-Philippe Lang
* attachments
38 1 Jean-Philippe Lang
39 1 Jean-Philippe Lang
+Response+:
40 1 Jean-Philippe Lang
41 1 Jean-Philippe Lang
<pre>
42 1 Jean-Philippe Lang
<?xml version="1.0"?>
43 1 Jean-Philippe Lang
<wiki_page>
44 1 Jean-Philippe Lang
  <title>UsersGuide</title>
45 1 Jean-Philippe Lang
  <parent title="Installation_Guide"/>
46 1 Jean-Philippe Lang
  <text>h1. Users Guide
47 1 Jean-Philippe Lang
  ...
48 1 Jean-Philippe Lang
  ...</text>
49 1 Jean-Philippe Lang
  <version>22</version>
50 1 Jean-Philippe Lang
  <author id="11" name="John Smith"/>
51 1 Jean-Philippe Lang
  <comments>Typo</comments>
52 1 Jean-Philippe Lang
  <created_on>2009-05-18T20:11:52Z</created_on>
53 1 Jean-Philippe Lang
  <updated_on>2012-10-02T11:38:18Z</updated_on>
54 1 Jean-Philippe Lang
</wiki_page>
55 1 Jean-Philippe Lang
</pre>
56 1 Jean-Philippe Lang
57 3 Jean-Philippe Lang
h2. Getting an old version of a wiki page
58 3 Jean-Philippe Lang
59 3 Jean-Philippe Lang
<pre>
60 3 Jean-Philippe Lang
GET /projects/foo/wiki/UsersGuide/23.xml
61 3 Jean-Philippe Lang
</pre>
62 3 Jean-Philippe Lang
63 3 Jean-Philippe Lang
Returns the details of an old version of a wiki page.
64 3 Jean-Philippe Lang
65 3 Jean-Philippe Lang
+Includable+:
66 3 Jean-Philippe Lang
* attachments
67 3 Jean-Philippe Lang
68 3 Jean-Philippe Lang
+Response+:
69 3 Jean-Philippe Lang
70 3 Jean-Philippe Lang
Same as above.
71 3 Jean-Philippe Lang
72 1 Jean-Philippe Lang
h2. Creating or updating a wiki page
73 1 Jean-Philippe Lang
74 1 Jean-Philippe Lang
<pre>
75 1 Jean-Philippe Lang
PUT /projects/foo/wiki/UsersGuide.xml
76 1 Jean-Philippe Lang
<?xml version="1.0"?>
77 1 Jean-Philippe Lang
<wiki_page>
78 1 Jean-Philippe Lang
  <text>Example</text>
79 1 Jean-Philippe Lang
  <comments>Typo</comments>
80 4 Kevin Saliou
</wiki_page>
81 1 Jean-Philippe Lang
</pre>
82 1 Jean-Philippe Lang
83 1 Jean-Philippe Lang
Creates or updates a wiki page.
84 1 Jean-Philippe Lang
85 1 Jean-Philippe Lang
When updating an existing page, you can include a @version@ attribute to make sure that the page is a specific version when you try to update it (eg. you don't want to overwrite an update that would have been done after you retrieved the page). Example:
86 1 Jean-Philippe Lang
87 1 Jean-Philippe Lang
<pre>
88 1 Jean-Philippe Lang
PUT /projects/foo/wiki/UsersGuide.xml
89 1 Jean-Philippe Lang
<?xml version="1.0"?>
90 1 Jean-Philippe Lang
<wiki_page>
91 1 Jean-Philippe Lang
  <text>Example</text>
92 1 Jean-Philippe Lang
  <comments>Typo</comments>
93 1 Jean-Philippe Lang
  <version>18</version>
94 4 Kevin Saliou
</wiki_page>
95 1 Jean-Philippe Lang
</pre>
96 1 Jean-Philippe Lang
97 1 Jean-Philippe Lang
This would update the page if its current version is 18, otherwise a @409 Conflict@ error is returned.
98 1 Jean-Philippe Lang
99 1 Jean-Philippe Lang
100 1 Jean-Philippe Lang
+Response+:
101 1 Jean-Philippe Lang
* @200 OK@: page was updated
102 1 Jean-Philippe Lang
* @201 Created@: page was created
103 1 Jean-Philippe Lang
* @409 Conflict@: occurs when trying to update a stale page (see above)
104 1 Jean-Philippe Lang
* @422 Unprocessable Entity@: page was not saved due to validation failures (response body contains the error messages)
105 2 Jean-Philippe Lang
106 2 Jean-Philippe Lang
h2. Deleting a wiki page
107 2 Jean-Philippe Lang
108 2 Jean-Philippe Lang
<pre>
109 2 Jean-Philippe Lang
DELETE /projects/foo/wiki/UsersGuide.xml
110 2 Jean-Philippe Lang
</pre>
111 2 Jean-Philippe Lang
112 2 Jean-Philippe Lang
Deletes a wiki page, its attachments and its history. If the deleted page is a parent page, its child pages are not deleted but changed as root pages.
113 2 Jean-Philippe Lang
114 2 Jean-Philippe Lang
+Response+:
115 2 Jean-Philippe Lang
* @200 OK@: page was deleted