Change comment:
There is no comment for this version
Summary
-
Page properties (3 modified, 0 added, 0 removed)
Details
- Page properties
-
- Title
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki RESTful API 1 +The XWiki RESTful API - Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki. SilviaRusu1 +XWiki.jvelociter - Content
-
... ... @@ -1,5 +1,11 @@ 1 -= The XWiki RESTful API = 1 +{{velocity}}{{html wiki=true}} 2 +#startfloatingbox() 3 +**Contents:** 2 2 5 +{{toc start=2/}} 6 +#endfloatingbox() 7 +{{/html}}{{/velocity}} 8 + 3 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 4 5 5 == Dataset == ... ... @@ -68,7 +68,7 @@ 68 68 69 69 If you use this approach (Apache HTTP Client + JAXB) you will find yourself writing some code like this: 70 70 71 -{{code}} 77 +{{code language="none"}} 72 72 HttpClient httpClient = new HttpClient(); 73 73 JAXBContext context = JAXBContext.newInstance("model.package"); 74 74 unmarshaller = context.createUnmarshaller(); ... ... @@ -86,7 +86,7 @@ 86 86 87 87 By using curl, the previous example would have been: 88 88 89 -{{code}} 95 +{{code language="none"}} 90 90 $ curl http://localhost:8080/xwiki/rest/wikis/xwiki/spaces/Main/pages/WebHome 91 91 <?xml version="1.0" encoding="UTF-8" standalone="yes"?> 92 92 <page xmlns="http://www.xwiki.org"> ... ... @@ -105,7 +105,7 @@ 105 105 106 106 So if you have, let's say a Main.PrivatePage, and you try to do: 107 107 108 -{{code}} 114 +{{code language="none"}} 109 109 $ curl -v http://localhost:8080/xwiki/rest/wikis/xwiki/spaces/Main/pages/PrivatePage 110 110 ... 111 111 < HTTP/1.1 401 Unauthorized ... ... @@ -116,7 +116,7 @@ 116 116 117 117 On the contrary, by specifying Admin credentials you gain access to the actual page: 118 118 119 -{{code}} 125 +{{code language="none"}} 120 120 $ curl -u Admin:admin http://localhost:8080/xwiki/rest/wikis/xwiki/spaces/Main/pages/PrivatePage 121 121 <?xml version="1.0" encoding="UTF-8" standalone="yes"?> 122 122 <page xmlns="http://www.xwiki.org"> ... ... @@ -135,7 +135,7 @@ 135 135 136 136 For example, in order to create a page you might do the following: 137 137 138 -{{code}} 144 +{{code language="none"}} 139 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 140 <?xml version="1.0" encoding="UTF-8" standalone="yes"?> 141 141 <page xmlns="http://www.xwiki.org"> ... ... @@ -154,7 +154,7 @@ 154 154 155 155 Where newpage.xml is an XML file containing 156 156 157 -{{code}} 163 +{{code language="none"}} 158 158 <?xml version="1.0" encoding="UTF-8" standalone="yes"?> 159 159 <page xmlns="http://www.xwiki.org"> 160 160 <title>Hello world</title>