It perhaps makes sense for a call to /w/api.php?action=query&format=json&prop=info&titles=Test&formatversion=2&inprop=watchlistlabels to return an array of watchlist labels (IDs? IDs and names?) for the given page
Relates to T416615: Make watchlist labels usable via API calls
Derived Requirements
- The action=query&prop=info API must support a new inprop value: watchlistlabels.
- When inprop=watchlistlabels is specified and the page is watched by the current user:
- The response must include an array of watchlist labels assigned to that page.
- Each label must include:
- Label ID
- Label name
- The structure must align with the existing watchlist label format used elsewhere in the API (consistent schema and field naming).
- If the page has no labels assigned:
- The API must return an empty array for watchlistlabels (not omit the field).
- If the page is not watched:
- The API must either omit the field or return an empty array (behavior must be consistent and documented).
- The response must respect user permissions:
- Only return labels for the authenticated user making the request.
- The feature must work with format=json and formatversion=2.
Test Steps
Test Case 1: API returns labels for a watched page with labels
- Watch a page in Beta.
- Assign one or more watchlist labels to the page.
- Call: https://en.wikipedia.beta.wmcloud.org/w/api.php?action=query&format=json&formatversion=2&inprop=watchlistlabels&prop=info&titles=Banana
- Inspect the JSON response.
- ✅❓❌⬜ AC1: Response includes a watchlistlabels array under the page object, contains each label entry contains both ID and name, also returned labels match those assigned in the UI .
Test Case 2: API returns empty array when page has no labels
- Watch a page in Beta.
- Ensure no labels are assigned.
- Call the same API endpoint with inprop=watchlistlabels.
- Inspect the JSON response.
- ✅❓❌⬜ AC2: watchlistlabels is present and is an empty array.
Test Case 3: API behavior for unwatched page
- Ensure a page is not on the watchlist in Beta.
- Call the API with inprop=watchlistlabels.
- Inspect the JSON response.
- ✅❓❌⬜ AC3: watchlistlabels` is present and is an empty array.
Test Case 4: API without inprop parameter
- Call: https://en.wikipedia.beta.wmcloud.org/w/api.php?action=query&format=json&formatversion=2&prop=info&titles=Banana
- Inspect the JSON response.
- ✅❓❌⬜ AC4: No watchlistlabels field is present when inprop=watchlistlabels is not specified.
Test Case 5: Permission check
- Log out or use a user without the page on their watchlist.
- Call the API with inprop=watchlistlabels.
- ✅❓❌⬜ AC5: Labels are not returned for another user’s watchlist.
QA Results -Beta
| AC | Status | Details |
|---|---|---|
| 1 | ✅ | T417092#11620992 |
| 2 | ✅ | T417092#11620992 |
| 3 | ✅ | T417092#11620992 |
| 4 | ✅ | T417092#11620992 |
| 5 | ✅ | T417092#11620992 |








