Project

General

Profile

Rest WikiPages » History » Version 1

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

1 1 Jean-Philippe Lang
h1. Wiki Pages
2
3
{{>toc}}
4
5
h2. Getting the pages list of a wiki
6
7
<pre>
8
GET /projects/foo/wiki/index.xml
9
</pre>
10
11
Returns the list of all pages in a project wiki.
12
13
+Response+:
14
15
<pre>
16
<?xml version="1.0"?>
17
<wiki_pages type="array">
18
  <wiki_page>
19
    <title>UsersGuide</title>
20
    <version>2</version>
21
    <created_on>2008-03-09T12:07:08Z</created_on>
22
    <updated_on>2008-03-09T23:41:33+01:00</updated_on>
23
  </wiki_page>
24
  ...
25
</wiki_pages>
26
</pre>
27
28
h2. Getting a wiki page
29
30
<pre>
31
GET /projects/foo/wiki/UsersGuide.xml
32
</pre>
33
34
Returns the details of a wiki page.
35
36
+Includable+:
37
* attachments
38
39
+Response+:
40
41
<pre>
42
<?xml version="1.0"?>
43
<wiki_page>
44
  <title>UsersGuide</title>
45
  <parent title="Installation_Guide"/>
46
  <text>h1. Users Guide
47
  ...
48
  ...</text>
49
  <version>22</version>
50
  <author id="11" name="John Smith"/>
51
  <comments>Typo</comments>
52
  <created_on>2009-05-18T20:11:52Z</created_on>
53
  <updated_on>2012-10-02T11:38:18Z</updated_on>
54
</wiki_page>
55
</pre>
56
57
h2. Creating or updating a wiki page
58
59
<pre>
60
PUT /projects/foo/wiki/UsersGuide.xml
61
<?xml version="1.0"?>
62
<wiki_page>
63
  <text>Example</text>
64
  <comments>Typo</comments>
65
</issue>
66
</pre>
67
68
Creates or updates a wiki page.
69
70
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
72
<pre>
73
PUT /projects/foo/wiki/UsersGuide.xml
74
<?xml version="1.0"?>
75
<wiki_page>
76
  <text>Example</text>
77
  <comments>Typo</comments>
78
  <version>18</version>
79
</issue>
80
</pre>
81
82
This would update the page if its current version is 18, otherwise a @409 Conflict@ error is returned.
83
84
85
+Response+:
86
* @200 OK@: page was updated
87
* @201 Created@: page was created
88
* @409 Conflict@: occurs when trying to update a stale page (see above)
89
* @422 Unprocessable Entity@: page was not saved due to validation failures (response body contains the error messages)