<
From version < 40.6 >
edited by Manuel Smeria
on 2012/11/30
To version < 40.7 >
edited by Manuel Smeria
on 2012/11/30
>
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -16,9 +16,9 @@
16 16  
17 17  All the resource references described in the [[XWiki RESTful API Documentation>>#HXWikiRESTfulAPIDocumentation]] should be intended relative to this URL.
18 18  
19 -For example the ##/wikis## resources on a server running on ##localhost## on port ##8080## can be retrieved using the following URL : ##http:~//localhost:8080/xwiki/rest/wikis##
19 +For example the ##/wikis## resources on a server running on ##localhost## on port ##8080## can be retrieved using the following URL : ##http:~/~/localhost:8080/xwiki/rest/wikis##
20 20  
21 -In addition to retrieving content in XML format, you can also retrieve it in JSON format by adding the parameter ##?media=json## in the URL. For example: ##http:~//localhost:8080/xwiki/rest/wikis?media=json##
21 +In addition to retrieving content in XML format, you can also retrieve it in JSON format by adding the parameter ##?media=json## in the URL. For example: ##http:~/~/localhost:8080/xwiki/rest/wikis?media=json##
22 22  
23 23  = Dataset =
24 24  
... ... @@ -199,7 +199,7 @@
199 199  
200 200  As said before, it could be useful to send information by using browser's XmlHttpRequest objects. However, currently many browsers only support GET and POST methods, so it is impossible to send, for example, PUT requests. In order to overcome this limitation you can override the HTTP Method by specifying a ##method## parameter in the URI query string.
201 201  
202 -In the previous example, if you send a POST request to the ##http:~//localhost:8080/xwiki/rest/wikis/xwiki/spaces/Main/pages/NewPage?method=PUT## it will be interpreted as if it were an actual PUT request.
202 +In the previous example, if you send a POST request to the ##http:~/~/localhost:8080/xwiki/rest/wikis/xwiki/spaces/Main/pages/NewPage?method=PUT## it will be interpreted as if it were an actual PUT request.
203 203  
204 204  This overriding mechanism allows the interaction with the XWiki RESTful API by using any kind of browser.
205 205  
... ... @@ -232,7 +232,7 @@
232 232  ** **Status codes:**
233 233  *** 200: If the request was successful.
234 234  
235 -=== /syntaxes
235 +=== /syntaxes ===
236 236  
237 237  * **HTTP Method:** GET
238 238  ** **Media types:**
... ... @@ -250,7 +250,7 @@
250 250  ** **Status codes:**
251 251  *** 200: If the request was successful.
252 252  
253 -=== /wikis/query?q~={query}&wikis~=wikiList~[&distinct~={true,false}]~[&order~={asc,desc}]~[&start~=n][&number~=n]~[&prettyNames~={true,false}]~[&className~=className]
253 +=== /wikis/query?q~={query}&wikis~=wikiList[&distinct~={true,false}][&order~={asc,desc}][&start~=n][&number~=n][&prettyNames~={true,false}][&className~=className] ===
254 254  
255 255  * **HTTP Method:** GET
256 256  ** **Media types:**
... ... @@ -259,7 +259,7 @@
259 259  ** **Status codes:**
260 260  *** 200: If the request was successful.
261 261  
262 -=== /wikis/{wikiName}
262 +=== /wikis/{wikiName} ===
263 263  
264 264  * **HTTP Method:** GET
265 265  ** **Media types:**
... ... @@ -280,7 +280,7 @@
280 280  ** **Status codes:**
281 281  *** 200: If the request was successful.
282 282  
283 -=== /wikis/{wikiName}/search?q~={keywords}~[~[&scope~={name,content,title,objects}...]&start~=n]~[&number~=n]~[&orderField~=field&order~={asc,desc}]~[distinct~={true,false}]~[&prettyNames~={true,false}] ===
283 +=== /wikis/{wikiName}/search?q~={keywords}~[~[&scope~={name,content,title,objects}...]&start~=n][&number~=n][&orderField~=field&order~={asc,desc}][distinct~={true,false}][&prettyNames~={true,false}] ===
284 284  
285 285  * **HTTP Method:** GET
286 286  ** **Media types:**
... ... @@ -289,7 +289,7 @@
289 289  ** **Status codes:**
290 290  *** 200: If the request was successful.
291 291  
292 -=== /wikis/{wikiName}/query?q~={query}&type~={hql,xwql,lucene}~[&distinct~={true,false}]~~[&order~={asc,desc}]~[&start~=n][&number~=n]~[&prettyNames~={true,false}]~[&className~=className]
292 +=== /wikis/{wikiName}/query?q~={query}&type~={hql,xwql,lucene}[&distinct~={true,false}]~~[&order~={asc,desc}][&start~=n][&number~=n][&prettyNames~={true,false}][&className~=className] ===
293 293  
294 294  * **HTTP Method:** GET
295 295  ** **Media types:**
... ... @@ -298,7 +298,7 @@
298 298  ** **Status codes:**
299 299  *** 200: If the request was successful.
300 300  
301 -=== /wikimanager (This resource is only available when using XWiki Enterprise Manager)
301 +=== /wikimanager (This resource is only available when using XWiki Enterprise Manager) ===
302 302  
303 303  * **HTTP Method:** POST
304 304  ** **Accepted Media types:**
... ... @@ -931,6 +931,7 @@
931 931  This means that all the information about resources, i.e., URI Paths, supported methods, query parameters, and so on, are available to module developers without having to include the big REST Server module.
932 932  
933 933  Clients willing to access/use the REST API can then declare a dependency on xwiki-platform-rest-api and have all this information available for interacting with it. There are two use cases for this:
934 +
934 934  * Another platform module that wants to generate responses with links to existing resources.
935 935  * HTTP clients that wants to make requests to the RESTful API.
936 936  
... ... @@ -940,7 +940,7 @@
940 940  
941 941  == Highlevel description and tutorial for a basic usage of the RESTful API ==
942 942  
943 -See this [[tutorial>>http://blog.fabio.mancinelli.me/2011/03/07/XWikis_RESTful_API.html]] by Fabio Mancinelli.
944 +See [[this tutorial>>http://blog.fabio.mancinelli.me/2011/03/07/XWikis_RESTful_API.html]] by Fabio Mancinelli.
944 944  
945 945  == Creating an XWiki Object ==
946 946  
... ... @@ -1001,11 +1001,11 @@
1001 1001  
1002 1002  The advantage of the second approach is that curl will take care of url-encode your content, while if you send a file you are responsible for this.
1003 1003  
1004 -=== Remarks:
1005 +=== Remarks: ===
1005 1005  
1006 -* In the ##application/x-www-form-urlencoded## format the "property#" is a standard immutable prefix that is used to distinguish attributes referring to property values from the attributes referring to the object. For example if we had ##className=XYZ&Text=FOO## we would have had an ambiguity on ##className## because we couldn't understand if ##className## is a property of the object to be set to XYZ or an attribute that describes the object itself (i.e., its metadata like the ##className##). By having the ##property~### prefix this ambiguity is resolved.
1007 +* In the ##application/x-www-form-urlencoded## format the "property#" is a standard immutable prefix that is used to distinguish attributes referring to property values from the attributes referring to the object. For example if we had ##className=XYZ&Text=FOO## we would have had an ambiguity on ##className## because we couldn't understand if ##className## is a property of the object to be set to XYZ or an attribute that describes the object itself (i.e., its metadata like the ##className##). By having the ##property### prefix this ambiguity is resolved.
1007 1007  
1008 1008  * The information you get back when you retrieve an object (i.e., all
1009 1009  the ##<attribute>## elements) are useful when clients need to understand the type of data contained in an object (e.g., when they want to display it). They are not necessary when creating an object because the system already has this information. That's why the XML to be sent is smaller. Actually the only information needed is the ##<className>## and a set of ##<property name="..."><value>## elements.
1010 1010  
1011 -* How do you know what kind of information you can send with the XML? You can discover it by using the class description URI. If you go to ##http:~//localhost:8080/xwiki/rest/wikis/xwiki/classes ## you will get a list of all the classes defined in the Wiki. By looking at this you will understand what are the properties defined by each class, their types and attributes. In that way you will know what you're allowed to put in the ##<property><value>## elements of the XML you send.
1012 +* How do you know what kind of information you can send with the XML? You can discover it by using the class description URI. If you go to ##http:~/~/localhost:8080/xwiki/rest/wikis/xwiki/classes ## you will get a list of all the classes defined in the Wiki. By looking at this you will understand what are the properties defined by each class, their types and attributes. In that way you will know what you're allowed to put in the ##<property><value>## elements of the XML you send.

Get Connected