API:Watch
From MediaWiki.org
![]() |
This page is part of the MediaWiki API documentation. |
Language: | English • Deutsch |
---|
Quick overview:
- Quick start guide
- FAQ
- Tutorial
- Formats
- Error reporting
- Restricting usage
- Authentication
- Queries
- Search suggestions
- Expanding templates and rendering
- Purging pages' caches
- Parameter information
- Changing wiki content
- Watchlist feed
- Extensions
- Using the API in MediaWiki and extensions
- Miscellaneous
- Implementation
- Client code
MediaWiki version: | 1.18 |
Contents |
[edit] Token
To (un)watch a page, a token is required. This token is different to the edit token, is the same for all pages, but changes at every login. A(n) (un)watch token can be obtained like this: Obtaining a watch token
Result |
---|
The following content has been placed in a collapsed box for improved usability. |
<?xml version="1.0"?> <api> <query> <pages> <page pageid="1" ns="0" title="Main Page" touched="2012-02-07T17:27:37Z" lastrevid="2" counter="21" length="440" starttimestamp="2012-02-09T18:03:17Z" watchtoken="f2583b3edcdc2142f7256be161764d91+\" /> </pages> </query> </api> |
The above content has been placed in a collapsed box for improved usability. |
[edit] Watching and unwatching pages
Pages can be watched (added to your watchlist) and unwatched (removed from your watchlist) with action=watch. Of course, you can only add and remove pages to/from your own watchlist.
[edit] Parameters
title
: Page to (un)watchunwatch
: If set, unwatch the page. If not set, watch the page.token
: Your (un)watch token.
[edit] Examples
Watching Main Page
Result |
---|
The following content has been placed in a collapsed box for improved usability. |
<?xml version="1.0" encoding="utf-8"?> <api> <watch title="Main Page" watched="" /> </api> |
The above content has been placed in a collapsed box for improved usability. |
Unwatching Dog
Result |
---|
The following content has been placed in a collapsed box for improved usability. |
<?xml version="1.0" encoding="utf-8"?> <api> <watch title="Dog" unwatched="" /> </api> |
The above content has been placed in a collapsed box for improved usability. |
[edit] Possible errors
Only the usual stuff.