API:Move
| Other languages: | English • Deutsch • 日本語 |
|---|
| This page is part of the MediaWiki action API documentation. |
MediaWiki action API
- Introduction and quick start
- FAQ
- 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
- More...
- Watchlist feed
- Wikidata
- Extensions
- Using the API in MediaWiki and extensions
- Miscellaneous
- Implementation
- Client code
- Asserting
| Move | ||
|---|---|---|
| Moves a page This module cannot be used as a Generator. |
||
| Prefix | none | |
| Required rights | move, movefile, move-subpages, move-rootuserpages, move-categorypages, suppressredirect | |
| Post only? | Yes | |
| Generated help | Current | |
| Version added |
|
|
Token[edit]
To move a page, a move token is required. This token is equal to the edit token and the same for all pages, but changes at every login. Moves tokens can be obtained via action=meta&query=tokens:
Obtaining a move token
| Result |
|---|
{
"batchcomplete": "",
"query": {
"tokens": {
"csrftoken": "5eac670b77126efb2aed8bb7aee8cc405a22bcd2+\\"
}
}
}
|
Moving pages[edit]
Pages can be moved with action=move.
Parameters[edit]
from: Title of the page you want to move. Cannot be used together withfromid.fromid: Page ID of the page you want to move. Cannot be used together withfrom.to: Title you want to rename the page to.token: A move token previously retrieved through prop=info. Take care to urlencode the '+' as '%2B'.reason: Reason for the move (optional).movetalk: Move the talk page, if it exists.movesubpages: Move subpages, if applicable.noredirect: Don't create a redirect. Requires the suppressredirect right, which by default is granted only to bots and sysops.watch: Add the page and the redirect to your watchlist. Deprecated. Use the watchlist argument. (Deprecated in 1.17)unwatch: Remove the page and the redirect from your watchlist. Deprecated. Use the watchlist argument. (Deprecated in 1.17)watchlist: Unconditionally add or remove the page from your watchlist, use preferences or do not change watch (see API:Edit). 1.17+ignorewarnings: Ignore any warnings.tags: Tags to apply to the entry in the move log and to the null revision on the destination page. 1.29+
Example[edit]
Note: In this example, all parameters are passed in a GET request just for the sake of simplicity. However, action=move requires POST requests; GET requests will cause an error. Moving Main Pgae (sic) and its talk page to Main Page, without creating a redirect
| Result |
|---|
<?xml version="1.0" encoding="utf-8"?>
<api>
<move
from="Main Pgae"
to="Main Page"
reason="Oops, misspelling"
talkfrom="Talk:Main Pgae"
talkto="Talk:Main Page"
/>
</api>
|
Possible errors[edit]
All errors are formatted as:
<error code="code" info="info">
| Code | Info |
|---|---|
| nofrom | The from parameter must be set |
| noto | The to parameter must be set |
| notoken | The token parameter must be set |
| cantmove-anon | Anonymous users can't move pages |
| cantmove | You don't have permission to move pages |
| cantmovefile | You don't have permission to move files. Note: If file moving is disabled altogether, you'll get an immobilenamespace error instead |
| selfmove | Can't move a page to itself |
| immobilenamespace | You tried to move pages from or to a namespace that is protected from moving |
| articleexists | The destination article already exists and is not a redirect to the source article |
| protectedpage | You don't have permission to perform this move |
| protectedtitle | The destination article has been protected from creation |
| nonfilenamespace | Can't move a file to a non-file namespace |
| filetypemismatch | The new file extension doesn't match its type |
| mustbeposted | The move module requires a POST request |
NOTE: The Move API uses two additional error handling methods when the page move succeeded, but the talk page or sub-page move failed:
- Talk page: The relevant error will be returned in the
talkmove-error-codeandtalkmove-error-infofields. - Subpages: The relevant error will be returned as a standard
code/infostructure under thesubpageskey.
| The following documentation is the output of Special:ApiHelp/move, automatically generated by the pre-release version of MediaWiki that is running on this site (MediaWiki.org). |
action=move
- This module requires read rights.
- This module requires write rights.
- This module only accepts POST requests.
- Source: MediaWiki
- License: GPL-2.0-or-later
Move a page.
- from
Title of the page to rename. Cannot be used together with fromid.
- fromid
Page ID of the page to rename. Cannot be used together with from.
- Type: integer
- to
Title to rename the page to.
- This parameter is required.
- reason
Reason for the rename.
- Default: (empty)
- movetalk
Rename the talk page, if it exists.
- Type: boolean (details)
- movesubpages
Rename subpages, if applicable.
- Type: boolean (details)
- noredirect
Don't create a redirect.
- Type: boolean (details)
- watchlist
Unconditionally add or remove the page from the current user's watchlist, use preferences or do not change watch.
- One of the following values: watch, unwatch, preferences, nochange
- Default: preferences
- ignorewarnings
Ignore any warnings.
- Type: boolean (details)
- tags
Change tags to apply to the entry in the move log and to the null revision on the destination page.
- Values (separate with | or alternative):
- token
A "csrf" token retrieved from action=query&meta=tokens
- This parameter is required.
- Move Badtitle to Goodtitle without leaving a redirect.
- api.php?action=move&from=Badtitle&to=Goodtitle&token=123ABC&reason=Misspelled%20title&movetalk=&noredirect= [open in sandbox]