API:Deletedrevs
Appearance
| This page is part of the MediaWiki Action API documentation. |
| เวอร์ชันมีเดียวิกิ: | ≤ 1.25 |
(deprecated in 1.25) The API documentation described here will work best with MediaWiki 1.14 and earlier. It has been deprecated in favor of
alldeletedrevisions apiGET request to list deleted revisions.
API documentation
ตัวอย่าง
GET request
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 [ลองใช้ในกระบะทรายเอพีไอ]
Response
<?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)
ข้อบกพร่อง (error) ที่อาจเกิด
| รหัส (Code) | ข้อมูล (Info) |
|---|---|
| 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. |
Parameter history
- v1.24: Deprecated
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
Additional notes
- This module cannot be used as a generator.
- You need the
deletedhistoryright to use this module. This module can be used in one of three modes:- List deleted revisions for the given titles (through
titlesor a generator), sorted by timestamp - List deleted contributions for a certain user, sorted by timestamp (
druserset, no titles given) - List all deleted revisions in a certain namespace (
drusernot set, no titles given)
- List deleted revisions for the given titles (through
- Some parameters are restricted to certain modes only, and are marked accordingly.