Page MenuHomePhabricator

Update action=watch API to accept label IDs
Closed, ResolvedPublic

Description

The action=watch API should be updated to accept watchlist label IDs for assigning to the page(s) that are being watched.

Event Timeline

Great. Does this mean we can wait to get one day a labels dropdown menu when clicking on a page watching star, alongside with the dates menu that is there now?

Yep, that's the goal of T415173 (this task is just a part of it, and we've not yet made the other tasks that make up the whole feature).

Samwilson changed the task status from Open to In Progress.Feb 5 2026, 1:06 AM

Change #1238472 had a related patch set uploaded (by Samtar; author: Samtar):

[mediawiki/core@master] ApiWatch: Update action=watch API to accept label IDs

https://gerrit.wikimedia.org/r/1238472

Request

{
	"action": "watch",
	"format": "json",
	"labels": "1|2",
	"titles": "Main Page",
	"formatversion": "2"
}

Response

{
    "batchcomplete": true,
    "watch": [
        {
            "title": "Main Page",
            "ns": 0,
            "watched": true,
            "labels": [
                {
                    "id": 1,
                    "name": "test"
                },
                {
                    "id": 2,
                    "name": "two"
                }
            ]
        }
    ],

labels here will contain the resultant labels applied to the page (not just the labels added in the request)

Change #1238472 merged by jenkins-bot:

[mediawiki/core@master] ApiWatch: Update action=watch API to accept label IDs

https://gerrit.wikimedia.org/r/1238472

Change #1240679 had a related patch set uploaded (by SomeRandomDeveloper; author: SomeRandomDeveloper):

[mediawiki/core@master] ApiWatch: Use a batch query to load watchlist labels

https://gerrit.wikimedia.org/r/1240679

Change #1240679 merged by jenkins-bot:

[mediawiki/core@master] ApiWatch: Use a batch query to load watchlist labels

https://gerrit.wikimedia.org/r/1240679

dom_walden subscribed.

I have used the action=watch API to watch pages and add labels, and checked that the correct labels have been added to the page.

Test environment: https://en.wikipedia.beta.wmflabs.org MediaWiki 1.46.0-alpha (e4d7972) 12:41, 20 February 2026.

Thanks, tried, and confirmed the question I was worried about, that the action does not erase the notificationtimestamp value as usually at watch actions. Great job!