Project

General

Profile

Rest WikiPages » History » Revision 2

Revision 1 (Jean-Philippe Lang, 2012-10-25 23:33) → Revision 2/7 (Jean-Philippe Lang, 2012-10-28 21:22)

h1. Wiki Pages 

 {{>toc}} 

 h2. Getting the pages list of a wiki 

 <pre> 
 GET /projects/foo/wiki/index.xml 
 </pre> 

 Returns the list of all pages in a project wiki. 

 +Response+: 

 <pre> 
 <?xml version="1.0"?> 
 <wiki_pages type="array"> 
   <wiki_page> 
     <title>UsersGuide</title> 
     <version>2</version> 
     <created_on>2008-03-09T12:07:08Z</created_on> 
     <updated_on>2008-03-09T23:41:33+01:00</updated_on> 
   </wiki_page> 
   ... 
 </wiki_pages> 
 </pre> 

 h2. Getting a wiki page 

 <pre> 
 GET /projects/foo/wiki/UsersGuide.xml 
 </pre> 

 Returns the details of a wiki page. 

 +Includable+: 
 * attachments 

 +Response+: 

 <pre> 
 <?xml version="1.0"?> 
 <wiki_page> 
   <title>UsersGuide</title> 
   <parent title="Installation_Guide"/> 
   <text>h1. Users Guide 
   ... 
   ...</text> 
   <version>22</version> 
   <author id="11" name="John Smith"/> 
   <comments>Typo</comments> 
   <created_on>2009-05-18T20:11:52Z</created_on> 
   <updated_on>2012-10-02T11:38:18Z</updated_on> 
 </wiki_page> 
 </pre> 

 h2. Creating or updating a wiki page 

 <pre> 
 PUT /projects/foo/wiki/UsersGuide.xml 
 <?xml version="1.0"?> 
 <wiki_page> 
   <text>Example</text> 
   <comments>Typo</comments> 
 </issue> 
 </pre> 

 Creates or updates a wiki page. 

 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: 

 <pre> 
 PUT /projects/foo/wiki/UsersGuide.xml 
 <?xml version="1.0"?> 
 <wiki_page> 
   <text>Example</text> 
   <comments>Typo</comments> 
   <version>18</version> 
 </issue> 
 </pre> 

 This would update the page if its current version is 18, otherwise a @409 Conflict@ error is returned. 


 +Response+: 
 * @200 OK@: page was updated 
 * @201 Created@: page was created 
 * @409 Conflict@: occurs when trying to update a stale page (see above) 
 * @422 Unprocessable Entity@: page was not saved due to validation failures (response body contains the error messages) 

 h2. Deleting a wiki page 

 <pre> 
 DELETE /projects/foo/wiki/UsersGuide.xml 
 </pre> 

 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. 

 +Response+: 
 * @200 OK@: page was deleted