How to generate a report

  1. Prepare a request and send it to the Reports service.

    In the Authorization header, specify the OAuth token that you received for the user that has rights to the campaigns that the report is for. For the full list of headers, see the section HTTP headers.

    In the request body, specify values for the main parameters, depending on which data you want to get:

    For a complete list of input parameters, see the section Request: report specification.

  2. Reports that contain a relatively small amount of data are generated in online mode. In this case, you immediately receive a response with the HTTP 200 status and the report in the HTTP message body data.

    Reports that contain a large volume of data and certain types of reports are generated in offline mode. In this case, you receive the HTTP response code 201.

    For more information on the flow for requests and responses, see Online and offline reports.

  3. To get a report that is generated in offline mode, wait some time and then repeat the request with the same parameters.

    If the report isn't ready yet, you receive the response code 202.

    If the report is ready, you receive the response code 200 with the report in the response body.

For a sample request and sample report, see Example: clicks and cost.