MediaWiki API help
This is an auto-generated MediaWiki Action API documentation page.
General information
Estau: L'API de MediaWiki ye una interfaz madura y estable que tien encontu y ameyoramientu activu. Anque facemos por evitalo, de xemes en cuando necesitamos facer cambios non compatibles colo anterior; suscríbete a la llista de corréu mediawiki-api-announce p'avisos sobro anovamientos.
Solicitúes incorreutes: Cuando s'unvíen solicitúes incorreutes a la API, unvíase una cabecera HTTP cola clave "MediaWiki-API-Error" y, darréu, tanto'l valor de la cabecera como'l códigu d'error devueltu pondránse al mesmu valor. Pa más información, consulta API: Errores y avisos.
Pruebes: Pa facilitar les pruebes de solicitúes API, consulta Special:ApiSandbox.
Request methods
Action API requests may use GET and POST methods. Prefer using the GET method, which allows requests to be routed to faster replica servers and responses to be cached, unless the length of the URL with parameters would exceed its length limit (commonly 8000 bytes), or a module only accepts POST requests.
Parameters for POST requests may be sent in the query part of the request URL (like in GET requests) and in the POST request body, and mixing both ways in one request is allowed. Certain parameters such as passwords must be sent in the request body. If the same parameter is sent as part of the URL and also in the request body, it must have the same value in both places.
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. The string now may be used to specify the current time.
Limits
Most API modules can accept up to 50 inputs in multivalue parameters, and can return up to 500 results per query (50 results for slow queries).
For users with the apihighlimits right (Bots y Alministradores), the limits are increased to 500 inputs and 5000 results (500 results for slow queries).
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.
Main module
- Source: MediaWiki
- License: GPL-2.0-or-later
Specify the action to perform, the format of the response, and options that apply to all API modules.
- action
Qué aición facer.
- abusefiltercheckmatch
- Comprobar si un filtru d'abusos casa con un conxuntu de variables, una edición o un socesu rexistráu d'AbuseFilter.
- abusefilterchecksyntax
- Comprobar la sintaxis d'un filtru de la Peñera d'abusos.
- abusefilterevalexpression
- Evaluar una espresión de la Peñera d'abusos.
- abusefilterunblockautopromote
- Desbloquia a un usuariu de recibir autopromociones como consecuencia de la peñera d'abusos.
- abuselogprivatedetails
- Ver detalles privaos d'una entrada de AbuseLog.
- 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
- Comprobar un nome d'usuariu escontra les comprobaciones de normalización AntiSpoof.
- block
- Bloquiar a un usuariu.
- centralauthtoken
- Algamar un centralauthtoken pa facer una solicitú autenticada a una wiki anexa.
- centralnoticecdncacheupdatebanner
- Solicitar la purga del conteníu d'anuncios guardáu na caché CDN (frontal) pa usuarios anónimos, pa la llingua y anunciu solicitáu
- centralnoticechoicedata
- Obtener los datos necesarios pa escoyer un cartelu pa un proyeutu y llingua daos
- centralnoticequerycampaign
- Obtener tolos parámetros de configuración d'una campaña.
- changeauthenticationdata
- Camudar los datos d'identificación del usuariu actual.
- changecontentmodel
- Change the content model of a page
- checktoken
- Comprueba la validez d'un pase dende action=query&meta=tokens.
- clearhasmsg
- Llimpia la marca
hasmsgdel usuariu actual. - clientlogin
- Aniciar sesión na wiki usando'l fluxu interactivu.
- communityconfigurationedit
- Change the content of a configuration provider in Community configuration
- compare
- Llograr la diferencia ente dos páxines.
- createaccount
- Crear una cuenta d'usuariu nueva.
- createlocalaccount
- Forcibly create a local account. The central account must exist.
- delete
- Desaniciar una páxina.
- deleteglobalaccount
- Desaniciar un usuariu global.
- discussiontoolsedit
- Post a message on a discussion page.
- discussiontoolsfindcomment
- Find a comment by its ID or name.
- discussiontoolsgetsubscriptions
- Get the subscription statuses of given topics.
- discussiontoolssubscribe
- Subscribe (or unsubscribe) to receive notifications about a topic.
- discussiontoolsthank
- Send a public thank-you notification for a comment.
- echocreateevent
- Manually trigger a notification to a user
- echomarkread
- Marcar les notificaciones como lleíes pal usuariu actual.
- echomarkseen
- Marcar les notificaciones como vistes pal usuariu actual.
- echomute
- Mute or unmute notifications from certain users or pages.
- edit
- Create and edit pages.
- editmassmessagelist
- Editar una llista d'entrega de mensaxes en masa.
- emailuser
- Unviar un corréu electrónicu a un usuariu.
- expandtemplates
- Expands all templates within wikitext.
- featuredfeed
- Devuelve una canal de noticies de conteníu destacáu
- 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
- Bloquiar o desbloquiar a un usuariu globalmente.
- globalpreferenceoverrides
- Cambiar les variaciones llocales de les preferencies globales del usuariu actual.
- globalpreferences
- Camudar les preferencies globales del usuariu actual.
- globaluserrights
- Amestar/desaniciar un usuariu a/de grupos globales.
- help
- Display help for the specified modules.
- imagerotate
- Esti módulu deshabilitóse.
- import
- Import a page from another wiki, or from an XML file.
- jsonconfig
- Permite l'accesu direutu al subsistema JsonConfig.
- languagesearch
- Buscar nomes de llingua en cualquier alfabetu.
- 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
- Unviar un mensaxe a una llista de páxines.
- mergehistory
- Merge page histories.
- move
- Move a page.
- 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
- Definir l'estáu d'un usuariu global.
- setnotificationtimestamp
- Update the notification timestamp for watched pages.
- setpagelanguage
- Change the language of a page.
- shortenurl
- Acurtiar una URL llarga a una más curtia.
- sitematrix
- Obtener la llista de sitios de Wikimedia.
- spamblacklist
- Validate one or more URLs against the spam block list.
- streamconfigs
- Exposes event stream config. Returns only format=json with formatversion=2.
- strikevote
- Permite a los alministradores anular o restaurar un votu.
- tag
- Add or remove change tags from individual revisions or log entries.
- templatedata
- Traer los datos almacenaos pola estensión TemplateData.
- thank
- Unviar una notificación d'agradecimientu a un editor.
- titleblacklist
- Validar un títulu de páxina, o nome de ficheru o d'usuariu escontra la llista prieta de títulos.
- torblock
- Check if an IP address is blocked as a Tor exit node.
- transcodereset
- Los usuarios col permisu 'transcode-reset' pueden reaniciar y volver a executar un trabayu transcode.
- 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
- Devuelve un manifest de webapp.
- webauthn
- API Module to communicate between server and client during registration/authentication process.
- bouncehandler
- Internal. Recibir un corréu electrónicu de rebote y procesalu pa xestionar el receptor fallíu.
- categorytree
- Internal. Módulu internu pa la estensión CategoryTree.
- chartinfo
- Internal. Retrieve current count of how many unique Chart page usages there are. Multiple uses of the same chart on the same page are considered a single use.
- cirrus-check-sanity
- Internal. Reports on the correctness of a range of page ids in the search index
- cirrus-config-dump
- Internal. Volcáu de la configuración de CirrusSearch.
- cirrus-profiles-dump
- Internal. Volcáu de los perfiles de CirrusSearch pa esta wiki.
- cirrus-schema-dump
- Internal. Dump of CirrusSearch schema (settings and mappings) for this wiki.
- codemirror-validate
- Internal. Check for validation errors in the given content
- 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.
- discussiontoolscompare
- Internal. Get information about comment changes between two page revisions.
- discussiontoolspageinfo
- Internal. Returns metadata required to initialize the discussion tools.
- discussiontoolspreview
- Internal. Preview a message on a discussion page.
- editcheckreferenceurl
- Internal. Check the status of a URL for use as a reference.
- fancycaptchareload
- Internal. Solicitar un FancyCaptcha nuevu.
- jsondata
- Internal. Recuperar datos JSON llocalizaos.
- jsontransform
- Internal. Retrieve JSON data transformed by a Lua function.
- parser-migration
- Internal. Analizar una páxina con dos configuraciones de tidy distintes.
- readinglists
- Internal. Reading list write operations.
- sanitize-mapdata
- Internal. Fai la convalidación de datos pa la estensión Kartographer
- scribunto-console
- Internal. Módulu internu pa dar serviciu a les solicitúes XHR de la consola de Scribunto.
- 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.
- timedtext
- Internal. Provides timed text content for usage by <track> elements
- ulslocalization
- Internal. Obtener la llocalización de ULS na llingua dada.
- ulssetlang
- Internal. Update user's preferred interface language.
- visualeditor
- Internal. Devuelve HTML5 pa una páxina dende'l serviciu Parsoid.
- visualeditoredit
- Internal. Guardar una páxina HTML5 en MediaWiki (convertida en testu wiki mediante'l serviciu Parsoid).
- wikimediaeventsblockededit
- Internal. Log information about blocked edit attempts
- wikimediaeventshcaptchaeditattempt
- Internal. Log edit diff when hCaptcha challenge is shown but edit is incomplete
- 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, delete, deleteglobalaccount, discussiontoolsedit, discussiontoolsfindcomment, discussiontoolsgetsubscriptions, discussiontoolssubscribe, discussiontoolsthank, echocreateevent, echomarkread, echomarkseen, echomute, edit, editmassmessagelist, emailuser, expandtemplates, featuredfeed, feedcontributions, feedrecentchanges, feedwatchlist, filerevert, globalblock, globalpreferenceoverrides, globalpreferences, globaluserrights, help, 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, tag, templatedata, thank, titleblacklist, torblock, transcodereset, unblock, undelete, unlinkaccount, upload, userrights, validatepassword, watch, webapp-manifest, webauthn, bouncehandler, categorytree, chartinfo, cirrus-check-sanity, cirrus-config-dump, cirrus-profiles-dump, cirrus-schema-dump, codemirror-validate, collection, cspreport, discussiontoolscompare, discussiontoolspageinfo, discussiontoolspreview, editcheckreferenceurl, fancycaptchareload, jsondata, jsontransform, parser-migration, readinglists, sanitize-mapdata, scribunto-console, securepollauth, stashedit, timedtext, ulslocalization, ulssetlang, visualeditor, visualeditoredit, wikimediaeventsblockededit, wikimediaeventshcaptchaeditattempt
- Default: help
- format
El formatu de la salida.
- One of the following values: json, jsonfm, none, rawfm, xml, xmlfm
- Default: jsonfm
- maxlag
El retrasu (lag) máximu puede utilizase cuando MediaWiki ta instaláu nun conxuntu de bases de datos replicaes. Pa evitar les aiciones que pudieran causar un retrasu entá mayor na replicación del sitiu, esti parámetru puede causar que'l cliente espere hasta que'l retrasu de replicación sía menor que'l valor especificáu. En casu de retrasu escesivu, devuélvese un códigu d'error maxlag con un mensaxe asemeyáu a Esperando a $host: $lag segundos de retrasu.
Ver Manual:Parámetru maxlag pa más información.- Type: integer
- smaxage
Establez l'encabezáu HTTP
s-maxagede control de caché a esta cantidá de segundos. Los errores nunca se guarden na caché.- Type: integer
- The value must be no less than 0.
- Default: 0
- maxage
Establez l'encabezáu HTTP
max-agede control de caché a esta cantidá de segundos. Los errores nunca se guarden na caché.- Type: integer
- The value must be no less than 0.
- Default: 0
- assert
Comprobar que l'usuariu tien sesión aniciada si'l valor ye user, que nun la tien si ye anon, o que tien permisu de bot si ye bot.
- One of the following values: anon, bot, user
- assertuser
Comprobar que'l usuariu actual ye l'usuariu nomáu.
- Tipu: usuariu, por cualquiera ente nome d'usuariu y Temporary user
- requestid
Cualquier valor dau equí va incluyise na respuesta. Puede utilizase pa estremar solicitúes.
- servedby
Incluyir el nome del host que sirvió la solicitú nes resultancies.
- Type: boolean (details)
- curtimestamp
Incluyir la marca de tiempu actual na resultancia.
- Type: boolean (details)
- responselanginfo
Incluye les llingües utilizaes pa uselang y errorlang nel resultáu.
- Type: boolean (details)
- origin
Cuando s'accede a la API usando una solicitú AJAX dende otru dominiu (CORS), establezse esti valor al dominiu d'orixe. Tien d'incluíse en cualquier solicitú pre-vuelu, y polo tanto ten de ser parte de la URI de la solicitú (non del cuerpu POST).
Nes solicitúes con autenticación, tien de coincidir exautamente con unu de los orixes de la cabecera
Origin, polo que tendría de ser daqué como https://en.wikipedia.org o https://meta.wikimedia.org. Si esti parámetru nun coincide cola cabeceraOrigin, va devolvese una respuesta 403. Si esti parámetru coincide cola cabeceraOriginy l'orixe ta na llista blanca, van crease les cabeceresAccess-Control-Allow-OriginyAccess-Control-Allow-Credentials.Nes solicitúes ensin autenticación, introduz el valor *. Esto va crear una cabecera
Access-Control-Allow-Origin, pero'l valor deAccess-Control-Allow-Credentialsva serfalsey tolos datos que dependan del usuariu tarán torgaos.- crossorigin
When accessing the API using a cross-domain AJAX request (CORS) and using a session provider that is safe against cross-site request forgery (CSRF) attacks (such as OAuth), use this instead of
origin=*to make the request authenticated (i.e., not logged out). This must be included in any pre-flight request, and therefore must be part of the request URL (not the POST body).Note that most session providers, including standard cookie-based sessions, do not support authenticated CORS and cannot be used with this parameter.
- Type: boolean (details)
- uselang
La llingua que va utilizase pa les traducciones de mensaxes. action=query&meta=siteinfo con siprop=languages devuelve una llista de códigos de llingua, o puedes introducir user pa usar la preferencia d'idioma del usuariu actual, o content pa usar l'idioma del conteníu d'esta wiki.
- Default: user
- variant
Variant of the language. Only works if the base language supports variant conversion.
- errorformat
Formatu utilizáu pa la salida del testu d'avisos y errores.
- plaintext
- Testu Wiki coles etiquetes HTML desaniciaes y les entidaes reemplazaes.
- wikitext
- Testu Wiki ensin analizar.
- html
- HTML.
- raw
- Clave y parámetros del mensaxe.
- none
- Nenguna salida de testu, solo los códigos d'error.
- bc
- Formatu emplegáu en versiones de MediaWiki anteriores a la 1.29.
Nun se tienen en cuenta errorlang y errorsuselocal.
- plaintext
- Wikitext with HTML tags removed and entities replaced.
- wikitext
- Unparsed wikitext.
- html
- HTML
- raw
- Message key and parameters.
- 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
Idioma emplegáu p'avisos y errores. action=query&meta=siteinfo con siprop=languages devuelve una llista de códigos d'idioma, o especifica content pa utilizar la llingua del conteníu d'esta wiki o uselang pa utilizar el mesmu valor del parámetru uselang.
- Default: uselang
- errorsuselocal
Si se da, los testos d'error emplegarán los mensaxes personalizaos llocalmente del espaciu de nomes MediaWiki.
- Type: boolean (details)
- centralauthtoken
Al tener accesu a la API usando una solicitú AJAX ente dominios (CORS), usa esto pa identificate como l'usuariu SUL actual. Usa action=centralauthtoken nesta wiki pa recibir el pase, antes de facer la solicitú CORS. Cada pase sólo puede usase una vegada, y espira después de 10 segundos. Esto tendría d'incluise'n toa solicitú pre-vuelu, y poro tendría d'incluise na URI de la solicitú (non nel cuerpu POST).
On this wiki the expected value is a JSON Web Token, which may be validated by proxy servers in front of MediaWiki. If the token has expired or is otherwise invalid, you may receive a HTTP error from a proxy in a different format than a normal API error.
- Help for the main module.
- api.php?action=help [open in sandbox]
- All help in one page.
- api.php?action=help&recursivesubmodules=1&toc [open in sandbox]
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 mediawiki-api@lists.wikimedia.org or file a bug report at https://phabricator.wikimedia.org/.
