API:Query/nl

Met de module  kunt u informatie ophalen over een wiki en de gegevens die erin zijn opgeslagen, zoals de wikitekst van een bepaalde pagina, de links en categorieën van een reeks pagina's, of het token dat u nodig hebt om.



Query modules
De querymodule heeft drie typen submodules (ook wel querymodules genoemd):

̈ van pagina's, inclusief revisies en inhoud.
 * over de wiki en de ingelogde gebruiker.
 * met pagina's die aan een bepaald criteria voldoen.

Voorbeelden


Voorbeeld 1: Pagina's specificeren
In tegenstelling tot meta- en lijstquerymodules werken alle eigenschapsquerymodules op een set pagina's die op een van de volgende manieren kunnen worden opgegeven:


 * Op naam met behulp van de parameter, bijvoorbeeld.
 * Op pagina-ID met behulp van de parameter, bijvoorbeeld.
 * Door revisie-ID met behulp van de parameter, bijvoorbeeld  . De meeste querymodules converteren revisie-id naar de bijbehorende pagina-id. Slechts  gebruikt daadwerkelijk de revisie-ID.
 * Een generator gebruiken.

Response


Voorbeeld 2: Titel normaliseren
Titel normalisatie converteert pagina-titels naar de canonieke vorm.

This means capitalizing the first character, replacing underscores with spaces, and changing namespace to the localized form defined for that wiki.

Example 3: Missing and invalid titles
Titles that don't exist or are invalid will have a  or   attribute set in the response.

In output formats that support numeric array keys, missing and invalid titles will have negative page IDs.

In some cases, a title can be viewed by a user but cannot be accessed by the API, such as pages that mirror content from another wiki. These titles will have a  attribute set in the response.

Example 4: Continuing queries
When all the data is not returned in the response of a query, there will be a  attribute to indicate that there is more data.

Response
To get further data, add its values to the original request:

Example 5: Batchcomplete
The API returns a  element to indicate that all data for the current batch of items has been returned.

In the response of the sample query below,  has been included to indicate that all the data for each of the three images has been returned.

The next continuation will begin returning data for the next set of 3 images.

Example 6: Generators
Use generators if you want to get data about a set of pages.

For example, to get data about pages in a certain category, instead of querying  and then querying again with   set to all the returned pages, combine the two API calls into one by using.

When using a list module as a generator, you don't need to specify the pages.

However, for a property module, you should specify the pages which the generator will work on.

For example, to load all pages that are linked to from the main page, use.

Parameters passed to a generator must be prefixed with a. For instance, when using, use   instead of.

The sample query below gets links and categories for the first three pages in the main namespace starting with "Ba".

Continuing queries
Queries will often have more results available than are just shown in the original query. (Often this is because a List query's result limit has been reached.) In these cases, queries can be continued. More detailed information on continuing queries can be at API:Continue.

Parameter history

 * v1.34: Introduced
 * v1.24: Introduced (note: raw continuation was the default behavior until v1.26)
 * v1.21: Introduced

Additional notes

 * Specifying titles through  or   is limited to 50 titles per query, or 500 for those with the   right.
 * Use multiple query modules together to get what you need in one request, e.g..
 * Generators always pass page titles to the query module. Unlike lists (which may include additional data by default), generators should not output any information themselves, unless when explicitly requested via the generator module's query parameters.

Resolving redirects
Redirects can be resolved automatically, so that the target of a redirect is returned instead of the given title. When present, they will always contain  and   attributes and may contain a   attribute for those redirects that point to specific sections.

Both normalization and redirection may take place. In the case of multiple redirects, all redirects will be resolved, and in case of a circular redirect, there might not be a page in the 'pages' section (see also below). Redirect resolution cannot be used in combination with the  parameter or with a generator generating revids; doing that will produce a warning and will not resolve redirects for the specified revids.

The examples below show how the  parameter works.