API:Watch

From MediaWiki.org
Jump to: navigation, search
Tools clipart.png This page is part of the MediaWiki API documentation.
Language: English  • Deutsch
MediaWiki API

Quick overview:

v · d · e
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

<?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>

[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)watch
  • unwatch: If set, unwatch the page. If not set, watch the page.
  • token: Your (un)watch token.

[edit] Examples

Watching Main Page

<?xml version="1.0" encoding="utf-8"?>
<api>
  <watch title="Main Page" watched="" />
</api>

Unwatching Dog

<?xml version="1.0" encoding="utf-8"?>
<api>
  <watch title="Dog" unwatched="" />
</api>

[edit] Possible errors

Only the usual stuff.