[xwiki-devs] REST API usage

Fabio Mancinelli fabio.mancinelli at xwiki.com
Thu Mar 10 15:32:56 UTC 2011

On Thu, Mar 10, 2011 at 4:14 PM, Guillaume Lerouge <guillaume at xwiki.com> wrote:
> Side topic: I'll get some feedback tomorrow from an XWiki users and how
> they're using the REST API to expose XWiki data in a portal.
> Here's some of the feedback I got:
>   - When retrieving the content of a page from REST, we get source content
>   (wiki syntax) -> il would be nice to be able to get HTML-rendered content
>   too
Indeed. This is just a matter of extending the API to "accept" other
content type.
Currently only XML and JSON are supported.

So for example if you do a

$ curl http://localhost:8080/xwiki/rest/wikis/xwiki/spaces/Main/pages/WebHome

you will get an XML representation of Main.WebHome

doing a

$ curl -H "Accept: application/json"

will give you a JSON representation.

In the future we might think of having

$ curl -H "Accept: text/html" ... -> Page rendered in HTML
$ curl -H "Accept: application/pdf" ... -> Page rendered in PDF

This is not that hard to implement, though I remember that there was a
bug in RestLet concerning "accept" variants that I hope it has been

>   - We'd need to provide some high-level services from REST -> for instance
>   a REST resource that sends back the whole arborescence of the wiki (right
>   now you have to retrieve every space, then every page of every space one by
>   one)
Well, navigating and discovering resources is one of the fundamental
principle behind a REST API :)
Anyway I understand the need.

Again, this can be done quite easily and the result can be a document
with links to all (or a subset of) the resources exposed through the
This can be quite heavy from a computational point of view, above all
if you are dealing with huge wikis (a lot of pages and spaces).
Nothing that couldn't be solved by imposing some limits and a smart
pagination mechanism.


> Guillaume
> On Thu, Mar 10, 2011 at 16:10, Fabio Mancinelli
> <fabio.mancinelli at xwiki.com>wrote:
>> Hi everybody,
>> I was wondering in which XWiki subsystems the REST API is used in a direct
>> way.
>> I know that it is used in different place but I don't have a clear vision.
>> Could you please tell me where are you using it?
>> Thanks,
>> Fabio
>> _______________________________________________
>> devs mailing list
>> devs at xwiki.org
>> http://lists.xwiki.org/mailman/listinfo/devs
> _______________________________________________
> devs mailing list
> devs at xwiki.org
> http://lists.xwiki.org/mailman/listinfo/devs

More information about the devs mailing list