Page MenuHomePhabricator

Add labels to wlprop for the action=query&list=watchlist API
Closed, ResolvedPublicFeature

Description

Add labels as a value for the wlprop parameter of the action=query&list=watchlist API, and return the label IDs and names if it's set. This is much the same as the existing treatment of tags. The return format format for the label data should match the existing userinfo API format (that was added in T409375).


Derived Requirement

Ensure that the action=query&list=watchlist API supports labels as a valid value for the wlprop parameter and, when requested, returns watchlist label IDs and names using the same response structure as the existing userinfo label format, consistent with how tags are handled.

Test Result - Beta|Prod

Status: ✅ PASS / ❓ Need More Info / ❌ FAIL
Environment: beta/xyzwiki
OS: macOS Tahoe 26.2
Browser: Chrome 143
Device: MBA
Emulated Device: NA

Test Artifact(s): API request URLs and JSON responses from action=query&list=watchlist

Test Steps

Test Case 1: Ensure watchlist API returns label data when wlprop includes labels

  1. Ensure the user has at least one watched page with one or more labels assigned.
  2. Send an API request to action=query&list=watchlist with wlprop=ids|title|labels.
  3. Inspect the JSON response for the watched items.
  4. ✅❓❌⬜ AC1: The response includes label IDs and names for watched items, using the same data structure as the userinfo label format.

Test Case 2: Ensure label data is not returned when wlprop does not include labels

  1. Send an API request to action=query&list=watchlist without including labels in the wlprop parameter.
  2. Inspect the JSON response.
  3. ✅❓❌⬜ AC2: The response does not include any label-related fields for watched items.

QA Results -Beta

ACStatusDetails
1T416154#11605336
2T416154#11605336

Details

Related Changes in Gerrit:

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

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

[mediawiki/core@master] ApiQueryWatchlist: Add watchlist labels

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

Change #1235803 merged by jenkins-bot:

[mediawiki/core@master] ApiQueryWatchlist: Add watchlist labels

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

@TheresNoTime Confirmed add labels to wlprop for the action=query&list=watchlist API, as seen in the videos below. I will mark this as Resolved. Thanks for all your work!

Test Result - Beta

Status: ✅ PASS
Environment: Beta
OS: macOS Tahoe 26.2
Browser: Chrome 143
Device: MBA
Emulated Device: NA

Test Artifact(s):

https://en.wikipedia.beta.wmcloud.org/wiki/Special:ApiSandbox#action=query&format=json&list=watchlist&formatversion=2&wlprop=ids%7Ctitle

Test Steps

Test Case 1: Ensure watchlist API returns label data when wlprop includes labels

  1. Ensure the user has at least one watched page with one or more labels assigned.
  2. Send an API request to action=query&list=watchlist with wlprop=ids|title|labels.
  3. Inspect the JSON response for the watched items.
  4. AC1: The response includes label IDs and names for watched items, using the same data structure as the userinfo label format.
EnAr

Test Case 2: Ensure label data is not returned when wlprop does not include labels

  1. Send an API request to action=query&list=watchlist without including labels in the wlprop parameter.
  2. Inspect the JSON response.
  3. AC2: The response does not include any label-related fields for watched items.
EnAr
GMikesell-WMF updated the task description. (Show Details)