API:Etiquette/de

Diese Seite enthält beste Vorgehensweisen, die bei der Nutzung der API befolgt werden sollten.

Anforderungslimit
Es gibt keine feste Beschränkung für Leseanfragen, aber sei rücksichtsvoll und versuche, eine Seite nicht herunterzufahren. Die meisten Systemadministratoren behalten sich das Recht vor, Benutzer kurzerhand zu sperren, wenn sie die Stabilität ihrer Seite gefährden.

Wenn du deine Abfragen nicht parallel, sondern nacheinander stellst, sodass eine neue Abfrage erst gestartet wird, wenn die vorherige beendet wurde, sollte dies zu einer sicheren Abfragerate führen. Außerdem wird empfohlen, dass du in einer Abfrage mehrere Objekte abfragst, indem du:


 * Using the pipe character whenever possible e.g. , instead of making a new request for each title.
 * Using a instead of making a request for each result from another request.


 * Use GZip compression when making API calls by setting  to reduce bandwidth usage.

Requests which make edits, modify state or otherwise are not read-only requests, are subject to rate limiting. The exact rate limit being applied might depend on the type of action, your user rights and the configuration of the website you are making the request to. The limits that apply to you can be determined by accessing the action=query&meta=userinfo&uiprop=ratelimits API endpoint.

When you hit the request rate limit you will receive a with the error code. When you encounter this error, you may retry that request, however you should increase the time between subsequent requests. A common strategy for this is Exponential backoff.

Parsing von Revisionen
While it is possible to query for results from a specific revision number using the  parameter, this is an expensive operation for the servers. To retrieve a specific revision use the  parameter. For example:

Der Parameter maxlag
If your task is not interactive, i.e. a user is not waiting for the result, you should use the  parameter. The value of the  parameter should be an integer number of seconds. Zum Beispiel:

This will prevent your task from running when the load on the servers is high. Higher values mean more aggressive behavior, lower values are nicer.

See for more details.

Der User-Agent-Header
It is best practice to set a descriptive User Agent header. To do so, use. For example in PHP:

Do not simply copy the user-agent of a popular web browser. This ensures that if a problem does arise it is easy to track down where it originates.

If you are calling the API from browser-based JavaScript, you may not be able to influence the  header, depending on the browser. To work around this, use the  header.

See m:User-Agent_policy for more details.

Datenmodell
All new API users. See for more details.

Performance
Downloading data in bulk is not always extremely efficient using the Action API. On Wikimedia wikis, there are faster ways to get data in bulk, see m:Research:Data and wikitech:Portal:Data Services for more details.

Siehe auch

 * - Die Schnellstart-Anleitung.