API:Deletedrevs/diq
This page is part of the MediaWiki Action API documentation. |
MediaWiki version: | ≤ 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
Example
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 [try in ApiSandbox]
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>
Sample code
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)
Possible errors
Kod | Melumat |
---|---|
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: Introduced
drtag
,drprop: tags
- v1.19: Introduced
drprop: sha1
- v1.18: Introduced
drto
,drprefix
,drprop: parentid
- v1.17: Introduced
drprop: userid
- v1.16: Introduced
drprop: parsedcomment
- v1.15: Introduced
druser
,drexcludeuser
,drnamespace
,drunique
,drfrom
Additional notes
- This module cannot be used as a generator .
- You need the
deletedhistory
right to use this module.
This module can be used in one of three modes:
- 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.