MediaWiki API ヘルプ

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

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

メイン モジュール

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

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

パラメーター:
action

実行する操作です。

block
利用者をブロックします。
categorytree
カテゴリツリー拡張機能の内部モジュール。
changeauthenticationdata
現在の利用者の認証データを変更します。
checktoken
action=query&meta=tokens のトークンの妥当性を確認します。
clearhasmsg
現在の利用者の hasmsg フラグを消去します。
clientlogin
インタラクティブフローを使用してウィキにログインします。
compare
2つの版間の差分を取得します。
createaccount
新しい利用者アカウントを作成します。
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.
delete
ページを削除します。
edit
ページを作成、編集します。
emailuser
利用者にメールを送信します。
expandtemplates
ウィキテキストに含まれるすべてのテンプレートを展開します。
feedcontributions
利用者の投稿記録フィードを返します。
feedrecentchanges
最近の更新フィードを返します。
feedwatchlist
ウォッチリストのフィードを返します。
filerevert
ファイルを古い版に差し戻します。
help
指定したモジュールのヘルプを表示します。
imagerotate
1つ以上の画像を回転させます。
import
他のWikiまたはXMLファイルからページを取り込む。
linkaccount
Link an account from a third-party provider to the current user.
login
ログインして認証クッキーを取得します。
logout
ログアウトしてセッションデータを消去します。
managetags
Perform management tasks relating to change tags.
mergehistory
ページの履歴を統合する。
move
ページを移動します。
oathvalidate
Validate a two-factor authentication (OATH) token.
opensearch
OpenSearch プロトコルを使用してWiki内を検索します。
options
Change preferences of the current user.
paraminfo
API モジュールに関する情報を取得します。
parse
Parses content and returns parser output.
patrol
ページまたは版を巡回済みにする。
protect
ページの保護レベルを変更します。
purge
指定されたページのキャッシュを破棄します。
query
MediaWikiからデータを取得します。
removeauthenticationdata
Remove authentication data for the current user.
resetpassword
Send a password reset email to a user.
revisiondelete
版の削除および復元を行います。
rollback
ページの最後の編集を取り消す。
rsd
Export an RSD (Really Simple Discovery) schema.
scribunto-console
Internal module for servicing XHR requests from the Scribunto console.
setnotificationtimestamp
Update the notification timestamp for watched pages.
setpagelanguage
ページの言語を変更します。
spamblacklist
1件以上の URL についてスパムブラックリストに登録されているか検証します。
stashedit
Prepare an edit in shared cache.
tag
個々の版または記録項目に対しタグの追加または削除を行います。
titleblacklist
Validate a page title, filename, or username against the TitleBlacklist.
unblock
利用者のブロックを解除します。
undelete
削除されたページの版を復元します。
unlinkaccount
Remove a linked third-party account from the current user.
upload
Upload a file, or get the status of pending uploads.
userrights
利用者の所属グループを変更します。
validatepassword
Validate a password against the wiki's password policies.
watch
現在の利用者のウォッチリストにページを追加/除去します。
tokens
廃止予定です。 Get tokens for data-modifying actions.
値 (次の値のいずれか1つ): blockcategorytreechangeauthenticationdatachecktokenclearhasmsgclientlogincomparecreateaccountcspreportdeleteeditemailuserexpandtemplatesfeedcontributionsfeedrecentchangesfeedwatchlistfilereverthelpimagerotateimportlinkaccountloginlogoutmanagetagsmergehistorymoveoathvalidateopensearchoptionsparaminfoparsepatrolprotectpurgequeryremoveauthenticationdataresetpasswordrevisiondeleterollbackrsdscribunto-consolesetnotificationtimestampsetpagelanguagespamblackliststashedittagtitleblacklistunblockundeleteunlinkaccountuploaduserrightsvalidatepasswordwatchtokens
既定値: 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.

Type: integer
smaxage

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

Type: integer
既定値: 0
maxage

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

Type: integer
既定値: 0
assert

user を設定した場合は利用者がログイン済みかどうかを、bot を指定した場合はボット権限があるかどうかを、それぞれ検証します。

値 (次の値のいずれか1つ): userbot
assertuser

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

Type: user name
requestid

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

servedby

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

Type: boolean (details)
curtimestamp

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

Type: boolean (details)
responselanginfo

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

Type: boolean (details)
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 whitelisted, 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
errorformat

Format to use for warning and error text output.

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.
値 (次の値のいずれか1つ): plaintextwikitexthtmlrawnonebc
既定値: bc
errorlang

Language to use for warnings and errors. action=query&meta=siteinfo with siprop=languages returns a list of language codes, or specify content to use this wiki's content language, or specify uselang to use the same value as the uselang parameter.

既定値: uselang
errorsuselocal

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

Type: boolean (details)
例:
メイン モジュールのヘルプ
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

データ型

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.

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.
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.
alternative multiple-value separator
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.

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 の開発者:

  • Roan Kattouw (2007年9月-2009年の主任開発者)
  • Victor Vasiliev
  • Bryan Tong Minh
  • Sam Reed
  • Yuri Astrakhan (作成者、2006年9月-2007年9月の主任開発者)
  • Brad Jorsch (2013年-現在の主任開発者)

コメント、提案、質問は mediawiki-api@lists.wikimedia.org にお送りください。 バグはこちらへご報告ください: https://phabricator.wikimedia.org/