As far as I can see in the code of this REST service, when the
document already exist either you overwrite it entirely with what
comes from the XAR (including the history) or you add a new version
but appending the history from the XAR to the history from the
database does not seems to be supported.
You might want to create an improvement issue related to that on
http://jira.xwiki.org.
On Fri, Sep 25, 2015 at 2:53 AM, Ghosh, Amrita <amritg(a)amazon.com> wrote:
Hi,
I am trying to update an existing page (ad new revisions) by uploading XAR using REST
API:
curl -k -u Admin:admin -v -X POST -T "Main.testpage.xar" -H "Content-Type:
application/stream"
https://SERVER/xwiki/rest/wikis/xwiki?history=ADD
I could successfully upload a single new revision to an existing page and that new
revision is correctly showing up on the page history. But I wanted to upload multiple
revisions at a time. For that in the document xml I specified the new revisions inside
<versions> </versions> tag (similar to what we see in the XML of exported page
with history), but that does not work.
Is it possible to add multiple revisions to an existing page with a single XAR upload?
Following are my document xml and package.xml inside the XAR file that I was using:
Main/testpage.xml:
<?xml version='1.0' encoding='UTF-8'?>
<xwikidoc version="1.1">
<web>Main</web>
<name>testpage</name>
<language/>
<defaultLanguage>en</defaultLanguage>
<translation>0</translation>
<creator>XWiki.amritg</creator>
<creationDate>1443041962000</creationDate>
<versions>head 6.1;
access;
symbols;
locks; strict;
6.1
date 2015.09.23.21.11.51; author XWiki.amritg; state full;
branches;
next 5.1;
5.1
date 2015.09.23.21.01.49; author XWiki.amritg; state full;
branches;
next ;
desc
@@
6.1
log
@@
text
@<?xml version="1.0" encoding="UTF-8"?>
<xwikidoc>
<web>Main</web>
<name>testpage</name>
<language></language>
<defaultLanguage>en</defaultLanguage>
<translation>0</translation>
<parent></parent>
<creator>XWiki.amritg</creator>
<author>XWiki.amritg</author>
<customClass></customClass>
<contentAuthor>XWiki.amritg</contentAuthor>
<creationDate>1443041962000</creationDate>
<date>1443042713000</date>
<contentUpdateDate>1443042713000</contentUpdateDate>
<version>6.1</version>
<title>Test Page</title>
<defaultTemplate></defaultTemplate>
<validationScript></validationScript>
<comment></comment>
<minorEdit>false</minorEdit>
<syntaxId>xwiki/2.1</syntaxId>
<hidden>false</hidden>
<content>Update content for 6th
revision</content></xwikidoc>
@
5.1
log
@@
text
@<?xml version="1.0" encoding="UTF-8"?>
<xwikidoc>
<web>Main</web>
<name>testpage</name>
<language></language>
<defaultLanguage>en</defaultLanguage>
<translation>0</translation>
<parent></parent>
<creator>XWiki.amritg</creator>
<author>XWiki.amritg</author>
<customClass></customClass>
<contentAuthor>XWiki.amritg</contentAuthor>
<creationDate>1443041962000</creationDate>
<date>1443042713000</date>
<contentUpdateDate>1443042713000</contentUpdateDate>
<version>5.1</version>
<title>Test Page</title>
<defaultTemplate></defaultTemplate>
<validationScript></validationScript>
<comment></comment>
<minorEdit>false</minorEdit>
<syntaxId>xwiki/2.1</syntaxId>
<hidden>false</hidden>
<content>Update content for 5th
revision</content></xwikidoc>
@
</versions>
<author>XWiki.amritg</author>
<contentAuthor>XWiki.amritg</contentAuthor>
<date>1443042712000</date>
<contentUpdateDate>1443042712000</contentUpdateDate>
<version>6.1</version>
<title>Test Page</title>
<comment/>
<minorEdit>false</minorEdit>
<syntaxId>xwiki/2.1</syntaxId>
<hidden>false</hidden>
<content>Update content for 6th revision</content>
</xwikidoc>
Package.xml:
<?xml version='1.0' encoding='UTF-8'?>
<package>
<infos>
<name>Main.testpage</name>
<description/>
<licence/>
<author/>
<version/>
<backupPack>false</backupPack>
<preserveVersion>true</preserveVersion>
<extensionId/>
</infos>
<files>
<file defaultAction="0"
language="">Main.testpage</file>
</files>
</package>
Thanks,
Amrita
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs
--
Thomas Mortagne