API:Watch

POST request to add or remove pages from a watchlist.

Example
Making any POST request is a multi-step process:

  Log in, via one of the methods described on .   GET a.

The sample query above is for wikis running MediaWiki 1.24+.

For wikis running earlier versions of MediaWiki, tokens for this operation can be obtained via   with   (MediaWiki 1.20+), or by using the following query:

  Send a POST request, with the CSRF token, to take action on a page. </li> </ol>

The sample code below covers the final step in detail.

Sample code
watch.py

Parameter history

 * v1.25: Deprecated <tvar|1> </>
 * v1.23: Introduced <tvat|1>      </>; deprecated <tvar|2> </>
 * v1.21: Introduced <tvar|1> </>

Additional notes

 * When running the sample code via a bot, make sure that the bot has the "<tvar|1></>" option set to <tvar|2> </>, by visiting the <tvar|3>Special:BotPasswords</> page.


 * This module uses CSRF tokens, not watchlist tokens. CSRF tokens are generally used for POST requests and wiki-modifying actions throughout the <tvar|1></>, whereas watchlist tokens are used specifically to view another user's watchlist.


 * Unlike <tvar|1></>, which allows you to read an account's private watchlist without logging in, this module requires you to log directly into the account you want to alter.