Rest WikiPages » History » Version 1

Jean-Philippe Lang, 2012-10-25 23:33

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 1 Jean-Philippe Lang
h2. Creating or updating a wiki page
58 1 Jean-Philippe Lang
59 1 Jean-Philippe Lang
<pre>
60 1 Jean-Philippe Lang
PUT /projects/foo/wiki/UsersGuide.xml
61 1 Jean-Philippe Lang
<?xml version="1.0"?>
62 1 Jean-Philippe Lang
<wiki_page>
63 1 Jean-Philippe Lang
  <text>Example</text>
64 1 Jean-Philippe Lang
  <comments>Typo</comments>
65 1 Jean-Philippe Lang
</issue>
66 1 Jean-Philippe Lang
</pre>
67 1 Jean-Philippe Lang
68 1 Jean-Philippe Lang
Creates or updates a wiki page.
69 1 Jean-Philippe Lang
70 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:
71 1 Jean-Philippe Lang
72 1 Jean-Philippe Lang
<pre>
73 1 Jean-Philippe Lang
PUT /projects/foo/wiki/UsersGuide.xml
74 1 Jean-Philippe Lang
<?xml version="1.0"?>
75 1 Jean-Philippe Lang
<wiki_page>
76 1 Jean-Philippe Lang
  <text>Example</text>
77 1 Jean-Philippe Lang
  <comments>Typo</comments>
78 1 Jean-Philippe Lang
  <version>18</version>
79 1 Jean-Philippe Lang
</issue>
80 1 Jean-Philippe Lang
</pre>
81 1 Jean-Philippe Lang
82 1 Jean-Philippe Lang
This would update the page if its current version is 18, otherwise a @409 Conflict@ error is returned.
83 1 Jean-Philippe Lang
84 1 Jean-Philippe Lang
85 1 Jean-Philippe Lang
+Response+:
86 1 Jean-Philippe Lang
* @200 OK@: page was updated
87 1 Jean-Philippe Lang
* @201 Created@: page was created
88 1 Jean-Philippe Lang
* @409 Conflict@: occurs when trying to update a stale page (see above)
89 1 Jean-Philippe Lang
* @422 Unprocessable Entity@: page was not saved due to validation failures (response body contains the error messages)