User:Jeropbrenda/Sandbox/Batchcomplete

From MediaWiki.org
Jump to navigation Jump to search

BatchComplete[edit]

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 batchcomplete 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.

Example[edit]

GET request to fetch pages whose title begins with T, with their links and backlinks.

From the response, only three backlinks for "TALKPAGENAMEE" have been returned. If you send a GET request to fetch backlinks for "TALKPAGENAMEE" you will see that there are more than three, hence batchcomplete is not included in the response because there's more data to be returned for this batch.

The next continuation will return more links until eventually all the links and backlinks for each of the 10 pages in this batch will have been output, at which point the response will include batchcomplete to indicate that all the data for this batch has been output. The continuation from the response with batchcomplete will begin returning data for the next set of 10 pages.