On Fri, Dec 12, 2008 at 04:10:57PM -0500, Beebe, Mary J wrote:
> Thank you that is exactly what I am looking for.
> 
> The other question was about page limit.  I guess I would have to use
> 
> "...Cmsort=timestamp&Cmprop=ids|title|timestamp"
> 
> Then use cmstart with the last timestamp displayed to get the next 500.

Do you know about the "cheat sheet" you get by accessing api.php with no
parameters, e.g. http://en.wikipedia.org/w/api.php ? It's good for
telling you all the available parameters with a sentence about what each
does.

cmlimit=500 will give you your 500 results instead of the default 10. If
there are more than that available, the response will contain a
"query-continue" node with a child "categorymembers", and that child
will have a property "cmcontinue". Just copy that cmcontinue's value to
your request to get the next 500. For example, at this moment
http://en.wikipedia.org/w/api.php?action=query&list=categorymembers&cmtitle=Category:Physics
gives a cmcontinue value of "Acoustic droplet ejection|". Urlencoding
that and appending it to the original request gives the next 10 results:
http://en.wikipedia.org/w/api.php?action=query&list=categorymembers&cmtitle=Category:Physics&cmcontinue=Acoustic+droplet+ejection%7C
To get the third 10, add the cmcontinue from the second response onto
the original query. Repeat until you get a response without a
query-continue node.

Note that with complicated queries, you may get multiple values for your
query-continue; for example if you feed prop=images|templates with
generator=categorymembers, you might get imcontinue=X, tlcontinue=Y, and
gcmcontinue=Z. In that case, process the non-generator continues before
the generator: you'd want to use the old gcmcontinue with the new
imcontinue and tlcontinue until you run out of both, and only then use
the new gcmcontinue with no imcontinue/tlcontinue. Like this:
 api.php?...
  => gcmcontinue=Z1, imcontinue=X1, tlcontinue=Y1
 api.php?...&imcontinue=X1&tlcontinue=Y1
  => gcmcontinue=Z1, imcontinue=X2, tlcontinue=Y2
 api.php?...&imcontinue=X2&tlcontinue=Y2
  => gcmcontinue=Z1, imcontinue=X3
 api.php?...&imcontinue=X3&tlcontinue=Y2
  => gcmcontinue=Z1
 api.php?...&gcmcontinue=Z1
  => gcmcontinue=Z2, imcontinue=X5, tlcontinue=Y5
 api.php?...&gcmcontinue=Z1&imcontinue=X5&tlcontinue=Y5
  => gcmcontinue=Z2, tlcontinue=Y6
 api.php?...&gcmcontinue=Z1&imcontinue=X5&tlcontinue=Y6
  => gcmcontinue=Z2
 api.php?...&gcmcontinue=Z2
  => gcmcontinue=Z3, imcontinue=X8, tlcontinue=Y8
 api.php?...&gcmcontinue=Z2&imcontinue=X8&tlcontinue=Y8
 (and so on)

_______________________________________________
Mediawiki-api mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api

Reply via email to