API:Continue/nl

Heel vaak krijgt u niet alle gewenste gegevens in één API-query. Wanneer dit gebeurt, voegt de API een extra element (getiteld ) toe aan de resultaten om aan te geven dat er meer gegevens zijn.

Het element dat wordt geretourneerd, bestaat uit twee delen: een deel is een subelement met de titel. Dit heeft meestal een bijbehorende waarde die de symbolen  bevat als er gegevens beschikbaar zijn om verder te gaan. The second part will be a sub-element whose title is the abbreviation of the whichever list is used in the query, prefixed to the word. (So, for example, the sub-element for a query using categorymembers would be, the sub-element for a query using allcategories would be  , the sub-element for a query using protectedtitles would be  , etc.)

To retrieve further data when the  element is present, you must add the second sub-element as a parameter to the next API request. For example, if a query using the list allcategories contained additional results, then the next API query made should include  as parameter, along with whatever the value of   was in the results of the first query. To get all results, this can be repeated until an API result does not have a  element in the results, indicating there are no more data matching the query.

batchcomplete
When you make an API request using a generator together with properties, the API result may signal to continue because there are more properties to retrieve for the pages so far, or because there are more pages from the generator, or both. From version 1.25 onwards, the API returns a  element to indicate that all data for the current "batch" of pages has been returned. This can be useful to avoid building a combined result set for thousands of pages when using a generator together with prop modules that may themselves need continuation.

Backwards compatibility of continue
From MediaWiki 1.21 to 1.25, it was required to specify  (i.e. with an empty string as the value) in the initial request to get continuation data in the format described above. Without doing that, API results would indicate there is additional data by returning a  element, explained in Raw query continue. Prior to 1.21, that raw continuation was the only option.

If your application needs to use the raw continuation in MediaWiki 1.26 or later, you must specify  to request it.

Example 3: Python code for iterating through all results
Here is Python code showing how to iterate over query results (using the python requests lib). Note that you should not manipulate or depend on any specifics of the values returned inside the  element, as they may change.