Manual:Parameters to Special:Export

Category:'If $wgExportAllowHistory is set to false in LocalSettings.php, only the current version can be exported, not the full history.'

ALL THE CODE IN THIS ARTICLE IS BROKEN. PLEASE FIX IT.
In August 2006, Tim Starling implemented an experimental interface for history paging in Special:Export. He added three new parameters, currently with no user interface. Here is a summary of the available parameters to Special:Export at present, for use with custom clients such as IBM History Flow.


 * pages : A list of page titles, separated by linefeed (%0A) characters.
 * action : Unused; set to "submit" in the export form
 * dir : Should be set to "desc" to retrieve revisions in reverse chronological order. The default, with this parameter omitted, is to retrieve revisions in ascending order of timestamp.
 * offset : The timestamp at which to start, non-inclusive. The timestamp may be in several formats, including the 14-character format usually used by MediaWiki, and an ISO 8601 format like the one output in the XML dumps.
 * limit : The maximum number of revisions to return. If you request more than a site-specific maximum (100 on Wikipedia at present), it will be silently reduced. This limit is cumulative across all the pages specified in the pages parameter, which doesn't make much sense unless you are a programmer. If you request a limit of 100, for two pages with 70 revisions each, you will get 70 from one and 30 from the other. The order is by page_id, pages with lower page_id get more revisions. The reason for this is that Special:Export only ever does one database query per HTTP request. If you want to request all the history of several pages with many revisions each, you have to do it one page at a time.

The dir, offset and limit parameter only work for POST requests. On GET requests, they are ignored: by default, only the current (last) version of each page is returned; if the history parameter is true, then all versions of each page are returned. As an example, the following returns all revisions of a page in spite of the parameter limit=5.

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

The following is an example using the dir, offset and limit parameters. 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 is the next 5:

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, instead we get revisions 6-10. This parameter convention is very similar to the one for UI history pages.

The parameters addcat and catname had been afterwards added. If the boolean parameter addcat is true, then the export form is returned with all members of the category catname added to it. For example, the following is the URL for the edit form with 'XXXX' and all pages in en:Category:Books:

http://en.wikipedia.org/w/index.php?title=Special:Export&addcat&catname=Books&pages=XXXX

All the curl and Python and ruby examples are broken. They retrieve the whole history instead of what they're supposed to. Please fix them, thank you.