MediaWiki API ?助

?是自?生成的MediaWiki API文??面。

文?和例子: -{R|https://www.mediawiki.org/wiki/Special:MyLanguage/API:Main_page}-

主模?

??: MediaWiki API已是成熟?定的接口,且?得到??的支持和改?。?管我??力避免,但偶?也需要作出重大更新;??? mediawiki-api-announce ?件列表 以便?得更新通知。

???求: ?API收到???求?,HTTP header??返回一?包含"MediaWiki-API-Error"的?,?后header的????代???返回??置?相同的?。??信息??? API:???警告

具???:
action

要?行的操作。

abusefiltercheckmatch
??以?看?用??器是否匹配某??量集、某次??或某?日志??的??器活?。
abusefilterchecksyntax
??一??用??器的?法。
abusefilterevalexpression
?防?用??器表?式求?。
abusefilterunblockautopromote
通?解除因?用??器操作生效的自?提升???解封用?。
abuselogprivatedetails
?示AbuseLog?目的私有?情。
acquiretempusername
?用?????建?且?前用?已退出?,?取??用?的用?名??其存?在?前??中。如果名?已存?,?返回相同的名?。
antispoof
??用?名是否?犯AntiSpoof的常???。
block
封禁一位用?。
centralauthtoken
取得centralauthtoken用于已??的一?附加到wiki的?求。
centralnoticecdncacheupdatebanner
在?求的?幅及?言中,?求?匿名用?刷新在CDN(前端)存?的?幅?存
centralnoticechoicedata
?于指定?目和?言,?取??一??幅需要的?据
centralnoticequerycampaign
?取一?通?的所有配置?置。
changeauthenticationdata
更改?前用?的身????据。
changecontentmodel
?更?面的?容模型
checktoken
? action=query&meta=tokens ??令牌有效性。
cirrus-config-dump
CirrusSearch配置的??。
cirrus-mapping-dump
用于此wiki的CirrusSearch映射??。
cirrus-profiles-dump
此Wiki上的CirrusSearch配置文件??。
cirrus-settings-dump
用于此wiki的CirrusSearch?置??。
clearhasmsg
?除?前用?的 hasmsg ??。
clientlogin
使用交互式流登?wiki。
compare
?取??面之?的差?。
createaccount
?建新用???。
createlocalaccount
强行?建本地??。中央??必?存在。
cxdelete
?除一?用???展?建的??草稿。
cxsuggestionlist
管理建?列表。添加建?至列表?移除??。
cxtoken
?取JWT令牌以通?cxserver的身???。
delete
?除一??面。
deleteglobalaccount
?除一?全域用?。
discussiontoolsedit
在???面上?布留言。
discussiontoolsfindcomment
按ID或名???留言。
discussiontoolsgetsubscriptions
?取?定??的????。
discussiontoolssubscribe
??(或取消??)?接收有???的通知。
discussiontoolsthank
?送公?的感?留言通知。
echocreateevent
手????用?的通知
echomarkread
把?前用?的通知???已?。
echomarkseen
把?前用?的通知???已?看。
echomute
?蔽或取消?蔽?自特定用?或?面的通知。
edit
?建和???面。
editmassmessagelist
??大量信息?送列表。
emailuser
?子?件?系一位用?。
expandtemplates
展?wikitext中的所有模板。
featuredfeed
返回特色?容源。
feedcontributions
返回用????要。
feedrecentchanges
返回最近更改的摘要。
feedwatchlist
返回??列表?要。
filerevert
回退一?文件至某一?版本。
flow
允????化???面的操作。
flow-parsoid-utils
在wikitext和HTML之?互相??文本。
flowthank
?一?Flow??公??送感?通知。
globalblock
全域封禁或解封一位用?。
globalpreferenceoverrides
??前用?的全域???置更改本地覆盖。
globalpreferences
更改?前用?的全域???置。
globaluserrights
?一位用?添加至全域用??,或?其??中移除。
growthmanagementorlist
管理在結構化導師?單中的資訊(通常存放在 MediaWiki:GrowthMentors.json 中)。此模組可被目前與往後的導師(新增他們自己或是變更他們的詳細資訊)以及管理員(適用於所有使用者)來使用。
growthmentordashboardupdatedata
安排??面板中????的特?更新。由于性能原因?每??小?只能安排一次更新。
growthsetmenteestatus
設定學員的狀態(允許學員?用/停用導師計?模組或完全退出以刪除學員和導師的關係)
growthsetmentor
?置用?的??。??更?被公???。
growthstarmentee
由目前用??????或取消??星?(私密存?且不??)
help
?示指定模?的?助。
homepagequestionstore
?取通?主?模??布,?且已格式化的??
imagerotate
此模?已禁用。
import
?其他wiki,或?XML文件?入?面。
jsonconfig
允?直接??JsonConfig子系?。
languagesearch
使用任何字母搜索?言名?。
linkaccount
??自第三方提供商的???接至?前用?。
login
登???取身???cookie。
logout
退出??除???据。
managetags
?行有?更改??的管理任?。
massmessage
?送一?信息到列出的多??面。
mergehistory
合??面?史。
move
移?一??面。
opensearch
使用?放搜索??搜索wiki。
options
更改?前用?的???置。
paraminfo
?得?于API模?的信息。
parse
解析?容?返回解析器?出。
patrol
巡??面或修?版本。
protect
更改?面的保?等?。
purge
?指定??刷新?存。
query
取得?自?有?MediaWiki的?据。
removeauthenticationdata
??前用?移除身????据。
resetpassword
向用??送密?重置?件。
revisiondelete
?除和恢?修?版本。
rollback
撤???面的最近??。
rsd
?出一?RSD(Really Simple Discovery)架?。
setglobalaccountstatus
?藏/?定(以及解除?藏/?定)全域用???。
setnotificationtimestamp
更新???面的通知???。
setpagelanguage
更改?面的?言。
shortenurl
把??的URL?短?短URL。
sitematrix
?取?基媒??站列表。
spamblacklist
??一?或多?URL是否?于???接阻止列表。
streamconfigs
公?事件流配置。?返回format=json且formatversion=2。
strikevote
允?管理?作?或取消作?投票。
sxdelete
??据?中?除草稿章???及其平行?料。
tag
???修?或日志??中添加或移除更改??。
templatedata
?取由模板?据?展存?的?据。
thank
向一名??者?送感?通知。
titleblacklist
??一??面的??、文件名或用?名是否????黑名?。
torblock
??某? IP 地址是否作? Tor 出口?点被阻止。
transcodereset
持有“transcode-reset”?限的用?可以重置?重???任?。
unblock
解封一位用?。
undelete
取消?除?面的修?版本。
unlinkaccount
??前用?移除已?接的第三方??。
upload
上?文件,或?取正在等待中的上?的??。
userrights
更改一位用?的?成?。
validatepassword
??密?是否符合wiki的密?方?。
watch
??前用?的??列表中添加或移除?面。
webapp-manifest
返回webapp?明。
webauthn
API模?,用于在注?/身????程中在服?器和客?端之??行通信。
wikilove
??一用??基有?。
bouncehandler
?部的。 接收退回的?子?件??理?以?理失?的容器。
categorytree
?部的。 用于CategoryTree?展的?部模?。
cirrus-check-sanity
?部的。 Reports on the correctness of a range of page ids in the search index
cspreport
?部的。 由??器使用以?告?反?容安全方?的?容。此模??永不使用,除了在被CSP兼容的??器自?使用?。
cxcheckunreviewed
?部的。 Check if any fast, unreviewed translation has been published recently for the current user.
cxpublish
?部的。 保存用?容???展?建的?面。
cxpublishsection
?部的。 保存使用?容???展的章???功能?建的章?。
cxsave
?部的。 此模?允?保存按章?的草稿??以?省??,?收集平行的?料?。
cxsplit
?部的。 Create and save a section translation to database, for every translated section of the given article translation
discussiontoolscompare
?部的。 ?取???面修??留言更改的有?信息。
discussiontoolspageinfo
?部的。 返回初始化??工具所需的元?据。
discussiontoolspreview
?部的。 ?????面上的留言。
echopushsubscriptions
?部的。 管理?前用?的推送??。
editcheckreferenceurl
?部的。 Check the status of a URL for use as a reference.
fancycaptchareload
?部的。 ?得一?新的FancyCaptcha。
growthinvalidateimagerecommendation
?部的。 作廢圖片推薦。
growthinvalidatepersonalizedpraisesuggestion
?部的。 讓導師面板上個性化表揚模組的?得表揚學員建議無效
helppanelquestionposter
?部的。 ??前用??理通??助面板?布的??。
jsondata
?部的。 取得本地化JSON?据。
oathvalidate
?部的。 ??一??因素??(OATH)令牌。
parser-migration
?部的。 使用??不同的解析器配置解析?面。
readinglists
?部的。 ??列表?入操作。
sanitize-mapdata
?部的。 ?Kartographer?展?行?据??
scribunto-console
?部的。 ?Scribunto控制台提供XHR?求的?部模?。
securepollauth
?部的。 Allows a remote wiki to authenticate users before granting access to vote in the election.
stashedit
?部的。 在分享?存中准???。
sxsave
?部的。 保存草稿章節?譯,?存儲平行語料庫
timedtext
?部的。 提供被音?元素所使用的字幕
ulslocalization
?部的。 ?取指定?言的ULS本地化。
ulssetlang
?部的。 更新用?的首?界面?言。
visualeditor
?部的。 ?Parsoid服?返回?面的HTML5。
visualeditoredit
?部的。 保存一?HTML5?面至MediaWiki(通?Parsoid服????wikitext)。
wikimediaeventsblockededit
?部的。 有關禁止編輯嘗試的日誌資訊
以下?中的一?: abusefiltercheckmatch 、? abusefilterchecksyntax 、? abusefilterevalexpression 、? abusefilterunblockautopromote 、? abuselogprivatedetails 、? acquiretempusername 、? antispoof 、? block 、? centralauthtoken 、? centralnoticecdncacheupdatebanner 、? centralnoticechoicedata 、? centralnoticequerycampaign 、? changeauthenticationdata 、? changecontentmodel 、? checktoken 、? cirrus-config-dump 、? cirrus-mapping-dump 、? cirrus-profiles-dump 、? cirrus-settings-dump 、? clearhasmsg 、? clientlogin 、? 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 、? flow-parsoid-utils 、? flow 、? flowthank 、? 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 、? wikilove 、? bouncehandler 、? categorytree 、? cirrus-check-sanity 、? 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
默?:help
format

?出的格式。

json
?出?据?JSON格式。
jsonfm
?出?据?JSON格式(使用HTML格式?示)。
none
不?出任何?西。
php
?出?据?序列化PHP格式。
phpfm
?出?据?序列化PHP格式(使用HTML格式?示)。
rawfm
?出?据?JSON格式,包含??元素(使用HTML格式?示)。
xml
?出?据?XML格式。
xmlfm
?出?据?XML格式(使用HTML格式?示)。
以下?中的一?: json 、? jsonfm 、? none 、? php 、? phpfm 、? rawfm 、? xml 、? xmlfm
默?:jsonfm
maxlag

最大延?可被用于MediaWiki安?于?据??制集中。要保存?致更多?站?制延?的操作,此??可使客?端等待直到?制延?少于指定??。万一?生?多延?,??代? maxlag ?返回消息,例如 等待$host中:延?$lag秒
?? 手?:Maxlag?? 以?取更多信息。

?型:整?
smaxage

?置 s-maxage HTTP?存控制?至?些秒。??不??存。

?型:整?
?必?不少于0。
默?:0
maxage

?置 max-age HTTP?存控制?至?些秒。??不??存。

?型:整?
?必?不少于0。
默?:0
assert

如果?置? user ,???用?是否已登?(包括以??用?身?登?);如果?置? anon ,???用?是否 登?;如果?置? bot ,???用?是否?有机器人用??限。

以下?中的一?:anon、?bot、?user
assertuser

???前用?是命名用?。

?型:通? 用?名和??用? 中任意一?方式指定的用?
requestid

任何在此提供的??包含在??中。可以用以???求。

servedby

包含保存?果?求的主机名。

?型:布?型 ( ?情 )
curtimestamp

在?果中包括?前???。

?型:布?型 ( ?情 )
responselanginfo

包含在?果中用于 uselang errorlang 的?言。

?型:布?型 ( ?情 )
origin

使用跨域AJAX?求(CORS)??API?,??其?置??源域。?必?包括在任何???求中,因此必?是?求URI(而不是POST正文)的一部分。

?于已??的?求,?必?正?匹配 Origin ??中的?源之一,因此必??其?置??似 -{R|https://zh.wikipedia.org}- -{R|https://meta.wikimedia.org}- 的?。如果此??? Origin ??不匹配,?返回403??。如果此??? Origin ??匹配?且?源被允?,???置 Access-Control-Allow-Origin Access-Control-Allow-Credentials ??。

?于未??的?求,?指定? * 。???致 Access-Control-Allow-Origin ??被?置,但 Access-Control-Allow-Credentials ?? false ,且所有用?特定?据?受限制。

uselang

用于消息??的?言。 action=query&meta=siteinfo&siprop=languages 可返回?言代?列表。?可以指定 user 以使用?前用?的?言?置,或指定 content 以使用此wiki的?容?言。

默?:user
variant

?言??。??基??言支持?????起作用。

errorformat

用于警告和??文本?出的格式

plaintext
包括HTML??的wikitext被移除?且??被替?。
wikitext
未解析的wikitext。
html
HTML
raw
消息的?和??。
none
?有文本?出,?有??代?。
bc
MediaWiki 1.29之前使用的格式。 errorlang errorsuselocal ?被忽略。
以下?中的一?:bc、?html、?none、?plaintext、?raw、?wikitext
默?:bc
errorlang

用于警告和??的?言。 action=query&meta=siteinfo&siprop=languages 返回?言代?的列表。指定 content 以使用此wiki的?容?言,或指定 uselang 以使用? uselang ??相同的?。

默?:uselang
errorsuselocal

如果指定,??文本?使用?自MediaWiki命名空?的本地自定?消息。

?型:布?型 ( ?情 )
centralauthtoken

?使用跨域名AJAX?求(CORS)??API?,使用?以????前的SUL用?。在?行CORS?求前,在此wiki使用 action=centralauthtoken 以?索令牌。每?令牌只可以使用一次,?在10秒后?期。??包含在任何?先?求中,?因此?包含在?求URI中(而不是在POST正文中)。

?限:
writeapi
使用?入API
授予:all、?user和bot
apihighlimits
在API??中使用更高的上限(慢??:500;快??:5000)。慢??的限制也适用于多???。
授予:bot和sysop

?据?型

MediaWiki的?入??是NFC?范化的UTF-8。MediaWiki可能?????其他?入,但?可能??致某些操作(例如 ?? ?有MD5??)失?。

采用多??的??通常?使用管道字符分隔的?一起提交,例如 param=value1|value2 param=value1%7Cvalue2 。如果?必?包含??字符,?使用U+001F(?位分隔符)作?分隔符 ?且 用U+001F作???的前?,例如 param=%1Fvalue1%1Fvalue2

API?求中的一些???型需要?一步?明:

boolean

布???的工作方式?似于HTML???:如果指定了??,无??如何,?都被??是true。?于假?,完全省略??。

expiry

到期??。可以是相???(例如: 5 months 2 weeks )或是????(例如: 2014-09-18T12:34:56Z )。如果要无期限,?使用 infinite indefinite infinity 、或 never

timestamp

???可以用多?格式指定,?情?? mediawiki.org上??的?????入格式 。建?使用ISO 8601日期和??: 2001 - 01 - 15 T 14 : 56 : 00 Z 。此外,字符串 now 可用于指定?前???。

模板??

模板??支持API模?需要?每?其他????的情?。例如如果有API模??求水果,??有?? 水果 指定?求的水果,以及模板?? {水果}-?量 以指定每?水果?求多少。需要1??果、5?香蕉和20?草?的API客?端可以做出?似 水果=?果|香蕉|草?&?果-?量=1&香蕉-?量=5&草?-?量=20 的?求。

制作人?

API ??人?:

  • Yuri Astrakhan(?建者,2006年9月~2007年9月的?????)
  • Roan Kattouw(2007年9月~2009年的?????)
  • Victor Vasiliev
  • Bryan Tong Minh
  • Sam Reed
  • Brad Jorsch(2013年~2020年的?????)

???的??、建?和???送至mediawiki-api@lists.wikimedia.org,或提交???求至https://phabricator.wikimedia.org/。