On Thu, Feb 17, 2011 at 11:46:50AM +0000, Andrew Chapman wrote:
> 
> http://en.wikipedia.org/w/api.php?action=query&generator=categories&titles=IPad&prop=categoryinfo
> 
> I get all the size info, but only the first 10 categories.

Add in gcllimit=100. Any parameter you can specify for prop=foo or
list=foo can be specified for generator=foo by prefixing a 'g', although
some don't make much sense when used in generator mode.

> It looks like the answer is to use the continue option (cicontinue?) but 
> I don't understand how to do that. Sorry if this is a dumb question - 
> can someone clarify.

It's pretty straightforward. If continuation is needed, the response
will include a <query-continue> node, something like this:
  <query-continue>
    <categories gclcontinue="25970423|IOS (Apple)" />
  </query-continue>
In this case, it's telling you that for the 'categories' module you
should repeat the same query adding
glcontinue=25970423|IOS (Apple) to the next few results:
http://en.wikipedia.org/w/api.php?action=query&generator=categories&titles=IPad&prop=categoryinfo&glcontinue=25970423%7CIOS+%28Apple%29

If you're using the generator to generate titles for something that
itself could have continuation, the situation is slightly more
complicated. For example, you can find out what images and templates are
used on each page in a category with a query like this:
http://en.wikipedia.org/w/api.php?action=query&generator=categorymembers&gcmtitle=Category:Good+articles&prop=templates|images
That will return multiple values in <query-continue>:
  <query-continue>
    <categorymembers gcmcontinue="022|" />
    <templates tlcontinue="98358|10|Convert" />
    <images imcontinue="98358|Ellipse sign 17.svg" />
  </query-continue>
To do it correctly, you'd want to ignore the gcmcontinue until it
stops giving you tlcontinue and imcontinue:
http://en.wikipedia.org/w/api.php?action=query&generator=categorymembers&gcmtitle=Category:Good+articles&prop=templates|images&tlcontinue=98358|10|Convert&imcontinue=98358|Ellipse+sign+17.svg
http://en.wikipedia.org/w/api.php?action=query&generator=categorymembers&gcmtitle=Category:Good+articles&prop=templates|images&tlcontinue=98358|10|Convert/numdisp&imcontinue=98358|NJ+4.jpg
... (10 similar queries) ...
http://en.wikipedia.org/w/api.php?action=query&generator=categorymembers&gcmtitle=Category:Good+articles&prop=templates|images&tlcontinue=352992|10|Convert/LoffAonSon&imcontinue=19551628|Symbol+support+vote.svg
At this point, it stops giving imcontinue. You should remove prop=images
from your query now, but keep on with prop=templates and tlcontinue.
http://en.wikipedia.org/w/api.php?action=query&generator=categorymembers&gcmtitle=Category:Good+articles&prop=templates&tlcontinue=352992|10|Date-mf
... (35 similar queries) ...
http://en.wikipedia.org/w/api.php?action=query&generator=categorymembers&gcmtitle=Category:Good+articles&prop=templates&tlcontinue=20335131|10|Most+intense+hurricanes
And finally you run out of tlcontinue too. Only now should you use
gcmcontinue:
http://en.wikipedia.org/w/api.php?action=query&generator=categorymembers&gcmtitle=Category:Good+articles&prop=templates|images&gcmcontinue=022|
And then repeat the process:
http://en.wikipedia.org/w/api.php?action=query&generator=categorymembers&gcmtitle=Category:Good+articles&prop=templates|images&gcmcontinue=022|&tlcontinue=80807|10|Convert&imcontinue=80807|Ellipse+sign+439.svg
http://en.wikipedia.org/w/api.php?action=query&generator=categorymembers&gcmtitle=Category:Good+articles&prop=templates|images&gcmcontinue=022|&tlcontinue=80807|10|Convert/round&imcontinue=80807|US+206.svg
... (and so on)

_______________________________________________
Mediawiki-api mailing list
Mediawiki-api@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api

Reply via email to