MediaWiki API help

This is an auto-generated MediaWiki API documentation page.

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

Main module

Status: The MediaWiki API is a mature and stable interface that is actively supported and improved. While we try to avoid it, we may occasionally need to make breaking changes; subscribe to the mediawiki-api-announce mailing list for notice of updates.

Erroneous requests: When erroneous requests are sent to the API, an HTTP header will be sent with the key "MediaWiki-API-Error" and then both the value of the header and the error code sent back will be set to the same value. For more information see API: Errors and warnings.

Parameters:
action

Katero dejanje izvesti.

block
Block a user.
changeauthenticationdata
Change authentication data for the current user.
changecontentmodel
Change the content model of a page
checktoken
Check the validity of a token from action=query&meta=tokens.
clearhasmsg
Clears the hasmsg flag for the current user.
clientlogin
Log in to the wiki using the interactive flow.
compare
Get the difference between two pages.
createaccount
Create a new user account.
delete
Izbriše stran.
edit
Ustvarjanje in urejanje strani.
emailuser
Email a user.
expandtemplates
Razširi vse predloge v vikibesedilu.
feedcontributions
Returns a user's contributions feed.
feedrecentchanges
Vrne vir zadnjih sprememb
feedwatchlist
Vrne vir spiska nadzorov.
filerevert
Revert a file to an old version.
help
Display help for the specified modules.
imagerotate
Rotate one or more images.
import
Import a page from another wiki, or from an XML file.
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.
mergehistory
Merge page histories.
move
Prestavi stran.
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
Počisti predpomnilnik za dane naslove.
query
Pridobi podatke MediaWikija in o MediaWikiju.
removeauthenticationdata
Remove authentication data for the current user.
resetpassword
Send a password reset email to a user.
revisiondelete
Izbriše in odizbriše redakcije.
rollback
Undo the last edit to the page.
rsd
Export an RSD (Really Simple Discovery) schema.
setnotificationtimestamp
Update the notification timestamp for watched pages.
setpagelanguage
Change the language of a page.
tag
Add or remove change tags from individual revisions or log entries.
unblock
Unblock a user.
undelete
Odizbris redakcij izbrisane strani.
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
Dodatek ali odstranitev strani s spiska nadzora
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.
stashedit
Internal. Prepare an edit in shared cache.
One of the following values: block, changeauthenticationdata, changecontentmodel, checktoken, clearhasmsg, clientlogin, compare, createaccount, delete, edit, emailuser, expandtemplates, feedcontributions, feedrecentchanges, feedwatchlist, filerevert, help, imagerotate, import, linkaccount, login, logout, managetags, mergehistory, move, opensearch, options, paraminfo, parse, patrol, protect, purge, query, removeauthenticationdata, resetpassword, revisiondelete, rollback, rsd, setnotificationtimestamp, setpagelanguage, tag, unblock, undelete, unlinkaccount, upload, userrights, validatepassword, watch, cspreport, stashedit
Privzeto: help
format

Oblika izhoda.

json
Izhodni podatki v formatu JSON.
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
Izhodni podatki v formatu XML.
xmlfm
Output data in XML format (pretty-print in HTML).
One of the following values: json, jsonfm, none, php, phpfm, rawfm, xml, xmlfm
Privzeto: jsonfm
maxlag

Največja zakasnitev se lahko uporabi, če je MediaWiki nameščen v gruči z replicirano podatkovno bazo. Če želite prihraniti dejanja, ki bi povzročila večjo zakasnitev replikacije spletnega mesta, lahko s tem parametrom odjemalec počaka, da je zakasnitev replikacije manjša od določene vrednosti. V primeru prevelike zakasnitve se vrne koda napake maxlag s sporočilom, kot je Waiting for $host: $lag seconds lagged.
Za več informacij glejte Manual: Maxlag parameter.

Vtipkajte: celo število
smaxage

Nastavite kontrolno glavo s-maxage predpomnenja HTTP na to število sekund. Napake se nikoli ne predpomnijo.

Vtipkajte: celo število
Privzeto: 0
maxage

Nastavite kontrolno glavo max-age predpomnenja HTTP na to število sekund. Napake se nikoli ne predpomnijo.

Vtipkajte: celo število
Privzeto: 0
assert

Preveri, ali je uporabnik prijavljen, če je nastavljeno na user, ni prijavljen, če je nastavljeno na anon, če je bot, pa ima uporabniško pravico bota.

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

Preveri, ali je trenutni uporabnik poimenovani uporabnik.

Vrsta: uporabnik, ki ustreza uporabniško ime
requestid

V odgovor bo vključena vsaka tu navedena vrednost. Lahko se uporablja za razločevanje zahtevkov.

servedby

V rezultate vključi ime gostitelja, ki je posredoval zahtevek.

Type: boolean (details)
curtimestamp

V rezultat vključi trenutni časovni žig.

Type: boolean (details)
responselanginfo

V rezultat vključi jezike, ki se uporabljajo za uselang in errorlang.

Type: boolean (details)
origin

Če do API-ja dostopate z meddomensko zahtevo AJAX (CORS), to nastavite na domeno izvora. To mora biti vključeno v vsak predpoletni zahtevek, zato mora biti del URI-ja zahtevka (in ne telesa POST).

Pri avtentificiranih zahtevkih se mora to natančno ujemati z enim od izvorov v glavi Origin, zato je to treba nastaviti na nekaj takega kot https://en.wikipedia.org ali https://meta.wikimedia.org. Če se ta parameter ne ujema z glavo Origin, bo vrnjen odgovor 403. Če se ta parameter ujema z glavo Origin in je izvor dovoljen, bosta nastavljeni glavi Access-Control-Allow-Origin in Access-Control-Allow-Credentials.

Za neavtentificirane zahtevke določite vrednost *. To bo povzročilo, da bo nastavljena glava Access-Control-Allow-Origin, vendar bo Access-Control-Allow-Credentials false in bodo vsi podatki, specifični za uporabnika, omejeni.

uselang

Jezik, ki se uporablja za prevajanje sporočil. action=query&meta=siteinfo s siprop=languages vrne seznam jezikovnih kod ali določi user za uporabo jezikovne preference trenutnega uporabnika ali določi content za uporabo jezika vsebine tega vikija.

Privzeto: user
variant

Različica jezika. Deluje le, če osnovni jezik podpira pretvorbo variant.

errorformat

Oblika, ki se uporablja za izpis besedila o opozorilih in napakah

plaintext
Wikitext with HTML tags removed and entities replaced.
wikitext
Nerazčlenjeno vikibesedilo.
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
Privzeto: bc
errorlang

Jezik, ki se uporablja za opozorila in napake. Določite eno od jezikovnih kod, ki jih vrne action=query&meta=siteinfo s siprop=languages ali pa določite content za uporabo jezika vsebine tega vikija ali uselang za uporabo iste vrednosti kot parameter uselang (preferenčni jezik uporabnika).

Privzeto: uselang
errorsuselocal

Če je podano, bodo besedila o napakah uporabljala lokalno prilagojena sporočila iz imenskega prostora MediaWiki.

Type: boolean (details)
Permissions:
writeapi
Uporaba API-ja za pisanje
Granted to: all, user in bot
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 in sysop

Vrste podatkov

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

Vrednosti časa preteka so lahko relativne (npr. 5 months ali 2 weeks ) ali absolutne (npr. 2014-09-18T12:34:56Z). Če ne želite določiti časa preteka, uporabite infinite , indefinite, infinity ali 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 mediawiki-api@lists.wikimedia.org or file a bug report at https://phabricator.wikimedia.org/.