The action=watch API should be updated to accept watchlist label IDs for assigning to the page(s) that are being watched.
Description
Details
| Status | Subtype | Assigned | Task | ||
|---|---|---|---|---|---|
| Open | None | T415173 Assign watchlist labels via the watchstar | |||
| Resolved | TheresNoTime | T416291 Update action=watch API to accept label IDs |
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).
Change #1238472 had a related patch set uploaded (by Samtar; author: Samtar):
[mediawiki/core@master] ApiWatch: Update action=watch API to accept label IDs
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
Change #1240679 had a related patch set uploaded (by SomeRandomDeveloper; author: SomeRandomDeveloper):
[mediawiki/core@master] ApiWatch: Use a batch query to load watchlist labels
Change #1240679 merged by jenkins-bot:
[mediawiki/core@master] ApiWatch: Use a batch query to load watchlist labels
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!