API:Continue/ar

غالبًا ما يحدث ألا تحصل على كافة البيانات التي ترغب فيها في استعلام واجهة برمجة تطبيقات واحد. حينما يحدث هذا، سوف تُلحِق واجهة برمجة التطبيقات عنصر إضافي (عنوانه ) بنتائج الاستعلام للإشارة إلى وجود المزيد من البيانات.

سوف يحتوي العنصر المردود على جزئين: جزء واحد سيكون عنصر فرعي أيضًا عنوانه. سيخصص لهذا في العادة قيمة تشتمل على الرموز  لو كانت ثمة بيانات متوفرة لمتابعة الأمر. The second part will be a sub-element (or multiple sub-elements) 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 (in which case the same set of pages is returned but with the next set of properties), 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 and the   element doesn't contain continuation data for properties, but instead can contain continuation data for the generator. 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.