API:Changing wiki content

From MediaWiki.org
Jump to navigation Jump to search

Other languages:
български • ‎dansk • ‎Deutsch • ‎English • ‎español • ‎français • ‎italiano • ‎日本語 • ‎한국어 • ‎polski • ‎português • ‎română • ‎русский • ‎sicilianu • ‎سنڌي • ‎中文

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;

In MediaWiki 1.31 configuration parameter $wgEnableWriteAPI was deprecated and in future versions of MediaWiki it will no longer be possible to disable API access to the software.

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
Changeauthenticationdata ⧼apihelp-changeauthenticationdata-description⧽
ChecktokenAPI:Checktoken ⧼apihelp-checktoken-description⧽
ClientloginAPI:Login ⧼apihelp-clientlogin-description⧽
CompareAPI:Compare Get the difference between 2 pages.
ExpandtemplatesAPI:Expandtemplates ⧼apihelp-expandtemplates-description⧽
FeedcontributionsAPI:Feedcontributions ⧼apihelp-feedcontributions-description⧽
FeedrecentchangesAPI:Feedrecentchanges ⧼apihelp-feedrecentchanges-description⧽
FeedwatchlistAPI:Feedwatchlist ⧼apihelp-feedwatchlist-description⧽
HelpAPI:Help ⧼apihelp-help-description⧽
Linkaccount ⧼apihelp-linkaccount-description⧽
LoginAPI:Login Log in and get authentication cookies.
LogoutAPI:Logout ⧼apihelp-logout-description⧽
OpensearchAPI:Opensearch ⧼apihelp-opensearch-description⧽
ParaminfoAPI:Paraminfo ⧼apihelp-paraminfo-description⧽
ParseAPI:Parse Parses content and returns parser output.
QueryAPI:Query Fetch data from and about MediaWiki.
Removeauthenticationdata ⧼apihelp-removeauthenticationdata-description⧽
RsdAPI:Rsd ⧼apihelp-rsd-description⧽
StasheditAPI:Stashedit Prepare an edit in shared cache.
TokensAPI:Tokens Get tokens for data-modifying actions.
Unlinkaccount ⧼apihelp-unlinkaccount-description⧽
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.
MergehistoryAPI:Mergehistory Merge page histories.
MoveAPI:Move Move a page.
OptionsAPI:Options Change preferences of the current user.
PatrolAPI:Patrol Patrol a page or revision.
ProtectAPI:Protect ⧼apihelp-protect-description⧽
PurgeAPI:Purge Purge the cache for the given titles.
ResetpasswordAPI:Resetpassword ⧼apihelp-resetpassword-description⧽
RevisiondeleteAPI:Revisiondelete ⧼apihelp-revisiondelete-description⧽
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 ⧼apihelp-tag-description⧽
UnblockAPI:Unblock ⧼apihelp-unblock-description⧽
UndeleteAPI:Undelete Restore revisions of a deleted page.
UploadAPI:Upload Upload a file, or get the status of pending uploads.
UserrightsAPI:User group membership ⧼apihelp-userrights-description⧽
WatchAPI:Watch ⧼apihelp-watch-description⧽

Possible errors[edit]

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.