API:Changing wiki content

From MediaWiki.org
Jump to: navigation, search

Other languages:
Deutsch • ‎English • ‎español • ‎français • ‎日本語 • ‎polski • ‎русский • ‎sicilianu • ‎سنڌي • ‎中文
Tools clipart.png This page is part of the MediaWiki action API documentation.
MediaWiki APIsAPI:Main page

MediaWiki action API

v · d · e

Changing wiki content through the API is enabled by default as of MediaWiki 1.14; it can be disabled by setting $wgEnableWriteAPI = false;Manual:$wgEnableWriteAPI in LocalSettings.php. In MediaWiki 1.13 and earlier, you have to explicitly enable the write API with $wgEnableWriteAPI = true;

Please see the appropriate subsection for detailed information for each module. Write modules generally require a POST method, where read modules usually use GET methods. Exceptions are noted on individual pages.

Read Modules Write Modules
ChecktokenAPI:Checktoken Check the validity of a token from action=query&meta=tokens.
CompareAPI:Compare Get the difference between 2 pages.
ExpandtemplatesAPI:Expandtemplates Expands all templates in wikitext.
FeedcontributionsAPI:Feedcontributions Returns a user contributions feed.
FeedrecentchangesAPI:Feedrecentchanges Returns a recent changes feed.
FeedwatchlistAPI:Feedwatchlist Returns a watchlist feed.
HelpAPI:Help Display help for the specified modules.
LoginAPI:Login Log in and get authentication cookies.
LogoutAPI:Logout Log out and clear session data.
OpensearchAPI:Opensearch Search the wiki using the OpenSearch protocol.
ParaminfoAPI:Paraminfo Obtain information about API modules.
ParseAPI:Parse Parses content and returns parser output.
QueryAPI:Query Fetch data from and about MediaWiki.
RsdAPI:Rsd Export an RSD (Really Simple Discovery) schema.
StasheditAPI:Stashedit Prepare an edit in shared cache.
TokensAPI:Tokens Get tokens for data-modifying actions.
BlockAPI:Block Block a user.
ClearhasmsgAPI:Clearhasmsg Clears the hasmsg flag for the current user.
CreateaccountAPI:Createaccount Create a new user account.
DeleteAPI:Delete Delete a page.
EditAPI:Edit Create and edit pages.
EmailuserAPI:Email Email a user.
FilerevertAPI:Filerevert Revert a file to an old version.
ImagerotateAPI:Imagerotate Rotate one or more images.
ImportAPI:Import Import a page from another wiki, or from an XML file.
ManagetagsAPI:Managetags Perform management tasks relating to change tags.
MoveAPI:Move Move a page.
OptionsAPI:Options Change preferences of the current user.
PatrolAPI:Patrol Patrol a page or revision.
ProtectAPI:Protect Change the protection level of a page.
PurgeAPI:Purge Purge the cache for the given titles.
RevisiondeleteAPI:Revisiondelete Delete and undelete revisions.
RollbackAPI:Rollback Undo the last series of edits to a page by the last user.
SetnotificationtimestampAPI:Setnotificationtimestamp Update the notification timestamp for watched pages.
TagAPI:Tag Add or remove change tags from individual revisions or log entries.
UnblockAPI:Unblock Unblock a user.
UndeleteAPI:Undelete Restore revisions of a deleted page.
UploadAPI:Upload Upload a file, or get the status of pending uploads.
UserrightsAPI:User group membership Change a user's group membership.
WatchAPI:Watch Add or remove pages from the current user's watchlist.

Possible errors[edit | edit source]

Some wikis restrict the use of these modules to certain groups of users, or disallow it altogether. All aforementioned modules can return the following errors:

Code Info
noapiwrite Editing of this wiki through the API is disabled. Make sure the $wgEnableWriteAPI=true; statement is included in the wiki's LocalSettings.php file
writeapidenied You're not allowed to edit this wiki through the API