Changes for page REST API

Last modified by Thomas Mortagne on 2024/03/12

<
From version < 37.8 >
edited by DanJones
on 2012/08/17
To version < 38.3 >
edited by Fabio Mancinelli
on 2012/11/07
>
Change comment: There is no comment for this version

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.DanJones
1 +XWiki.fmancinelli
Content
... ... @@ -250,15 +250,68 @@
250 250  ** **Status codes:**
251 251  *** 200: If the request was successful.
252 252  
253 -=== /wikis/{wikiName}/search?q~={keywords}~[~[&scope~={name,content,title,objects}...]&number~=n] ===
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:**
257 257  *** application/xml (SearchResults element)
258 +** **Description:** Search resources (pages and attachments) using a Lucene query (handled by the [[Lucene Plugin>>extensions:Extension.Lucene Plugin]]) on the wikis that are specified as a comma separated list in the //wikis// parameter. If //className// is specified, the result will also contain the data for the first object of the corresponding class.
259 +** **Status codes:**
260 +*** 200: If the request was successful.
261 +
262 +=== /wikis/{wikiName}
263 +
264 +* **HTTP Method:** GET
265 +** **Media types:**
266 +*** application/xml (Wiki element)
267 +** **Description:** information about the wiki
268 +** **Status codes:**
269 +*** 200: If the request was successful.
270 +
271 +* **HTTP Method:** POST
272 +** **Accepted Media types:**
273 +*** octet/stream (A XAR file)
274 +** **Media types:**
275 +*** application/xml (Wiki element)
276 +** **Query parameters**
277 +*** backup={true/false} - import XAR as a backup XAR
278 +*** history={RESET/REPLACE/ADD} - history importing
279 +** **Description:** import a XAR in a wiki.
280 +** **Status codes:**
281 +*** 200: If the request was successful.
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}] ===
284 +
285 +* **HTTP Method:** GET
286 +** **Media types:**
287 +*** application/xml (SearchResults element)
258 258  ** **Description:** The list of pages and objects that contain the {keywords} in the specified {scope}s. Multiple scopes can be specified. Search results are relative to the whole {wikiName}
259 259  ** **Status codes:**
260 260  *** 200: If the request was successful.
261 261  
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 +
294 +* **HTTP Method:** GET
295 +** **Media types:**
296 +*** application/xml (SearchResults element)
297 +** **Description:** Allow to execute HQL, XWQL or Lucene queries on the given {wikiName}. The //q// parameter contains the corresponding query. See [[HQL Query Examples in Velocity>>platform:DevGuide.velocityHqlExamples]], [[XWiki Query Language Specification>>dev:Design.XWiki Query Language Specification]] and [[Lucene Plugin>>extensions:Extension.Lucene Plugin]] examples of the queries that can be specified in this parameter. If //className// is specified, the result will also contain the data for the first object of the corresponding class.
298 +** **Status codes:**
299 +*** 200: If the request was successful.
300 +
301 +=== /wikimanager (This resource is only available when using XWiki Enterprise Manager)
302 +
303 +* **HTTP Method:** POST
304 +** **Accepted Media types:**
305 +*** application/xml (Wiki element)
306 +** **Media types:**
307 +*** application/xml (Wiki element)
308 +** **Query parameters**
309 +*** template - the wiki template to be used for initializing the wiki.
310 +*** history={RESET/REPLACE/ADD} - history importing
311 +** **Description:** create a new wiki.
312 +** **Status codes:**
313 +*** 200: If the request was successful.
314 +
262 262  == Space resources ==
263 263  
264 264  === /wikis/{wikiName}/spaces[?start~=offset&number~=n] ===
... ... @@ -947,5 +947,3 @@
947 947  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.
948 948  
949 949  * 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.
950 -
951 -
XWiki.XWikiComments[2]
Date
... ... @@ -1,1 +1,1 @@
1 -2012-08-17 14:54:01.619
1 +2012-08-17 14:54:01.0
XWiki.XWikiComments[3]
Author
... ... @@ -1,0 +1,1 @@
1 +xwiki:XWiki.DanJones
Comment
... ... @@ -1,0 +1,9 @@
1 +In Eclipse, you can right click on an xsd file, like the xsd for the REST api [[described here>>XWikiRESTfulAPI#HXWikiRESTfulAPIDocumentation]], and choose "Generate->JAXB classes".
2 +
3 +Whatever package that you choose to generate them in, you would use in the
4 +{{code language="java"}}
5 +context = JAXBContext.newInstance("org");
6 +{{/code}}
7 + In the examples I gave, I just generated them under a package called "org", mostly due to extreme laziness. So I ended up with org.Page, org.ObjectFactory, org.Space and so on.
8 +
9 +
Date
... ... @@ -1,0 +1,1 @@
1 +2012-08-17 15:05:15.0

Get Connected