Request flow
There are two stages in the request flow for the AppMetrica Logs API:

Request to prepare data
The AppMetrica Logs API accepts the request and puts it in the queue. If the request is processed successfully, AppMetrica prepares a file for download. In this case, the API returns the HTTP 202 Accepted status. If the request resulted in an error, the API returns the appropriate response status, and the HTTP message body contains the error description.
Note
Requests in the queue are processed sequentially (each subsequent request is executed strictly after the previous one is completed).
While the request is being processed and the file is being prepared, all identical requests (with the same parameters) will return the HTTP 202 Accepted status.
Sample request:
GET /logs/v1/export/installations.json HTTP/1.1
Host: api.appmetrica.yandex.com
Authorization: OAuth <your_token>
where <your_token> is an OAuth token that you can obtain by following this guide.
Response example:
HTTP/1.1 202 Accepted
Content-Type: text/plain
Wait for result
To get compressed data, send the HTTP Accept-Encoding:: gzip header.
Request to download data
The request to download data is identical to the request to prepare data. If the request to prepare the file is complete, for the next identical request, the Logs API returns the 200 OK status. The results file is ready to be downloaded.
The file is available for download for 24 hours at the URL of the initial request. For a repeat request after 24 hours has passed, the request is put in the queue for processing and preparing a new file.
You can force regenerating the file using the HTTP Cache-Control header:
- To generate a new file, send the
Cache-Control: no-cacheheader in the request. - To download a file that was generated within the last N seconds, send the
Cache-Control: max-age=Nheader in the request. If the file was created more than N seconds ago, AppMetrica generates a new one. - To download the last generated file (if one exists), don't send the
Cache-Controlheader in the request.
How to improve data availability
Some data shards may be temporarily unavailable during maintenance. If you need to receive samples at specific times and can tolerate a small margin of error in the data, use the skip_unavailable_shards parameter. By default, it's set to false.
When this parameter is set to true, the Logs API returns data only from available shards. Although these samples will be incomplete, the data loss rate won't exceed 1%.
-
Check if the Logs API is available.
-
If your request returns
logs_api_availability_status=disabled, includeskip_unavailable_shards=truein your request to prepare data.If your request returns
logs_api_availability_status=enabled, keep the default value:skip_unavailable_shards=false.
Export data using the AppMetrica interface
In the AppMetrica interface, you can export data to a file. To learn more, see Exporting data to a file.
If you didn't find the answer you were looking for, you can use the feedback form to submit your question. Please describe the problem in as much detail as possible. Attach a screenshot if possible.