API:Etiquette/fr

Lisez également le guide du démarrage rapide. Il répond à certaines questions non répondues ici et contient des liens vers d'autres pages utiles.

Aide

 * 1) Lisez cette FAQ.
 * 2) Try to find the answer to your question in the API documentation here, in the API sandbox or on the self-documenting API home page.
 * 3) If you can't find the answer to your question on the web, you can ask your question on the mediawiki-api mailing list.

Demande de limite
There is no hard and fast limit on read requests, but we ask that you be considerate and try not to take a site down. Most system administrators reserve the right to unceremoniously block you if you do endanger the stability of their site.

If you make your requests in series rather than in parallel (i.e. wait for the one request to finish before sending a new request, such that you're never making more than one request at the same time), then you should definitely be fine. Also try to combine things into one request. For example: specify multiple '|'-separated titles in a  parameter instead of making a new request for each title; use a "generator" instead of making a request for each result from another request.

Analyser les révisions
While it is possible to query for results from a specific revision number, this is an expensive operation for the servers. To retrieve a specific revision use the 'oldid' parameter, example:


 * [//en.wikipedia.org/w/api.php?action=parse&format=xml&prop=images&oldid=254862759 en.wikipedia.org/w/api.php?action=parse&format=xml&prop=images&oldid=254862759]
 * [//en.wikipedia.org/w/api.php?action=parse&format=xml&prop=images&oldid=462841413 en.wikipedia.org/w/api.php?action=parse&format=xml&prop=images&oldid=462841413]

Utilliser la paramètre maxlag
If your task is not interactive (i.e. a user is not waiting for the result) you should use the maxlag parameter. Ceci empêche votre tâche de s'exécuter quand la charge des serveurs est importante. Les valeurs hautes impliquent un comportement plus aggressif, les valeurs basses sont plus agréables.

Voir:

Entête de l'agent client
Use a descriptive  header that includes your application's name and potentially your email address if appropriate. Do not simply copy the user-agent of a popular web browser (Unless your API client is a JavaScript application running through said web browser via Ajax, in which case one cannot modify the user-agent). This ensures that if a problem does arise it is easy to track down where it originates. Voir m:User-Agent policy pour les détails.

Penser aux performances globales
If you are trying to figure out why you are getting results more slowly than you would like, try to help you think about performance generally. If you are finding that reading via the API rather than directly reading from databases is impeding your client's performance, consider whether to put it into Wikimedia's Toolforge.