API:Mergehistory
![]() |
This page is part of the MediaWiki action API documentation. |
MediaWiki action API
- Introduction and quick start
- FAQ
- Tutorial
- Formats
- Error reporting
- Restricting usage
- Cross-site requests
- Authentication
- Queries
- Searching (by title, content, coordinates...)
- Parsing wikitext and expanding templates
- Purging pages' caches
- Parameter information
- Changing wiki content
- Create and edit pages
- Move pages
- Merge pages
- Rollback
- Delete pages
- Restore deleted revisions
- (Un)protect pages
- (Un)block users
- (Un)watch pages
- Mark revisions of watched pages as visited
- Send email
- Patrol changes
- Import pages
- Change user group membership
- Upload files
- User options
- Tokens
- Page language
- Watchlist feed
- Wikidata
- Extensions
- Using the API in MediaWiki and extensions
- Miscellaneous
- Implementation
- Client code
- Asserting
Mergehistory | ||
---|---|---|
Merge page histories. This module cannot be used as a Generator . |
||
Prefix | none | |
Required rights | mergehistory | |
Post only? | Yes | |
Generated help | Current | |
Version added |
|
Token[edit]
To merge a page, an edit token is required.
Merging pages[edit]
Pages can be merged with action=mergehistory.
Parameters[edit]
from
: Title of the page from which history will be merged. Cannot be used together withfromid
.fromid
: Page ID of the page from which history will be merged. Cannot be used together withfrom
.to
: Title of the page to which history will be merged. Cannot be used together withtoid
.toid
: Page ID of the page to which history will be merged. Cannot be used together withto
.timestamp
: Timestamp up to which revisions will be moved from the source page's history to the destination page's history. If omitted, the entire page history of the source page will be merged into the destination page.reason
: Reason for the history merge (optional).token
: A csrf token.
Example[edit]
Note: In this example, all parameters are passed in a GET request just for the sake of simplicity. However, action=mergehistory requires POST requests; GET requests will cause an error.
Merge the entire history of Oldpage into Newpage.
Result |
---|
<?xml version="1.0" encoding="utf-8"?>
<api>
<mergehistory
from="Oldpage"
to="Newpage"
timestamp="2016-06-04T20:25:19Z"
reason="Reason"
/>
</api>
|
Merge the page revisions of Oldpage dating up to 2015-12-31T04:37:41Z
into Newpage.
Result |
---|
<?xml version="1.0" encoding="utf-8"?>
<api>
<mergehistory
from="Oldpage"
to="Newpage"
timestamp="2015-12-31T04:37:41Z"
reason="Reason"
/>
</api>
|
Possible errors[edit]
All errors are formatted as:
<error code="code" info="info">
![]() |
Please expand this page. |
![]() |
The following documentation is the output of Special:ApiHelp/mergehistory, generated from mergehistory's source code. |
action=mergehistory
- This module requires read rights.
- This module requires write rights.
- This module only accepts POST requests.
- Source: MediaWiki
- License: GPL-2.0+
Merge page histories.
- from
-
Title of the page from which history will be merged. Cannot be used together with fromid.
- fromid
-
Page ID of the page from which history will be merged. Cannot be used together with from.
- Type: integer
- to
-
Title of the page to which history will be merged. Cannot be used together with toid.
- toid
-
Page ID of the page to which history will be merged. Cannot be used together with to.
- Type: integer
- timestamp
-
Timestamp up to which revisions will be moved from the source page's history to the destination page's history. If omitted, the entire page history of the source page will be merged into the destination page.
- Type: timestamp (allowed formats)
- reason
-
Reason for the history merge.
- Default: (empty)
- token
-
A "csrf" token retrieved from action=query&meta=tokens
- This parameter is required.
- Merge the entire history of Oldpage into Newpage.
- api.php?action=mergehistory&from=Oldpage&to=Newpage&token=123ABC&reason=Reason [open in sandbox]
- Merge the page revisions of Oldpage dating up to 2015-12-31T04:37:41Z into Newpage.
- api.php?action=mergehistory&from=Oldpage&to=Newpage&token=123ABC&reason=Reason×tamp=2015-12-31T04%3A37%3A41Z [open in sandbox]