Question

Using the media wiki API, I need to get all pages inside a Category, so I set the parameter cmlimit to max, but as stated in the documentation, this bill wring just 500 results.

This is my query:

http://lost.wikia.com/api.php?action=query&list=categorymembers&cmtitle=Category:Characters&cmlimit=max&format=json

How can I make that query to get all pages inside the category? I barely understand the API.

Was it helpful?

Solution

You can't, at least not using a single query.

What you need to do is to take the value in the query-continue field and add that to the query to get another page of results. And then repeat that until the response has no query-continue, which indicates that it's the last page.

In your case, the query for the second (and final) page would be:

http://lost.wikia.com/api.php?action=query&list=categorymembers&cmtitle=Category:Characters&cmlimit=max&format=json&cmcontinue=page|4d4159484557|9538

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top