API:Watchlist feed

Aus MediaWiki
Zur Navigation springen Zur Suche springen

English • ‎dansk • ‎français • ‎русский • ‎ไทย • ‎中文 • ‎日本語 • ‎한국어
MediaWiki version: 1.9

GET request that returns a Manual:Watchlist feed.

API documentation[Bearbeiten]


(main | feedwatchlist)

Gibt einen Beobachtungslisten-Feed zurück.


Das Format des Feeds.

Einer der folgenden Werte: rss, atom
Standard: rss

Seiten auflisten, die innerhalb dieser Anzahl Stunden ab jetzt geändert wurden.

Der Wert muss zwischen 1 und 72 sein.
Typ: Ganzzahl
Standard: 24

Verlinke direkt zum veränderten Abschnitt, wenn möglich.

Typ: boolesch (Einzelheiten)

Include multiple revisions of the same page within given timeframe.

Typ: boolesch (Einzelheiten)

Used along with token to access a different user's watchlist.

Typ: Benutzername

A security token (available in the user's preferences) to allow access to another user's watchlist.


Show only items that meet these criteria. For example, to see only minor edits done by logged-in users, set show=minor|!anon.

Werte (mit | trennen oder Alternative): minor, !minor, bot, !bot, anon, !anon, patrolled, !patrolled, autopatrolled, !autopatrolled, unread, !unread

Which types of changes to show:

Normale Seitenbearbeitungen.
Externe Änderungen.
Änderungen an der Kategoriemitgliedschaft.
Werte (mit | trennen oder Alternative): edit, new, log, external, categorize
Standard: edit|new|log|categorize

Listet keine Änderungen von diesem Benutzer auf.

Typ: Benutzername
Den Beobachtungslisten-Feed anzeigen
api.php?action=feedwatchlist [in Spielwiese öffnen]
Zeige alle Änderungen an beobachteten Seiten der letzten 6 Stunden.
api.php?action=feedwatchlist&allrev=&hours=6 [in Spielwiese öffnen]


If no user is specified via the wlowner parameter, this API defaults to showing you your own watchlist feed -- or, at least, the watchlist feed of the account you are currently logged in as.

GET request[Bearbeiten]

Get the watchlist feed for the account making the request.


<?xml version="1.0"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
        <title>Wikipedia - Watchlist [en]</title>
	<generator>MediaWiki 1.33.0-wmf.13</generator>
	<lastBuildDate>Tue, 22 Jan 2019 16:20:52 GMT</lastBuildDate>
            <title>Article on Watchlist</title>

Sample code[Bearbeiten]



    MediaWiki Action API Code Samples
    Demo of `Feedwatchlist` module: Get the watchlist feed 
    for the account making the request.
    MIT license

import requests

S = requests.Session()

URL = "https://en.wikipedia.org/w/api.php"

# Step 1: Retrieve a login token
PARAMS_1 = {
    "action": "query",
    "meta": "tokens",
    "type": "login",
    "format": "json"

R = S.get(url=URL, params=PARAMS_1)
DATA = R.json()

LOGIN_TOKEN = DATA['query']['tokens']['logintoken']

# Step 2: Send a post request to log in. For this login 
# method, Obtain credentials by first visiting
# https://en.wikipedia.org/wiki/Special:BotPasswords/
# See https://www.mediawiki.org/wiki/API:Login for more
# information on log in methods.
PARAMS_2 = {
    "action": "login",
    "lgname": "user_name",
    "lgpassword": "password",
    "format": "json",
    "lgtoken": LOGIN_TOKEN

R = S.post(URL, data=PARAMS_2)

# Step 3: Request the account's own watchlist feed
PARAMS_3 = {
    "action": "feedwatchlist"

R = S.get(url=URL, params=PARAMS_3)
DATA = R.text


Parameter history[Bearbeiten]

  • v1.27: Introduced wltype: categorize
  • v1.25: Introduced wlshow: unread, wlshow: !unread
  • v1.24: Deprecated linktodiffs
  • v1.22: Introduced wltype
  • v1.19: Introduced wlexcludeuser
  • v1.17: Introduced linktodiffs
  • v1.16: Introduced wltoken, wlowner
  • v1.12: Introduced allrev
  • v1.11: Introduced hours

Additional notes[Bearbeiten]

  • This API also allows you to access another user's watchlist feed, via their private watchlist token. You can view or reset your own watchlist token by visiting Special:Preferences, under "Manage tokens".
  • The wlexcludeuser parameter only accepts one value; it is not possible to exclude multiple users in a single query.
  • This API does not return JSON -- the response will always be an xml object representing the feed, regardless of whether you add format=json to your query.
  • The feed only displays the most recently modified pages. You will not be able to view pages modified more than 72 hours ago via the API.
  • Although ordinary accounts are granted the right to view their own watchlist by default, bots work differently. You must manually grant the bot this right yourself. You can do so by checking off the "View your own watchlist" right on Special:BotPasswords.

See also[Bearbeiten]

  • API:Watch - adds or removes pages from your own watchlist.
  • API:Watchlist - an action=query module; gets a list of pages in the watchlist of a user, within a given time period.
  • API:Watchlistraw - an action=query module; gets a list of all pages within the watchlist of a user.