Даведка MediaWiki API

This is an auto-generated MediaWiki API documentation page.

Documentation and examples: https://www.mediawiki.org/wiki/Special:MyLanguage/API:Main_page

Main module

Статус: MediaWiki API — сфармаваны і стабільны інтэрфэйс, які актыўна падтрымліваецца і паляпшаецца. І хаця мы імкнемся гэтага пазьбягаць, але часам нам трэба ўносіць істотныя зьмены; падпісвайцеся на рассылку mediawiki-api-announce дзеля паведамленьняў пра абнаўленьні.

Памылковыя запыты: калі да API дасылаюцца памылковыя запыты, HTTP-загаловак будзе дасланы з ключом «MediaWiki-API-Error», а потым значэньне загалоўку і код памылкі будуць выстаўленыя на аднолькавае значэньне. Дзеля дадатковай інфармацыі глядзіце API: Памылкі і папярэджаньні.

Specific parameters:
action

Дзеяньне для выкананьня.

abusefiltercheckmatch
Праверце, ці адпавядае Фільтру злоўжываньняў набор зьменных, рэдагаваньне ці запратакаляваная падзея Фільтру.
abusefilterchecksyntax
Праверыць сынтаксыс фільтру злоўжываньняў.
abusefilterevalexpression
Ацэньвае значэньне выразу фільтара злоўжываньняў.
abusefilterunblockautopromote
Разблякаваць карыстальніка ад атрыманьня аўтаматычных рэклямных акцыяў з-за наступстваў abusefilter.
abuselogprivatedetails
Прагляд прыватных зьвестак пра запіс журналу злоўжываньняў.
acquiretempusername
Acquire a temporary user username and stash it in the current session, if temp account creation is enabled and the current user is logged out. If a name has already been stashed, returns the same name.
antispoof
Праверка імені ўдзельніка паводле крытэраў нармалізацыі AntiSpoof.
block
Блякаваньне ўдзельніка.
centralauthtoken
Fetch a centralauthtoken for making an authenticated request to an attached wiki.
centralnoticecdncacheupdatebanner
Request the purge of banner content stored in the CDN (front-end) cache for anonymous users, for the requested banner and language
centralnoticechoicedata
Get data needed to choose a banner for a given project and language
centralnoticequerycampaign
Get all configuration settings for a campaign.
changeauthenticationdata
Зьмена зьвестак аўтэнтыфікацыі для цяперашняга ўдзельніка.
changecontentmodel
Change the content model of a page
checktoken
Праверыць карэктнасьць токену з action=query&meta=tokens.
clearhasmsg
Ачышчае сьцяг hasmsg для актуальнага карыстальніка.
clientlogin
Увайсьці ў вікі з дапамогай інтэрактыўнага струменя.
communityconfigurationedit
Change the content of a configuration provider in Community configuration
compare
Атрымаць розьніцу паміж 2 старонкамі.
createaccount
Стварэньне новага рахунку ўдзельніка.
createlocalaccount
Прымусовае стварэньне лякальнага ўліковага запісу. Цэнтралізаваны ўліковы запіс ўжо мусіць існаваць.
cxdelete
Delete a draft translation created using the Content Translation extension.
cxsuggestionlist
Manage the suggestion lists. Add suggestions to lists and remove them.
cxtoken
Get JWT tokens to authenticate with cxserver.
delete
Выдаліць старонку.
deleteglobalaccount
Delete a global user.
discussiontoolsedit
Апублікаваць паведамленне на старонцы размовы.
discussiontoolsfindcomment
Find a comment by its ID or name.
discussiontoolsgetsubscriptions
Атрымаць станы падпіскі на зададзеныя тэмы.
discussiontoolssubscribe
Падпісацца (або адпісацца), каб атрымліваць апавяшчэнні па тэме.
discussiontoolsthank
Send a public thank-you notification for a comment.
echocreateevent
Manually trigger a notification to a user
echomarkread
Пазначыць апавяшчэньні для цяперашняга карыстальніка прачытанымі.
echomarkseen
Пазначыць апавяшчэнні як прагледжаныя для бягучага ўдзельніка.
echomute
Mute or unmute notifications from certain users or pages.
edit
Ствараць і правіць старонкі.
editmassmessagelist
Edit a mass message delivery list.
emailuser
Email a user.
expandtemplates
Expands all templates within wikitext.
featuredfeed
Returns a featured content feed.
feedcontributions
Returns a user's contributions feed.
feedrecentchanges
Returns a recent changes feed.
feedwatchlist
Returns a watchlist feed.
filerevert
Revert a file to an old version.
globalblock
Globally block or unblock a user.
globalpreferenceoverrides
Change local overrides for global preferences for the current user.
globalpreferences
Change global preferences of the current user.
globaluserrights
Add/remove a user to/from global groups.
growthmanagementorlist
Manage information in the structured mentor list (usually stored in MediaWiki:GrowthMentors.json). This module can be used by both current and future mentors (to add themselves or change their details) and administrators (for all users).
growthmentordashboardupdatedata
Schedule an extraordinary update of the mentee overview module in the mentor dashboard. You can only schedule one update per two hours for performance reasons.
growthsetmenteestatus
Set mentee's status (allows mentees to enable/disable mentorship module, or to opt-out entirely, which deletes the mentee/mentor relationship)
growthsetmentor
Set user's mentor. Change will be publicly logged.
growthstarmentee
Mark or unmark a mentee as starred by current user (stored privately and not logged)
help
Display help for the specified modules.
homepagequestionstore
Obtain formatted questions posted via homepage modules
imagerotate
This module has been disabled.
import
Import a page from another wiki, or from an XML file.
jsonconfig
Allows direct access to JsonConfig subsystem.
languagesearch
Пошук назваў моваў любым альфабэтам.
linkaccount
Link an account from a third-party provider to the current user.
login
Log in and get authentication cookies.
logout
Log out and clear session data.
managetags
Perform management tasks relating to change tags.
massmessage
Send a message to a list of pages.
mergehistory
Merge page histories.
move
Перанесьці старонку
opensearch
Search the wiki using the OpenSearch protocol.
options
Change preferences of the current user.
paraminfo
Obtain information about API modules.
parse
Parses content and returns parser output.
patrol
Patrol a page or revision.
protect
Change the protection level of a page.
purge
Purge the cache for the given titles.
query
Fetch data from and about MediaWiki.
removeauthenticationdata
Remove authentication data for the current user.
resetpassword
Send a password reset email to a user.
revisiondelete
Delete and undelete revisions.
rollback
Undo the last edit to the page.
rsd
Export an RSD (Really Simple Discovery) schema.
setglobalaccountstatus
Hide or lock (or unhide or unlock) a global user account.
setnotificationtimestamp
Update the notification timestamp for watched pages.
setpagelanguage
Change the language of a page.
shortenurl
Скараціць доўгі URL-адрас у больш кароткі.
sitematrix
Get Wikimedia sites list.
spamblacklist
Validate one or more URLs against the spam block list.
streamconfigs
Exposes event stream config. Returns only format=json with formatversion=2.
strikevote
Allows admins to strike or unstrike a vote.
sxdelete
Delete the draft section translation and its parallel corpora from database.
tag
Add or remove change tags from individual revisions or log entries.
templatedata
Fetch data stored by the TemplateData extension.
thank
Send a thank-you notification to an editor.
titleblacklist
Validate a page title, filename, or username against the TitleBlacklist.
torblock
Праверыць, ці не заблакаваны IP-адрас Tor.
transcodereset
Users with the 'transcode-reset' right can reset and re-run a transcode job.
unblock
Unblock a user.
undelete
Undelete revisions of a deleted page.
unlinkaccount
Remove a linked third-party account from the current user.
upload
Upload a file, or get the status of pending uploads.
userrights
Change a user's group membership.
validatepassword
Validate a password against the wiki's password policies.
watch
Add or remove pages from the current user's watchlist.
webapp-manifest
Вяртае маніфест вэб-прыкладання.
webauthn
API Module to communicate between server and client during registration/authentication process.
bouncehandler
Internal. Receive a bounce email and process it to handle the failing recipient.
categorytree
Internal. Унутраны модуль для пашырэньня структуры катэгорыяў.
cirrus-check-sanity
Internal. Reports on the correctness of a range of page ids in the search index
cirrus-config-dump
Internal. Dump of CirrusSearch configuration.
cirrus-mapping-dump
Internal. Dump of CirrusSearch mapping for this wiki.
cirrus-profiles-dump
Internal. Dump of CirrusSearch profiles for this wiki.
cirrus-settings-dump
Internal. Dump of CirrusSearch settings for this wiki.
collection
Internal. API module for performing various operations on a wiki user's collection.
cspreport
Internal. Used by browsers to report violations of the Content Security Policy. This module should never be used, except when used automatically by a CSP compliant web browser.
cxcheckunreviewed
Internal. Check if any fast, unreviewed translation has been published recently for the current user.
cxpublish
Internal. Захавайце старонку, створаную з дапамогай пашырэння Content Translation.
cxpublishsection
Internal. Save a section created using the Content Translation extension's section translation feature.
cxsave
Internal. This module allows to save draft translations by section to save bandwidth and to collect parallel corpora.
cxsplit
Internal. Create and save a section translation to database, for every translated section of the given article translation
discussiontoolscompare
Internal. Атрымаць інфармацыю пра змены каментароў паміж двума версіямі старонак.
discussiontoolspageinfo
Internal. Вяртае метададзеныя, неабходныя для ініцыялізацыі інструментаў размоў.
discussiontoolspreview
Internal. Перадпрагляд паведамлення на старонцы размоў.
echopushsubscriptions
Internal. Manage push subscriptions for the current user.
editcheckreferenceurl
Internal. Check the status of a URL for use as a reference.
fancycaptchareload
Internal. Атрымаць новую FancyCaptcha.
growthinvalidateimagerecommendation
Internal. Invalidate an image recommendation.
growthinvalidatepersonalizedpraisesuggestion
Internal. Invalidates a suggestion of a praiseworthy mentee in the Personalized praise module on the Mentor dashboard
helppanelquestionposter
Internal. Апрацоўка пытаньняў, разьмешчаных праз панэль дапамогі, для цяперашняга ўдзельніка.
jsondata
Internal. Retrieve localized JSON data.
oathvalidate
Internal. Праверыць токен двухфактарнай аўтэнтыфікацыі (OATH).
parser-migration
Internal. Разабраць старонку з двума рознымі наладамі аналізатара.
readinglists
Internal. Reading list write operations.
sanitize-mapdata
Internal. Performs data validation for Kartographer extension
scribunto-console
Internal. Internal module for servicing XHR requests from the Scribunto console.
securepollauth
Internal. Allows a remote wiki to authenticate users before granting access to vote in the election.
stashedit
Internal. Prepare an edit in shared cache.
sxsave
Internal. Save the draft section translation and store the parallel corpora
timedtext
Internal. Provides timed text content for usage by <track> elements
ulslocalization
Internal. Атрымаць лякалізацыю ULS на пададзенай мове.
ulssetlang
Internal. Update user's preferred interface language.
visualeditor
Internal. Returns HTML5 for a page from the Parsoid service.
visualeditoredit
Internal. Save an HTML5 page to MediaWiki (converted to wikitext via the Parsoid service).
wikimediaeventsblockededit
Internal. Log information about blocked edit attempts
One of the following values: abusefiltercheckmatch, abusefilterchecksyntax, abusefilterevalexpression, abusefilterunblockautopromote, abuselogprivatedetails, acquiretempusername, antispoof, block, centralauthtoken, centralnoticecdncacheupdatebanner, centralnoticechoicedata, centralnoticequerycampaign, changeauthenticationdata, changecontentmodel, checktoken, clearhasmsg, clientlogin, communityconfigurationedit, compare, createaccount, createlocalaccount, cxdelete, cxsuggestionlist, cxtoken, delete, deleteglobalaccount, discussiontoolsedit, discussiontoolsfindcomment, discussiontoolsgetsubscriptions, discussiontoolssubscribe, discussiontoolsthank, echocreateevent, echomarkread, echomarkseen, echomute, edit, editmassmessagelist, emailuser, expandtemplates, featuredfeed, feedcontributions, feedrecentchanges, feedwatchlist, filerevert, globalblock, globalpreferenceoverrides, globalpreferences, globaluserrights, growthmanagementorlist, growthmentordashboardupdatedata, growthsetmenteestatus, growthsetmentor, growthstarmentee, help, homepagequestionstore, imagerotate, import, jsonconfig, languagesearch, linkaccount, login, logout, managetags, massmessage, mergehistory, move, opensearch, options, paraminfo, parse, patrol, protect, purge, query, removeauthenticationdata, resetpassword, revisiondelete, rollback, rsd, setglobalaccountstatus, setnotificationtimestamp, setpagelanguage, shortenurl, sitematrix, spamblacklist, streamconfigs, strikevote, sxdelete, tag, templatedata, thank, titleblacklist, torblock, transcodereset, unblock, undelete, unlinkaccount, upload, userrights, validatepassword, watch, webapp-manifest, webauthn, bouncehandler, categorytree, cirrus-check-sanity, cirrus-config-dump, cirrus-mapping-dump, cirrus-profiles-dump, cirrus-settings-dump, collection, cspreport, cxcheckunreviewed, cxpublish, cxpublishsection, cxsave, cxsplit, discussiontoolscompare, discussiontoolspageinfo, discussiontoolspreview, echopushsubscriptions, editcheckreferenceurl, fancycaptchareload, growthinvalidateimagerecommendation, growthinvalidatepersonalizedpraisesuggestion, helppanelquestionposter, jsondata, oathvalidate, parser-migration, readinglists, sanitize-mapdata, scribunto-console, securepollauth, stashedit, sxsave, timedtext, ulslocalization, ulssetlang, visualeditor, visualeditoredit, wikimediaeventsblockededit
Default: help
format

Фармат вываду.

json
Output data in JSON format.
jsonfm
Output data in JSON format (pretty-print in HTML).
none
Output nothing.
php
Output data in serialized PHP format.
phpfm
Output data in serialized PHP format (pretty-print in HTML).
rawfm
Output data, including debugging elements, in JSON format (pretty-print in HTML).
xml
Output data in XML format.
xmlfm
Output data in XML format (pretty-print in HTML).
One of the following values: json, jsonfm, none, php, phpfm, rawfm, xml, xmlfm
Default: jsonfm
maxlag

Максымальная затрымка можа ўжывацца, калі MediaWiki ўсталяваная ў клястэр з рэплікаванай базай зьвестак. Дзеля захаваньня дзеяньняў, якія выклікаюць затрымку рэплікацыі, гэты парамэтар можа прымусіць кліента чакаць, пакуль затрымка рэплікацыі меншая за яго значэньне. У выпадку доўгай затрымкі, вяртаецца код памылкі maxlag з паведамленьнем кшталту Чаканьне $host: $lag сэкундаў затрымкі.
Глядзіце Інструкцыя:Парамэтар maxlag дзеля дадатковай інфармацыі.

Type: integer
smaxage

Выстаўце HTTP-загаловак кантролю кэшу s-maxage на зададзеную колькасьць сэкундаў. Памылкі ніколі не кэшуюцца.

Type: integer
The value must be no less than 0.
Default: 0
maxage

Выстаўляе HTTP-загаловак кантролю кэшу max-age на зададзеную колькасьць сэкундаў. Памылкі ніколі не кэшуюцца.

Type: integer
The value must be no less than 0.
Default: 0
assert

Упэўніцеся, што ўдзельнік увайшоў у сыстэму (магчыма, як часовы карыстальнік), калі зададзена user, не ўвайшоў, калі зададзена anon, або мае правы робата, калі зададзена bot.

One of the following values: anon, bot, user
assertuser

Праверыць, што імя цяперашняга ўдзельніка супадае з зададзеным.

Тып: карыстач, любым з імя карыстача і Часовы ўдзельнік
requestid

Любое значэньне, пададзенае тут, будзе ўключанае ў адказ. Можа быць выкарыстанае для адрозьненьня запытаў.

servedby

Уключае ў вынік назву сэрвэра, які апрацаваў запыт.

Type: boolean (details)
curtimestamp

Уключае ў вынік пазнаку актуальнага часу.

Type: boolean (details)
responselanginfo

Уключыць мовы, выкарыстаныя для uselang і errorlang, у вынік.

Type: boolean (details)
origin

Пры звароце да API з дапамогай міждамэннага AJAX-запыту (CORS), выстаўце парамэтру значэньне зыходнага дамэну. Ён мусіць быць уключаны ў кожны папярэдні запыт і такім чынам мусіць быць часткай URI-запыту (ня цела POST).

Для аўтэнтыфікаваных запытаў ён мусіць супадаць з адной з крыніц у загалоўку Origin, павінна быць зададзена нешта кшталту https://meta.wikimedia.org. Калі парамэтар не супадае з загалоўкам Origin, будзе вернуты адказ з кодам памылкі 403. Калі парамэтар супадае з загалоўкам Origin і крыніца дазволеная, будуць выстаўленыя загалоўкі Access-Control-Allow-Origin і Access-Control-Allow-Credentials.

Для неаўтэнтыфікаваных запытаў выстаўце значэньне *. Гэта прывядзе да выстаўленьня загалоўку Access-Control-Allow-Origin, але Access-Control-Allow-Credentials будзе мець значэньне false і ўсе зьвесткі пра карыстальніка будуць абмежаваныя.

crossorigin

Пры доступе да API з дапамогай кросдамэнавых запытаў AJAX request (CORS) і сэсійнага пастаўніка, абароненага ад кросбачынавых атакаў падробкі запытаў (CSRF, прыкладам, OAuth), дзеля аўтэнтыфікацыі запыту (т. б. бяз выхаду з сыстэмы) карыстайцеся гэтым замест origin=*. Гэта трэба ўключаць у любыя перадпалётныя запыты, а значыць, у склад запыту URI (ня ў цела POST).

Зьвярніце ўвагу, што большасьць сэсійных пастаўнікоў, у тым ліку стандартныя сэсіі на базе маркёраў, не падтрымліваюць аўтэнтыфікаваныя CORS і ня могуць выкарыстоўвацца з гэтым парамэтрам.

Type: boolean (details)
uselang

Мова для выкарыстаньня ў перакладах паведамленьняў. action=query&meta=siteinfo&siprop=languages з siprop=languages вяртае сьпіс кодаў мовы. Вы можаце пазначыць user, каб ужываць налады мовы цяперашняга карыстальніка, або пазначыць content, каб ужываць мову зьместу гэтай вікі.

Default: user
variant

Варыянт мовы. Працуе толькі ў выпадку, калі базавая мова падтрымлівае пераўтварэньне варыянтаў.

errorformat

Фармат для вываду тэксту папярэджаньняў і памылак

plaintext
Вікітэкст з выдаленымі HTML-цэтлікамі і замененымі існасьцямі.
wikitext
Неразабраны вікітэкст.
html
HTML
raw
Ключ паведамленьня і парамэтры.
none
No text output, only the error codes.
bc
Format used prior to MediaWiki 1.29. errorlang and errorsuselocal are ignored.
One of the following values: bc, html, none, plaintext, raw, wikitext
Default: bc
errorlang

Мова для выкарыстаньня ў папярэджаньнях і памылках. action=query&meta=siteinfo&siprop=languages з siprop=languages вяртае сьпіс кодаў моваў. Пазначце content для выкарыстаньня мовы зьместу гэтай вікі, ці пазначце uselang для выкарыстаньня таго ж значэньня, што і ў парамэтры uselang.

Default: uselang
errorsuselocal

Калі зададзена, тэксты памылак будуць выкарыстоўваць лякальна-наладжаныя паведамленьні з прасторы назваў MediaWiki.

Type: boolean (details)
centralauthtoken

When accessing the API using a cross-domain AJAX request (CORS), use this to authenticate as the current SUL user. Use action=centralauthtoken on this wiki to retrieve the token, before making the CORS request. Each token may only be used once, and expires after 10 seconds. This should be included in any pre-flight request, and therefore should be included in the request URI (not the POST body).

Прыклады:
Help for the main module.
api.php?action=help [open in sandbox]
Уся дапамога на адной старонцы.
api.php?action=help&recursivesubmodules=1 [open in sandbox]
Permission:
apihighlimits
Use higher limits in API queries (slow queries: 500; fast queries: 5000). The limits for slow queries also apply to multivalue parameters.
Granted to: bot і sysop

Data types

Input to MediaWiki should be NFC-normalized UTF-8. MediaWiki may attempt to convert other input, but this may cause some operations (such as edits with MD5 checks) to fail.

Parameters that take multiple values are normally submitted with the values separated using the pipe character, e.g. param=value1|value2 or param=value1%7Cvalue2. If a value must contain the pipe character, use U+001F (Unit Separator) as the separator and prefix the value with U+001F, e.g. param=%1Fvalue1%1Fvalue2.

Some parameter types in API requests need further explanation:

boolean

Boolean parameters work like HTML checkboxes: if the parameter is specified, regardless of value, it is considered true. For a false value, omit the parameter entirely.

expiry

Expiry values may be relative (e.g. 5 months or 2 weeks) or absolute (e.g. 2014-09-18T12:34:56Z). For no expiry, use infinite, indefinite, infinity or never.

timestamp

Timestamps may be specified in several formats, see the Timestamp library input formats documented on mediawiki.org for details. ISO 8601 date and time is recommended: 2001-01-15T14:56:00Z. Additionally, the string now may be used to specify the current timestamp.

Templated parameters

Templated parameters support cases where an API module needs a value for each value of some other parameter. For example, if there were an API module to request fruit, it might have a parameter fruits to specify which fruits are being requested and a templated parameter {fruit}-quantity to specify how many of each fruit to request. An API client that wants 1 apple, 5 bananas, and 20 strawberries could then make a request like fruits=apples|bananas|strawberries&apples-quantity=1&bananas-quantity=5&strawberries-quantity=20.

Credits

API developers:

  • Yuri Astrakhan (creator, lead developer Sep 2006–Sep 2007)
  • Roan Kattouw (lead developer Sep 2007–2009)
  • Victor Vasiliev
  • Bryan Tong Minh
  • Sam Reed
  • Brad Jorsch (lead developer 2013–2020)

Please send your comments, suggestions and questions to [email protected] or file a bug report at https://phabricator.wikimedia.org/.