Page MenuHomePhabricator

API does not retrieve categories
Closed, InvalidPublicBUG REPORT

Description

Go and check the next URL:
https://en.wikinews.org/w/api.php?action=query&pageids=15776&prop=categories

The API is not giving the categories for that pageid. In fact, the page has different categories (https://en.wikinews.org/w/index.php?title=Nearly_25,000_Iraqi_civilians_killed_in_Iraq,_watchdog_group_claims)

Event Timeline

Go and check the next URL: https://en.wikinews.org/w/api.php?action=query&pageids=15776&prop=categories

This result of that link (with page id = 15776) is for this page https://en.wikinews.org/w/index.php?title=Iraq_conflict_killed_nearly_25,000_civilians&redirect=no. It has zero category and is in fact a redirect page.

The API is not giving the categories for that pageid. In fact, the page has different categories (https://en.wikinews.org/w/index.php?title=Nearly_25,000_Iraqi_civilians_killed_in_Iraq,_watchdog_group_claims)

It does. But you either need to use the correct page id ( =15754 ), https://en.wikinews.org/w/api.php?action=query&pageids=15754&prop=categories or hint that redirect should be resolved.

To resolve redirects automatically you should add redirects=1 to the query url. So use https://en.wikinews.org/w/api.php?action=query&pageids=15776&prop=categories&redirects=1 in this case