API:削除された版
Appearance
このページは MediaWiki 操作 API の説明文書の一部です。 |
MediaWiki バージョン: | ≦ 1.25 |
(1.25 で廃止予定) The API documentation described here will work best with MediaWiki 1.14 and earlier. It has been deprecated in favor of
alldeletedrevisions
api削除された版を列挙する GET リクエストです。
APIの説明文書
例
GET リクエスト
List the 6 most recent deleted revisions from user Catrope dated September 4, 2007.
api.php? action=query& list=deletedrevs& drstart=20070904235959& drend=20070904000000& drprop=revid|user|minor|len|token& drlimit=6& druser=Catrope& format=json [ApiSandbox で試用する]
レスポンス
<?xml version="1.0" encoding="utf-8"?>
<api>
<query-continue>
<deletedrevs drstart="20070904142729" />
</query-continue>
<query>
<deletedrevs>
<page title="Main Page" ns="0" token="e4c475f13be7824135b4edbebf4140ff+\">
<revisions>
<rev timestamp="20070904200804" revid="31" user="Catrope" minor="" len="" />
<rev timestamp="20070904200753" revid="30" user="Catrope" minor="" len="" />
<rev timestamp="20070904193501" revid="29" user="Catrope" minor="" len="568" />
<rev timestamp="20070904193213" revid="28" user="Catrope" minor="" len="470" />
</revisions>
</page>
<page title="User:Catrope" ns="2" token="e4c475f13be7824135b4edbebf4140ff+\">
<revisions>
<rev timestamp="20070904143938" revid="24" user="Catrope" len="52" />
<rev timestamp="20070904142758" revid="23" user="Catrope" len="37" />
</revisions>
</page>
</deletedrevs>
</query>
</api>
サンプル コード
get_deleted_revisions.py
#!/usr/bin/python3
"""
get_deleted_revisions.py
MediaWiki Action API Code Samples
Demo of `Deletedrevs` module: List the six most recent deleted revisions
from User:Catrope
MIT License
"""
import requests
S = requests.Session()
URL = "https://en.wikipedia.org/w/api.php"
PARAMS = {
"drend": "20070904000000",
"format": "json",
"druser": "Catrope",
"list": "deletedrevs",
"drstart": "20070904235959",
"drlimit": "6",
"drprop": "revid|user|minor|len|token",
"action": "query"
}
R = S.get(url=URL, params=PARAMS)
DATA = R.json()
print(DATA)
起こりうるエラー
コード | 情報 |
---|---|
drpermissiondenied | You don't have permission to view deleted revision information. On most wikis, viewing deleted revisions is restricted to sysops, but other wikis may have different rules. |
パラメーターの履歴
- v1.24:
drprop: token
を廃止予定にしました - v1.23:
drtag
,drprop: tags
を導入しました - v1.19:
drprop: sha1
を導入しました - v1.18:
drto
,drprefix
,drprop: parentid
を導入しました - v1.17:
drprop: userid
を導入しました - v1.16:
drprop: parsedcomment
を導入しました - v1.15:
druser
,drexcludeuser
,drnamespace
,drunique
,drfrom
を導入しました
追加的な注記
- This module cannot be used as a generator .
- このモジュールを使用するには
deletedhistory
権限が必要です。 このモジュールは以下の3つのモードのいずれかで使用できます:
- List deleted revisions for the given titles (through
titles
or a generator), sorted by timestamp
- List deleted revisions for the given titles (through
- List deleted contributions for a certain user, sorted by timestamp (
druser
set, no titles given)
- List deleted contributions for a certain user, sorted by timestamp (
- List all deleted revisions in a certain namespace (
druser
not set, no titles given)
- List all deleted revisions in a certain namespace (
- Some parameters are restricted to certain modes only, and are marked accordingly.