API:Move
From MediaWiki.org
![]() |
This page is part of the MediaWiki API documentation. |
Language: | English • Deutsch • 日本語 |
---|
Quick overview:
- Quick start guide
- FAQ
- Tutorial
- Formats
- Error reporting
- Restricting usage
- Cross-site requests
- Authentication
- Queries
- Search suggestions
- Parsing wikitext and expanding templates
- Purging pages' caches
- Parameter information
- Changing wiki content
- Watchlist feed
- Wikidata
- Extensions
- Using the API in MediaWiki and extensions
- Miscellaneous
- Implementation
- Client code
MediaWiki version: | = 1.12 |
Token[edit | edit source]
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. A move token can be obtained as follows: Obtaining a move token
Result |
---|
The following content has been placed in a collapsed box for improved usability. |
<?xml version="1.0" encoding="utf-8"?> <api> <query> <pages> <page pageid="1" ns="0" title="Main Page" touched="2007-09-03T20:32:21Z" lastrevid="20" counter="20" length="470" movetoken="58b54e0bab4a1d3fd3f7653af38e75cb+\" /> </pages> </query> </api> |
The above content has been placed in a collapsed box for improved usability. |
Moving pages[edit | edit source]
Pages can be moved with action=move.
Parameters[edit | edit source]
from
: The 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
: The new title you want to move the page totoken
: The token obtained in the previous request. Take care to urlencode the '+' as '%2B'.reason
: The reason for the move (optional)movetalk
: Move the talk page, if possiblemovesubpages
: Move subpages, if applicablenoredirect
: Don't create a redirect from the old title to the new one. Requires the suppressredirect right, which by default is granted only to group Bots; even admins don't have it!watch
: Add the page and the redirect to your watchlistunwatch
: Remove the page and the redirect from your watchlistignorewarnings
: Ignore any warnings while moving
Example[edit | edit source]
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 |
---|
The following content has been placed in a collapsed box for improved usability. |
<?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> |
The above content has been placed in a collapsed box for improved usability. |
Possible errors[edit | edit source]
All errors are formatted as:
<error code="code" info="info">
- code: nofrom
- info: The from parameter must be set
- code: noto
- info: The to parameter must be set
- code: notoken
- info: The token parameter must be set
- code: cantmove-anon
- info: Anonymous users can't move pages
- code: cantmove
- info: You don't have permission to move pages
- code: cantmovefile
- info: You don't have permission to move files
- If file moving is disabled altogether, you'll get an immobilenamespace error instead
- info: You don't have permission to move files
- code: selfmove
- info: Can't move a page to itself
- code: immobilenamespace
- info: You tried to move pages from or to a namespace that is protected from moving
- code: articleexists
- info: The destination article already exists and is not a redirect to the source article
- code: protectedpage
- info: You don't have permission to perform this move
- code: protectedtitle
- info: The destination article has been protected from creation
- code: nonfilenamespace
- info: Can't move a file to a non-file namespace
- code: filetypemismatch
- info: The new file extension doesn't match its type
- code: mustbeposted
- info: The move module requires a POST request
NOTE: If moving the page itself succeeded, but moving the talk page failed, the relevant error will be returned in the talkmove-error-code
and talkmove-error-info
fields.