MediaWiki API help
This is an auto-generated MediaWiki API documentation page.
Documentation and examples: https://www.mediawiki.org/wiki/API
action=compare
- This module requires read rights.
- Source: MediaWiki
- License: GPL-2.0-or-later
Get the difference between two pages.
A revision number, a page title, a page ID, text, or a relative reference for both "from" and "to" must be passed.
- fromtitle
First title to compare.
- fromid
First page ID to compare.
- Type: integer
- fromrev
First revision to compare.
- Type: integer
- fromslots
Override content of the revision specified by fromtitle, fromid or fromrev.
This parameter specifies the slots that are to be modified. Use fromtext-{slot}, fromcontentmodel-{slot}, and fromcontentformat-{slot} to specify content for each slot.
- Values (separate with | or alternative): main
- fromtext-{slot}
Text of the specified slot. If omitted, the slot is removed from the revision.
- This is a templated parameter. When making the request, {slot} in the parameter's name should be replaced with values of fromslots.
- fromsection-{slot}
When fromtext-{slot} is the content of a single section, this is the section number. It will be merged into the revision specified by fromtitle, fromid or fromrev as if for a section edit.
- This is a templated parameter. When making the request, {slot} in the parameter's name should be replaced with values of fromslots.
- fromcontentformat-{slot}
Content serialization format of fromtext-{slot}.
- This is a templated parameter. When making the request, {slot} in the parameter's name should be replaced with values of fromslots.
- One of the following values: application/json, text/plain, text/x-wiki, text/javascript, text/css
- fromcontentmodel-{slot}
Content model of fromtext-{slot}. If not supplied, it will be guessed based on the other parameters.
- This is a templated parameter. When making the request, {slot} in the parameter's name should be replaced with values of fromslots.
- One of the following values: GadgetDefinition, Scribunto, wikitext, javascript, json, css, text
- frompst
Do a pre-save transform on fromtext-{slot}.
- Type: boolean (details)
- fromtext
- Deprecated.
Specify fromslots=main and use fromtext-main instead.
- fromcontentformat
- Deprecated.
Specify fromslots=main and use fromcontentformat-main instead.
- One of the following values: application/json, text/plain, text/x-wiki, text/javascript, text/css
- fromcontentmodel
- Deprecated.
Specify fromslots=main and use fromcontentmodel-main instead.
- One of the following values: GadgetDefinition, Scribunto, wikitext, javascript, json, css, text
- fromsection
- Deprecated.
Only use the specified section of the specified 'from' content.
- totitle
Second title to compare.
- toid
Second page ID to compare.
- Type: integer
- torev
Second revision to compare.
- Type: integer
- torelative
Use a revision relative to the revision determined from fromtitle, fromid or fromrev. All of the other 'to' options will be ignored.
- One of the following values: prev, next, cur
- toslots
Override content of the revision specified by totitle, toid or torev.
This parameter specifies the slots that are to be modified. Use totext-{slot}, tocontentmodel-{slot}, and tocontentformat-{slot} to specify content for each slot.
- Values (separate with | or alternative): main
- totext-{slot}
Text of the specified slot. If omitted, the slot is removed from the revision.
- This is a templated parameter. When making the request, {slot} in the parameter's name should be replaced with values of toslots.
- tosection-{slot}
When totext-{slot} is the content of a single section, this is the section number. It will be merged into the revision specified by totitle, toid or torev as if for a section edit.
- This is a templated parameter. When making the request, {slot} in the parameter's name should be replaced with values of toslots.
- tocontentformat-{slot}
Content serialization format of totext-{slot}.
- This is a templated parameter. When making the request, {slot} in the parameter's name should be replaced with values of toslots.
- One of the following values: application/json, text/plain, text/x-wiki, text/javascript, text/css
- tocontentmodel-{slot}
Content model of totext-{slot}. If not supplied, it will be guessed based on the other parameters.
- This is a templated parameter. When making the request, {slot} in the parameter's name should be replaced with values of toslots.
- One of the following values: GadgetDefinition, Scribunto, wikitext, javascript, json, css, text
- topst
Do a pre-save transform on totext.
- Type: boolean (details)
- totext
- Deprecated.
Specify toslots=main and use totext-main instead.
- tocontentformat
- Deprecated.
Specify toslots=main and use tocontentformat-main instead.
- One of the following values: application/json, text/plain, text/x-wiki, text/javascript, text/css
- tocontentmodel
- Deprecated.
Specify toslots=main and use tocontentmodel-main instead.
- One of the following values: GadgetDefinition, Scribunto, wikitext, javascript, json, css, text
- tosection
- Deprecated.
Only use the specified section of the specified 'to' content.
- prop
Which pieces of information to get.
- diff
- The diff HTML.
- diffsize
- The size of the diff HTML, in bytes.
- rel
- The revision IDs of the revision previous to 'from' and after 'to', if any.
- ids
- The page and revision IDs of the 'from' and 'to' revisions.
- title
- The page titles of the 'from' and 'to' revisions.
- user
- The user name and ID of the 'from' and 'to' revisions.
- comment
- The comment on the 'from' and 'to' revisions.
- parsedcomment
- The parsed comment on the 'from' and 'to' revisions.
- size
- The size of the 'from' and 'to' revisions.
- Values (separate with | or alternative): diff, diffsize, rel, ids, title, user, comment, parsedcomment, size
- Default: diff|ids|title
- slots
Return individual diffs for these slots, rather than one combined diff for all slots.
- Values (separate with | or alternative): main
- To specify all values, use *.
- Create a diff between revision 1 and 2.
- api.php?action=compare&fromrev=1&torev=2 [open in sandbox]
Debug data:
[SQLBagOStuff] MainObjectStash using store ReplicatedBagOStuff
[objectcache] MainWANObjectCache using store EmptyBagOStuff
IP: 18.223.239.15
Start request GET /mediawiki/api.php?action=help&modules=compare
HTTP HEADERS:
CONTENT-TYPE:
CONTENT-LENGTH: 0
USER-AGENT: Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
REFERER: https://zero-k.info/mediawiki/Special:ApiHelp/compare
HOST: zero-k.info
ACCEPT-ENCODING: gzip, br, zstd, deflate
ACCEPT: */*
CONNECTION: close[localisation] LocalisationCache: using store LCStoreDB
[session] SessionManager using store SqlBagOStuff
[DBReplication] Cannot use ChronologyProtector with EmptyBagOStuff
[DBReplication] Wikimedia\Rdbms\LBFactory::getChronologyProtector: request info {
"IPAddress": "18.223.239.15",
"UserAgent": "Mozilla\/5.0 AppleWebKit\/537.36 (KHTML, like Gecko; compatible; ClaudeBot\/1.0; +claudebot@anthropic.com)",
"ChronologyProtection": false,
"ChronologyPositionIndex": 0,
"ChronologyClientId": false
}[DBConnection] Wikimedia\Rdbms\LoadBalancer::lazyLoadReplicationPositions: executed chronology callback.
[DBConnection] Wikimedia\Rdbms\LoadBalancer::getLocalConnection: connected to database 0 at 'localhost'.
[SQLBagOStuff] Connection mysql object #127 (handle id #121) will be used for SqlBagOStuff
[session] SessionBackend "qgiiomt3gklg3mjjsfvc90ce7tkf6g5f" is unsaved, marking dirty in constructor
[session] SessionBackend "qgiiomt3gklg3mjjsfvc90ce7tkf6g5f" save: dataDirty=1 metaDirty=1 forcePersist=0
[cookie] already deleted setcookie: "wikidb229_mw__session", "", "1715249699", "/", "", "", "1"
[cookie] already deleted setcookie: "wikidb229_mw_UserID", "", "1715249699", "/", "", "", "1"
[cookie] already deleted setcookie: "wikidb229_mw_Token", "", "1715249699", "/", "", "", "1"
[cookie] already deleted setcookie: "forceHTTPS", "", "1715249699", "/", "", "", "1"
[DBConnection] Wikimedia\Rdbms\LoadBalancer::getLocalConnection: connected to database 0 at 'localhost'.
[MessageCache] MessageCache using store SqlBagOStuff
[SQLBagOStuff] Connection mysql object #127 (handle id #121) will be used for SqlBagOStuff
[SQLBagOStuff] Connection mysql object #127 (handle id #121) will be used for SqlBagOStuff
[SQLBagOStuff] Connection mysql object #127 (handle id #121) will be used for SqlBagOStuff
[SQLBagOStuff] Connection mysql object #127 (handle id #121) will be used for SqlBagOStuff
[DBQuery] Wikimedia\Rdbms\DatabaseMysqlBase::lock failed to acquire lock 'wikidb229-mw_:messages:en'
[SQLBagOStuff] SqlBagOStuff::lock failed due to timeout for wikidb229-mw_:messages:en.
[MessageCache] MessageCache::load: Loading en... local cache is empty, global cache is expired/volatile, loading from database, could not acquire main lock, using stale cache
ParserFactory: using preprocessor: Preprocessor_Hash
Unstubbing $wgLang on call of $wgLang::_unstub from ParserOptions->__construct
[ContentHandler] Created handler for GadgetDefinition: GadgetDefinitionContentHandler
[ContentHandler] Created handler for Scribunto: ScribuntoContentHandler
[ContentHandler] Created handler for wikitext: WikitextContentHandler
[ContentHandler] Created handler for javascript: JavaScriptContentHandler
[ContentHandler] Created handler for json: JsonContentHandler
[ContentHandler] Created handler for css: CssContentHandler
[ContentHandler] Created handler for text: TextContentHandler