Manual:Parameters to Special:Export

Wiki pages can be exported in a special XML format to upload import into another MediaWiki installation (if this function is enabled on the destination wiki, and the user is a sysop there) or use it elsewise for instance for analysing the content. See also Syndication feeds for exporting other information but pages and Help:Import on importing pages. See Help:Export for more details.

Available parameters
Below is the list of available parameters for Special:Export as of version 1.16. Not all of these are available through the Special:Export UI.

URL parameter requests do not work
The,   and   parameters only work for POST requests. GET requests through a URL are ignored.

When you use the URL as in a browser, you are submitting via GET. In the ruby script, you are using POST.

As an example, the following parameter request does not work, it returns all revisions of a page despite the parameter limit=5.

http://en.wikipedia.org/w/index.php?title=Special:Export&pages=XXXX&offset=1&limit=5&action=submit

Retrieving earliest 5 revisions
A POST request is generated by cURL when passing. The following retrieves the earliest 5 revisions from the English Wikipedia main page:

curl -d "" 'http://en.wikipedia.org/w/index.php?title=Special:Export&pages=Main_Page&offset=1&limit=5&action=submit'

And here are the next 5 revisions:

curl -d "" 'http://en.wikipedia.org/w/index.php?title=Special:Export&pages=Main_Page&offset=2002-01-27T20:25:56Z&limit=5&action=submit'

Here the timestamp from the last revision of the previous query is copied into the offset field of the URL. Because the offset field is non-inclusive, that 5th revision is not displayed again, and instead we get revisions 6-10.

A more explicit example, especially if you also want to save the darn thing, would be curl -d "&pages=Main_Page&offset=1&action=submit" http://en.wikipedia.org/w/index.php?title=Special:Export -o "somefilename.txt" The URL root needs to follow the MediaWiki parameters... also, note the fact that you need to add the curl parameters at the end for saving the file as something. Otherwise it will just scroll on your screen and nothing will be saved.

Stopping the export of your Mediawiki
If $wgExportAllowHistory is set to false in LocalSettings.php, only the current version can be exported, not the full history.

By default with GET requests, only the current (last) version of each page is returned.

If the $wgExportAllowHistory parameter is true in LocalSettings.php, and the "Include only the current revision, not the full history" is unchecked, then all versions of each page are returned.