API:Etiquette/ru

This page is a work in progress.

Also read the quick start guide. It answers some questions not answered here and points to other useful pages.

Помощь

 * 1) Read this FAQ.
 * 2) Попробуйте найти ответ на свой вопрос в документации API здесь или на самодокументируемой странице API.
 * 3) Если вы не можете найти ответ на вопрос в интернете, задайте его в почтовой рассылке mediawiki-api.

Ограничение на запросы
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. Большинство системных администраторов оставляют за собой право заблокировать вас без предупреждения, если вы подвергаете угрозе стабильность их системы.

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.

Parsing of revisions
Хотя и возможно обратиться с запросом к данным относительно отдельной версии страницы, для серверов эта операция является ресурсоёмкой. 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]

Use maxlag parameter
If your task is not interactive (i.e. A user is not waiting for the result) you should use the maxlag parameter. 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:

User-Agent header
Используйте содержательный заголовок, включающий имя вашего приложения и, возможно, адрес вашей электронной почты, если это уместно. 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. See API:Main page#Identifying your client and m:User-Agent policy for details.

Thinking about performance generally
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 Tool Labs.