Online and offline reports

Choosing the mode

The Yandex Direct server can create a report in either online or offline mode, depending on the parameters and the amount of data in the report. You can set the mode in the HTTP processingMode header in the request:

processingMode: online

This generates a report in online mode. If the report is created successfully, it is returned in the response body. If the report can't be generated in online mode, an error is returned.

processingMode: offline
This puts the request in a queue to generate the report in offline mode. To check whether the report is ready, send repeated requests with the same parameters (see How to check whether an offline report is ready). The recommended interval for checking the report status is shown in the HTTP retryIn header in the response. If the report is created successfully, the server returns the report in the response body.
processingMode: auto

The server automatically selects the mode for generating the report. If the report is created successfully in online mode, it is returned in the response body. If the report can't be created in online mode, it is added to the offline queue. Your application must support both modes.

If you omit this header, it is interpreted as auto.

Restriction. Reports with the SEARCH_QUERY_PERFORMANCE_REPORT type can only be generated in offline mode.

How to check whether an offline report is ready

The flow for requests and responses in offline and auto mode is shown below.

Steps for auto mode:

  1. Send a request to generate a report. Specify the HTTP processingMode: auto header in the request.

    The server response contains one of the following HTTP codes:

    • 200 – The report was created successfully in online mode and returned in the response body.

    • 201 – The report was successfully placed in the queue to generate in offline mode. Go to step 2.

    • 400 – The request parameters contain an error, or the request exceeded the limit on the number of requests or reports in the queue. In this case, review the error message, correct the request, and resend it.

    • 500 — An error occurred on the server when creating the report. If this is the first time you have received an error for this report, try again. If the error persists, contact the support service.

  2. Wait the amount of time specified in the retryIn response header (or as long as you choose), then re-send the request with the same parameters.

    The server response contains one of the following HTTP codes:

    • 200 — The report was created successfully and returned in the response body.

    • 202 — Report creation isn't finished yet. Repeat step 2.

    • 500 — An error occurred on the server when creating the report. If this is the first time a server error has occurred for this report, go back to step 1 and try generating the report again. If the error persists, contact the support service.