On Thu, Oct 20, 2011 at 1:17 PM, Thomas Mortagne
<[email protected]> wrote:
> Hi devs,
>
> The idea is to provide the quickest possible way to programmatically
> import a xar on a wiki from outside. Right now you have to attach the
> file using REST and then call the import action.
>
> The vote is actually not that much on the idea itself I think but more
> on the API.
>
> So her is the proposal:
>
> /wikis/{wikiName}/import?backup=true/false&history=add/reset/replace
>
> The parameters of the URL are the options you can find in the UI.
> the resource return void which mean either OK or an exception if it
> failed for any reason.
>
> WDYT ?
>
> Here is my +1.
>
I am +0.5...

...I wonder if it's more clean to add the support for a PUT and/or
POST action on the /wikis/{wikiName} resource that accepts a XAR as
the payload.
The problem would be how to specify the parameters (i.e., backup,
history) One solution would be to have the data sent as a
multipart/form-data where the first part is a descriptor containing
the parameters (in an application/x-www-form-urlencoded format) and
the second part is the XAR to be imported.

The support for PUT/POST could allow us to specify the semantics of
the request: a POST of a XAR would be equivalent to an upgrade of the
wiki. A PUT of a XAR would be a "reset" of the wiki to the sent XAR.

The nice thing of this approach is that you can model the
creation/upgrade/reset on the fly of new Wikis (if this is supported)
by just PUTting/POSTing a XAR to a given URL, as we currently do with
pages.

Of course we could support a DELETE action as well, always on the
/wikis/{wikiName} resource.

Finally XAR export could be done by issuing a GET request with an
"Accept: application/vnd.xwiki.xar" header, always on
/wikis/{wikiName} resource.

Of course this is a lot of work wrt what Thomas proposed but it could
be worth to think about it.

-Fabio
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to