MediaWiki API ヘルプ

このページは自動生成された MediaWiki API の説明文書ページです。

説明文書と例: https://www.mediawiki.org/wiki/Special:MyLanguage/API:Main_page

メイン モジュール

状態: MediaWiki APIは、積極的にサポートされ、改善された成熟した安定したインターフェースです。避けようとはしていますが、時には破壊的変更を行う必要があるかもしれません。更新の通知を受け取るには、mediawiki-api-announce メーリングリストに参加してください。

誤ったリクエスト: 誤ったリクエストが API に送られた場合、"MediaWiki-API-Error" HTTP ヘッダーが送信され、そのヘッダーの値と送り返されるエラーコードは同じ値にセットされます。より詳しい情報は API:Errors and warnings を参照してください。

パラメーター:
action

実行する操作です。

adddomainalias
Add a domain alias to the wiki
block
利用者をブロックします。
changeauthenticationdata
現在の利用者の認証データを変更します。
changecontentmodel
ページのコンテンツモデルを変更します。
checktoken
action=query&meta=tokens のトークンの妥当性を確認します。
checkwikistatus
新しいWikiの作成プロセスが完了したか確認し、各段階および全プロセスのステータスを返します。
clearhasmsg
現在の利用者の hasmsg フラグを消去します。
clientlogin
インタラクティブフローを使用してウィキにログインします。
compare
2つの版間の差分を取得します。
confirmemail
createaccount
新しい利用者アカウントを作成します。
createnewwiki
新しいWikiの作成をはじめる
delete
ページを削除します。
edit
ページを作成、編集します。
emailuser
利用者にメールを送信します。
embedvideo
Get generated video embed code for given parameters.
expandtemplates
ウィキテキストに含まれるすべてのテンプレートを展開します。
feedcontributions
利用者の投稿記録フィードを返します。
feedrecentchanges
最近の更新フィードを返します。
feedwatchlist
ウォッチリストのフィードを返します。
filerevert
ファイルを古い版に差し戻します。
getmap
help
指定したモジュールのヘルプを表示します。
imagerotate
1つ以上の画像を回転させます。
imageserving
This module is used to return one image URL for the specified article given either the article ID or article title (with prefix if applicable).
import
別のウィキまたはXMLファイルからページをインポートする。
infobox
This module provides infobox parser
isuserscheduledforclosure
Check whether an user account is closed or scheduled to be closed.
linkaccount
Link an account from a third-party provider to the current user.
login
ログインして認証クッキーを取得します。
logout
ログアウトしてセッションデータを消去します。
maintenance
managetags
Perform management tasks relating to change tags.
mergehistory
ページの履歴を統合する。
modifydomainalias
Modify a domain alias to the wiki
move
ページを移動します。
multifindcharacter
notifications
Retrieve notifications for the current user.
opensearch
OpenSearch プロトコルを使用してウィキ内を検索します。
options
現在の利用者の設定を変更します。
paraminfo
API モジュールに関する情報を取得します。
parse
Parses content and returns parser output.
patrol
ページまたは版を巡回済みにする。
protect
ページの保護レベルを変更します。
purge
指定されたページのキャッシュを破棄します。
purgeimages
query
MediaWikiからデータを取得します。
removeauthenticationdata
Remove authentication data for the current user.
removedomainalias
Remove a domain alias for the wiki
renameuser
reopenwiki
resetpassword
利用者にパスワードをリセットするメールを送信します。
revisiondelete
版の削除および復元を行います。
rollback
ページの最後の編集を取り消す。
rsd
Export an RSD (Really Simple Discovery) schema.
savemap
savetheme
scheduledebuglonglivedtask
schedulesearchindexupdate
setnotificationtimestamp
Update the notification timestamp for watched pages.
setpagelanguage
ページの言語を変更します。
tag
個々の版または記録項目に対しタグの追加または削除を行います。
tagsreport
templatedata
TemplateData拡張機能の代替機能を提供するAPI実装。トランスクルージョンの該当するテンプレート・パラメータを取得するビジュアルエディタによって使用されます
titleblacklist
TitleBllacklist に対してページ名、ファイル名、利用者名を検証します。
unblock
利用者のブロックを解除します。
undelete
削除されたページの版を復元します。
unlinkaccount
Remove a linked third-party account from the current user.
updateprimarydomain
Update the primary domain of a wiki
updateuseremail
upload
Upload a file, or get the status of pending uploads.
uploadimage
userrights
利用者の所属グループを変更します。
validatepassword
Validate a password against the wiki's password policies.
verifytask
watch
現在の利用者のウォッチリストにページを追加/除去します。
webapp-manifest
Returns a webapp manifest.
annotatewikinotspam
内部で使用。 Wikiをスパムでないと注記
categorytree
内部で使用。 カテゴリツリー拡張機能の内部モジュール。
clearwikiconfigcache
内部で使用。 Wikiの設定キャッシュをクリアします。
createwikiconfigvariabledefinition
内部で使用。 設定変数を作成します。
cspreport
内部で使用。 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.
details
内部で使用。
linksuggest
内部で使用。
listusersnamesearch
内部で使用。
listuserssearchuser
内部で使用。
listwikiswithextension
内部で使用。 拡張機能が有効になっているWikiのリストを取得します。
listwikiswithvariable
内部で使用。 変数が指定のステータスであるWikiのリストを取得します。
lookupcontribs
内部で使用。 Lookup user contributions
markwikiclosed
内部で使用。 指定のWikiを閉鎖済み(非公開)にします。
markwikiopen
内部で使用。 指定のWikiを開設済み(一般公開)にします。
markwikiprotected
内部で使用。 閉鎖されないようWikiを保護済みにします。
masseditwikis
内部で使用。 Wikiのリストの設定変数を編集します。
multidelete
内部で使用。
refreshlinks
内部で使用。
removephalanxblock
内部で使用。
removewikiconfigvariable
内部で使用。 Wikiの設定変数を削除します。
savewikiconfigvariable
内部で使用。 Wikiの設定変数を指定します。
scribunto-console
内部で使用。 Internal module for servicing XHR requests from the Scribunto console.
stashedit
内部で使用。 Prepare an edit in shared cache.
suggestwiki
内部で使用。
suggestwikis
内部で使用。 ドメインに検索語句が含まれているWikiのリストを取得します。
togglephalanxblock
内部で使用。
updateHubs
内部で使用。 Wikiのカテゴリとジャンルを更新
updatewikiconfigvariabledefinition
内部で使用。 既存の設定変数のプロパティを更新します。
variableinfo
内部で使用。 指定の設定変数に関する詳細情報を取得します。
variableupdate
内部で使用。 変数情報を更新
visualeditor
内部で使用。 Returns HTML5 for a page from the Parsoid service.
visualeditoredit
内部で使用。 HTML5ページを MediaWiki として保存する (Parsoidサービスを利用してウィキテキストに変換されます)
値 (次の値のいずれか1つ): adddomainaliasblockchangeauthenticationdatachangecontentmodelchecktokencheckwikistatusclearhasmsgclientlogincompareconfirmemailcreateaccountcreatenewwikideleteeditemailuserembedvideoexpandtemplatesfeedcontributionsfeedrecentchangesfeedwatchlistfilerevertgetmaphelpimagerotateimageservingimportinfoboxisuserscheduledforclosurelinkaccountloginlogoutmaintenancemanagetagsmergehistorymodifydomainaliasmovemultifindcharacternotificationsopensearchoptionsparaminfoparsepatrolprotectpurgepurgeimagesqueryremoveauthenticationdataremovedomainaliasrenameuserreopenwikiresetpasswordrevisiondeleterollbackrsdsavemapsavethemescheduledebuglonglivedtaskschedulesearchindexupdatesetnotificationtimestampsetpagelanguagetagtagsreporttemplatedatatitleblacklistunblockundeleteunlinkaccountupdateprimarydomainupdateuseremailuploaduploadimageuserrightsvalidatepasswordverifytaskwatchwebapp-manifestannotatewikinotspamcategorytreeclearwikiconfigcachecreatewikiconfigvariabledefinitioncspreportdetailslinksuggestlistusersnamesearchlistuserssearchuserlistwikiswithextensionlistwikiswithvariablelookupcontribsmarkwikiclosedmarkwikiopenmarkwikiprotectedmasseditwikismultideleterefreshlinksremovephalanxblockremovewikiconfigvariablesavewikiconfigvariablescribunto-consolestasheditsuggestwikisuggestwikistogglephalanxblockupdateHubsupdatewikiconfigvariabledefinitionvariableinfovariableupdatevisualeditorvisualeditoredit
既定: help
format

出力する形式です。

json
データを JSON 形式で出力します。
jsonfm
データを JSON 形式 (HTML に埋め込んだ形式) で出力します。
none
何も出力しません。
php
データを PHP のシリアル化した形式で出力します。
phpfm
データを PHP のシリアル化した形式 (HTML に埋め込んだ形式) で出力します。
rawfm
データをデバッグ要素付きで JSON 形式 (HTML に埋め込んだ形式) で出力します。
xml
データを XML 形式で出力します。
xmlfm
データを XML 形式 (HTML に埋め込んだ形式) で出力します。
値 (次の値のいずれか1つ): jsonjsonfmnonephpphpfmrawfmxmlxmlfm
既定: jsonfm
maxlag

Maximum lag can be used when MediaWiki is installed on a database replicated cluster. To save actions causing any more site replication lag, this parameter can make the client wait until the replication lag is less than the specified value. In case of excessive lag, error code maxlag is returned with a message like Waiting for $host: $lag seconds lagged.
See Manual: Maxlag parameter for more information.

型: 整数
smaxage

s-maxage HTTP キャッシュ コントロール ヘッダー に、この秒数を設定します。エラーがキャッシュされることはありません。

型: 整数
既定: 0
maxage

max-age HTTP キャッシュ コントロール ヘッダー に、この秒数を設定します。エラーがキャッシュされることはありません。

型: 整数
既定: 0
assert

user に設定した場合は利用者がログインしていることを、 anon に設定した場合はログインしていないことを、bot の場合はボット利用者権限があることを検証します。

値 (次の値のいずれか1つ): anon、bot、user
assertuser

現在の利用者が指定された利用者であることを確認します。

型: 利用者名を使った利用者
requestid

任意の値を指定でき、その値が結果に含められます。リクエストを識別するために使用できます。

servedby

リクエストを処理したホスト名を結果に含めます。

型: 真偽値 (詳細)
curtimestamp

現在のタイムスタンプを結果に含めます。

型: 真偽値 (詳細)
responselanginfo

結果にuselangerrorlangに使用される言語を含めます。

型: 真偽値 (詳細)
origin

When accessing the API using a cross-domain AJAX request (CORS), set this to the originating domain. This must be included in any pre-flight request, and therefore must be part of the request URI (not the POST body).

For authenticated requests, this must match one of the origins in the Origin header exactly, so it has to be set to something like https://en.wikipedia.org or https://meta.wikimedia.org. If this parameter does not match the Origin header, a 403 response will be returned. If this parameter matches the Origin header and the origin is allowed, the Access-Control-Allow-Origin and Access-Control-Allow-Credentials headers will be set.

For non-authenticated requests, specify the value *. This will cause the Access-Control-Allow-Origin header to be set, but Access-Control-Allow-Credentials will be false and all user-specific data will be restricted.

uselang

メッセージの翻訳に使用する言語です。action=query&meta=siteinfosiprop=languages を付けると言語コードの一覧を返します。user を指定することで現在の利用者の個人設定の言語を、content を指定することでこのウィキの本文の言語を使用することもできます。

既定: user
variant

言語変種。基本言語が言語変種変換をサポートしている場合のみ機能します。

errorformat

警告およびエラーテキストの出力に使用する形式

plaintext
HTMLタグを除去し、実体を置換したウィキテキスト。
wikitext
パースされていないウィキテキスト。
html
HTML
raw
メッセージキーとパラメーター。
none
テキスト出力なし、エラーコードのみ。
bc
MediaWiki 1.29より前に使われていた形式。 errorlang および errorsuselocal は無視されます。
値 (次の値のいずれか1つ): bc、html、none、plaintext、raw、wikitext
既定: bc
errorlang

警告およびエラーで使用する言語。 action=query&meta=siteinfosiprop=languages があると言語コードの一覧を返し、 content を指定するとこのウィキのコンテンツ言語を使用し、uselang を指定すると uselang パラメーターと同じ値を使用します。

既定: uselang
errorsuselocal

指定された場合、エラーテキストはMediaWiki名前空間からローカルにカスタマイズされたメッセージを使用します。

型: 真偽値 (詳細)
例:
メイン モジュールのヘルプ
api.php?action=help [サンドボックスで開く]
すべてのヘルプを1つのページに
api.php?action=help&recursivesubmodules=1 [サンドボックスで開く]
権限:
writeapi
書き込み API を使用
権限を持つグループ: all、user および bot
apihighlimits
Use higher limits in API queries (slow queries: 500; fast queries: 5000). The limits for slow queries also apply to multivalue parameters.
権限を持つグループ: bot、sysop、staff、helper、soap、wiki-representative および wiki-specialist

データ型

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

真偽値のパラメーターはHTMLのチェックボックスのように機能します: パラメーターが指定されていれば、値に関わらず、真であると推定します。偽の値については、パタメーター自体を省略してください。

expiry

期間は、相対値(例えば、5 months2 weeks)または絶対値(例えば、2014-09-18T12:34:56Z)のどちらかで指定します。期間を定めない場合は、infinite, indefinite, infinity または 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.

クレジット

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/