API:Legacy Query Continue
- This page describes the original way the query continuation worked. This approach is not recommended, as it requires the client to know which module returned which continue parameter, and process some before processing the others.
- Please consider using the new approach described on API Query page.
Very often, you will not get all the data you want in one request. To continue the request, you can use the provided query-continue
value. Using the query-continue value
Result |
---|
<?xml version="1.0" encoding="utf-8"?> <api> <query-continue> <allcategories acfrom="List of Baptist sub-denominations" /> </query-continue> <query> <allcategories> <c>List of "M" series military vehicles</c> <c>List of Alternative Rock Groups</c> <c>List of Alumni of Philippine Science High School</c> <c>List of American artists</c> <c>List of Anglicans and Episcopalians</c> <c>List of Arizona Reptiles</c> <c>List of Artists by record label</c> <c>List of Australian Anglicans</c> <c>List of Bahá'ís</c> <c>List of Balliol College people</c> </allcategories> </query> </api> |
You can now use acfrom=List%20of%20Baptist%20sub-denominations
to get the next ten categories.
The query-continue
node will contain a subnode for each module used in the query that needs continuation, and these subnodes will contain properties to be used when making the followup "continuation" query. Note that clients should not be depending on the particular property names given for continuation of any module or the format of the values returned for continuation, as these may change.
When using a generator, you might get multiple query-continue
values, one for the generator and one or more for the 'regular' prop
modules used. In this case you need to continue the 'regular' modules first (with the old values of the generator's continuation properties) until they run out, and only then continue the generator. The generator's continuation properties may be identified because they belong to the query module being used as a generator and will begin with a 'g'.
Continuation example[edit | edit source]
Consider the query above, which, as a contrived example, uses the categories
module as both the generator and as a prop module. This will return a query-continue
something like this:
<query-continue> <categories gclcontinue="14588|MediaWiki_API_Overview" clcontinue="6418|MediaWiki_for_site_admins" /> <links plcontinue="6418|14|Manual/cs" /> </query-continue>
Note that continuation is returned for both the links
module and the categories
module as both the generator and as a prop module. You would add plcontinue=6418|14|Manual/cs
(for links) and clcontinue=6418|MediaWiki_for_site_admins
(for categories as a prop module) to your query, while ignoring for now gclcontinue=14588|MediaWiki_API_Overview
because it belongs to the generator module and begins with a 'g'.
The result from the followup query, above, would then return something like this:
<query-continue> <categories gclcontinue="14588|MediaWiki_API_Overview" clcontinue="19269|Top_level" /> <links plcontinue="6418|14|Manual/gl" /> </query-continue>
Continuing with continuation, you might eventually get a response like this:
<query-continue> <categories gclcontinue="14588|MediaWiki_API_Overview" /> <links plcontinue="6418|14|Manual/km" /> </query-continue>
At this point you may remove categories
from the prop
list since there is no longer any continuation property being returned for it, or you may leave it in there while continuing to use the last value received for clcontinue
. Do not retain categories
in prop
while removing clcontinue
, as then you will start receiving all the prop=categories
results all over again.
Eventually a query will return only the generator continuation:
<query-continue> <categories gclcontinue="14588|MediaWiki_API_Overview" /> </query-continue>
Now, finally, you go back to your original query and add gclcontinue=14588|MediaWiki_API_Overview
to get the next set of results from the generator, keeping it in all subsequent queries and updating it again when you get to the point of having only the generator-continue left. Repeat the process of continuation as necessary until no query-continue
is returned at all.