API:Raw query continue

From MediaWiki.org
Jump to: navigation, search
This page describes the original way the query continuation worked. We don't recommend it, as it requires the client to know which module returned which continue parameter, and process some before processing the others.

Very often, you will not get all the data you want in one request. To get more data, you use the query-continue value in the response. Using the query-continue value

You can now use accontinue=List_of_19th_century_baseball_players 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]

Consider the query above, which, as a contrived example, uses the categories module as both the generator and as a prop module. This returns 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 should remove categories from the prop list (and, optionally, any category-associated parameters), since there is no longer any continuation property being returned for it. If you don't, 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.