MediaWiki API ヘルプ
このページは自動生成された MediaWiki API の説明文書ページです。
説明文書と例: https://www.mediawiki.org/wiki/Special:MyLanguage/API:Main_page
action=upload
- このモジュールは読み取りの権限を必要とします。
- このモジュールは書き込みの権限を必要とします。
- このモジュールは POST リクエストのみを受け付けます。
- ソース: MediaWiki
- ライセンス: GPL-2.0-or-later
Upload a file, or get the status of pending uploads.
Several methods are available:
- Upload file contents directly, using the file parameter.
- Upload the file in pieces, using the filesize, chunk, and offset parameters.
- Have the MediaWiki server fetch a file from a URL, using the url parameter.
- Complete an earlier upload that failed due to warnings, using the filekey parameter.
Note that the HTTP POST must be done as a file upload (i.e. using multipart/form-data) when sending the file.
- filename
- 対象のファイル名。 
- comment
- アップロードのコメント。新規ファイルのアップロードで text が指定されていない場合、初期ページテキストとしても使用されます。 
- 既定値: (空)
- tags
- Change tags to apply to the upload log entry and file page revision. 
- 値 (| または別の文字列で区切る):
- text
- 新しいファイルの初期ページテキスト。 
- watch
- 廃止予定です。
- このページをウォッチする。 
- 型: 真偽値 (詳細)
- watchlist
- Unconditionally add or remove the page from the current user's watchlist, use preferences (ignored for bot users) or do not change watch. 
- 値 (次の値のいずれか1つ): nochange、preferences、watch
- 既定: preferences
- ignorewarnings
- あらゆる警告を無視する。 
- 型: 真偽値 (詳細)
- file
- File contents. 
- ファイルアップロードには multipart/form-data を使って投稿してください。
- url
- ファイル取得元のURL. 
- filekey
- Key that identifies a previous upload that was stashed temporarily. 
- sessionkey
- 廃止予定です。
- Same as filekey, maintained for backward compatibility. 
- stash
- If set, the server will stash the file temporarily instead of adding it to the repository. 
- 型: 真偽値 (詳細)
- filesize
- Filesize of entire upload. 
- 型: 整数
- 値は0以上104,857,600以下です。
- offset
- Offset of chunk in bytes. 
- 型: 整数
- 値の下限は必ず0以上です。
- chunk
- Chunk contents. 
- ファイルアップロードには multipart/form-data を使って投稿してください。
- async
- Make potentially large file operations asynchronous when possible. 
- 型: 真偽値 (詳細)
- checkstatus
- Only fetch the upload status for the given file key. 
- 型: 真偽値 (詳細)
- token
- action=query&meta=tokens から取得した「csrf」トークン 
- この変数は必須です。
- Upload from a URL.
- api.php?action=upload&filename=Wiki.png&url=http%3A//upload.wikimedia.org/wikipedia/en/b/bc/Wiki.png&token=123ABC [サンドボックスで開く]
- Complete an upload that failed due to warnings.
- api.php?action=upload&filename=Wiki.png&filekey=filekey&ignorewarnings=1&token=123ABC [サンドボックスで開く]