Last modified by Simon Urli on 2026/10/15 11:40

Show last authors
1 You can [[export content in XAR format>>documentation.xs.admin.exports.export-content-xar-format.WebHome]], but you can also trigger a XAR export by changing the URL of Pages. For example, replacing "/view/" with "/export/", and adding the parameter ##format=xar## will export the entire wiki:
2
3 {{code language="none"}}http://server/xwiki/bin/export/Space/Page?format=xar{{/code}}, where "Space" is considered to be the [[top-level Page>>doc:documentation.xs.user.base.page.nested-pages.relations.WebHome]] of a hierarchy.
4
5 {{version since="18.4.7, 18.9.0RC1"}}Opening such a URL in a browser shows the [["Confirm the Export" page>>doc:documentation.xs.user.exports.export-page.confirm-export.WebHome]], where you confirm the export. A script exports directly by sending the URL as a POST request:{{/version}}
6
7 {{code language="bash"}}
8 curl -X POST -u Admin:admin -o backup.xar "http://server/xwiki/bin/export/Space/Page?format=xar&pages=%25.%25"
9 {{/code}}
10
11 The format of an export pattern is:
12 {{code language="none"}}
13 wikiid:pageFullNamePattern{{/code}}
14
15 * ##wikiid##: the name of the wiki from which to get the wiki Pages. It doesn't need to be specified if you're targeting Pages from the current wiki.
16 * ##pageFullNamePattern##: the full name pattern of the Page is based on an [[SQL "LIKE" comparator>>https://www.techonthenet.com/sql/like.php]]. Remember that the character % must be converted to %25 in a URL.
17
18 The URL parameters to customize the export:
19
20 |=Parameter|=Description|=Example
21 |##pages##|Specifies the Pages to include in the export, using a pattern that matches Page names. You can use multiple Pages parameters, each representing a Page pattern.|##&pages=Main.%25## (Exports all Pages from the Main space)
22 |##excludes##|Specifies the Pages to exclude from the export, using a pattern that matches Page names. Each ##excludes## parameter applies to the ##pages## parameter in the same position, so use an empty ##excludes## to keep the order when only a later ##pages## has exclusions. Several Pages excluded from the same ##pages## go into a **single** ##excludes## value, separated by ##%26##; a Page name that itself contains the ##&## character is encoded ##%2526##.|##&excludes=Main.Space1.%25## (Excludes the Pages under the Main.Space1 space)
23 |##filter##|Restricts the export to the Pages kept by an entity tree filter, named by its component hint. The hint to use is ##installedExtensionDocument##, which leaves out the Pages belonging to an installed [[Extension>>documentation.xs.admin.imports.extensions.WebHome]] that hold no nested content Pages, so that only the content of the wiki is exported. A filter counts as a selection on its own, and combined with ##pages## it applies to the patterns whose Page name is ##%25##.|##&filter=installedExtensionDocument##
24 |##name##|Specifies the name of the exported XAR file. If not specified, ##backup## is used for a whole-wiki export and ##export## for a partial one.|##&name=CustomExport.xar##
25 |##description##|Specifies the description of the XAR export, which can later be viewed when reimporting into an XWiki instance.|##&description=The offices of our company##
26 |##history##|Set to ##true## to also export the [[Page's history>>documentation.xs.user.base.page.view.history-tab.WebHome]].|##&history=true##
27 |##attachment_jrcs##|With ##history=true##, chooses the format of the [[attachment history>>documentation.xs.admin.exports.export-content-xar-format.format-specifications.document-xml.WebHome||anchor="HAttachments"]]. The default ##true## writes the deprecated JRCS ##versions## element, which an XWiki older than ##12.0## can read; ##false## writes the ##revisions## element instead, which is what the "Target XWiki version" setting of the [[Administration export>>documentation.xs.admin.exports.export-content-xar-format.WebHome]] sends.|##&attachment_jrcs=false##
28 |##backup##|Set to ##true## to mark the archive as a backup package, so that the XWiki Page [[author>>documentation.xs.user.base.page.authors.WebHome]] of each Page remains the same as when exported, when reimported into an XWiki instance.|##&backup=true##
29 |##author##|Specifies the author's name in the XAR export, which can later be viewed when reimporting into an XWiki instance.|##&author=John Smith##
30 |##licence##|Specifies the license for the XAR export, which can later be viewed when reimporting into an XWiki instance. The parameter uses the British spelling, matching the ##licence## element of the [[##package.xml## descriptor>>documentation.xs.admin.exports.export-content-xar-format.format-specifications.WebHome]]; the American spelling is ignored.|##&licence=GPL##
31 |##version##|Specifies the version of the export to the XAR.|##&version=1.0##
32
33 Examples of how to use the parameters:
34
35 * Exports all Pages in the current wiki:(((
36 {{code language="none"}}
37 http://server/xwiki/bin/export/Space/Page?format=xar&pages=%25.%25
38 {{/code}}
39 )))
40 * Exports the Pages ##Main.WebHome## and ##Blog.WebHome##:(((
41 {{code language="none"}}
42 http://server/xwiki/bin/export/Space/Page?format=xar&pages=Main.WebHome&pages=Blog.WebHome
43 {{/code}}
44 )))
45 * Exports all Pages in the ##Main## space except Pages under ##Main.Space1## space, and all Pages under ##Other## space:(((
46 {{code language="none"}}
47 http://server/xwiki/bin/export/Space/Page?format=xar&pages=Main.%25&excludes=Main.Space1.%25&pages=Other.%25
48 {{/code}}
49 )))
50 * Exports all Pages in the ##subwiki:Main## space except a Page named ##subwiki:Main.Excluded&Other## and ##subwiki:Main.WebHome##. Both exclusions belong to the same ##pages## parameter, so they are one ##excludes## value joined by ##%26##, and the ##&## of the first Page name is encoded ##%2526##:(((
51 {{code language="none"}}
52 http://server/xwiki/bin/export/Space/Page?format=xar&pages=subwiki:Main.%25&excludes=subwiki%3AMain.Excluded%2526Other%26subwiki%3AMain.WebHome
53 {{/code}}
54 )))
55 * Exports all Pages in the ##Main## space and all in the ##Other## space except ##Other.Excluded## (see the empty excludes for respecting the order):(((
56 {{code language="none"}}
57 http://server/xwiki/bin/export/Space/Page?format=xar&pages=Main.%25&excludes=&pages=Other.%25&excludes=Other.Excluded
58 {{/code}}
59 )))
60 * Exports the whole wiki without the Pages that came with an installed Extension:(((
61 {{code language="none"}}
62 http://server/xwiki/bin/export/Space/Page?format=xar&filter=installedExtensionDocument
63 {{/code}}
64 )))

Get Connected