Hi
I am trying to retrieve the categories of new pages via the API on the Danish Wikipedia using this API request:
https://da.wikipedia.org/w/api.php?action=query&prop=categories&form...
When I make that request, I get this response https://gist.github.com/cgtdk/e746b6042883b970c640 (a non-broken up version of the API request URL has been added to the gist as a comment).
The interesting part is line 76 to 86. This is the response item for the page "VM i bandy 2015". It claims that this page only has one category, "Kategori:Fremtidige sportsbegivenheder", but it actually has had three categories ever since the first (and only, as of writing this) revision: Kategori:Fremtidige sportsbegivenheder, Kategori:VM i bandy, and Kategori:Sport i 2015.
I have tried to do this several times (with minor modifications) both in the API Sandbox on dawiki and directly.
When I query the page directly, like this:
https://da.wikipedia.org/w/api.php?action=query&prop=categories&form...
I get this response: https://gist.github.com/cgtdk/69e874cf7d3fae6ee506 which shows the correct category information for the page.
What is going on? Am I doing something wrong or is there a bug?
Thanks, Christoffer G. Thomsen (meta:User:Cgtdk)
On Tue, Jan 28, 2014 at 8:34 AM, Christoffer G. Thomsen chris@cgt.namewrote:
The interesting part is line 76 to 86. This is the response item for the page "VM i bandy 2015". It claims that this page only has one category, "Kategori:Fremtidige sportsbegivenheder", but it actually has had three categories ever since the first (and only, as of writing this) revision: Kategori:Fremtidige sportsbegivenheder, Kategori:VM i bandy, and Kategori:Sport i 2015.
I have tried to do this several times (with minor modifications) both in the API Sandbox on dawiki and directly.
[...]
What is going on? Am I doing something wrong or is there a bug?
You're forgetting about continuation.[1] Because you specified cllimit=10 in the query, it's only returning you 10 categories total and expecting you to make a followup query to get the rest.
While in this case you could increase cllimit up to at least 500 (or use cllimit=max), you should still read up on continuation.
[1]: https://www.mediawiki.org/wiki/API:Query#Continuing_queries
Thanks!
I am familiar with continuation, I just overlooked that the cllimit parameter was for the amount of categories, not the amount of pages.
Christoffer G. Thomsen
mediawiki-api@lists.wikimedia.org