Accounts.reports: generate

Generate an AdSense report based on the report request sent in the query parameters. Returns the result as JSON; to retrieve output in CSV format specify "alt=csv" as a query parameter. Try it now.

Request

HTTP request

GET https://www.googleapis.com/adsensehost/v4.1/accounts/accountId/reports

Parameters

Parameter name Value Description
Path parameters
accountId string Hosted account upon which to report.
Required query parameters
endDate string End of the date range to report on in "YYYY-MM-DD" format, inclusive.
startDate string Start of the date range to report on in "YYYY-MM-DD" format, inclusive.
Optional query parameters
dimension string The dimensions on which to base the report. Available dimensions are described in Metrics and Dimensions. For more information on each of the dimensions, check the AdSense Glossary.
filter string Filters to be run on the report.
locale string Optional locale to use for translating report output to a local language. Defaults to "en_US" if not specified.
maxResults unsigned integer The maximum number of rows of report data to return.

If startIndex is either unset or zero, the API will return as many rows as specified by the value of maxResults. If maxResults is not set the API will return as many rows as possible, up to 50,000.

If startIndex is set to a non-zero value, the sum of startIndex and maxResults cannot be greater than 5000, or an error will be returned: paging past row 5000 is unsupported.

Acceptable values are 0 to 50000, inclusive.
metric string The numeric columns to include in the report. Available metrics are described in Metrics and Dimensions. For more information on each of the metrics, check the AdSense Glossary.
sort string The name of a dimension or metric to sort the resulting report on, optionally prefixed with "+" to sort ascending or "-" to sort descending. If no prefix is specified, the column is sorted ascending.
startIndex unsigned integer

If startIndex is either unset or zero, the API will return as many rows as specified by the value of maxResults. If maxResults is not set the API will return as many rows as possible, up to 50,000.

If startIndex is set to a non-zero value, the sum of startIndex and maxResults cannot be greater than 5000, or an error will be returned: paging past row 5000 is unsupported.

Acceptable values are 0 to 5000, inclusive.

Authorization

This request requires authorization with the following scope:

Scope
https://www.googleapis.com/auth/adsensehost

For more information, see the authentication and authorization page.

Request body

Do not supply a request body with this method.

Response

If successful, this method returns a response body with the following structure:

JSON

{
  "kind": "adsensehost#report",
  "totalMatchedRows": long,
  "headers": [
    {
      "name": string,
      "type": string,
      "currency": string
    }
  ],
  "rows": [
    [
      string
    ]
  ],
  "totals": [
    string
  ],
  "averages": [
    string
  ],
  "warnings": [
    string
  ]
}
Property name Value Description Notes
kind string Kind this is, in this case adsensehost#report.
totalMatchedRows long The total number of rows matched by the report request. Fewer rows may be returned in the response due to being limited by the row count requested or the report row limit.
headers[] list The header information of the columns requested in the report. This is a list of headers; one for each dimension in the request, followed by one for each metric in the request.
headers[].name string The name of the header.
headers[].type string The type of the header.

Acceptable values are:
  • "DIMENSION"
  • "METRIC_CURRENCY"
  • "METRIC_DECIMAL"
  • "METRIC_MILLISECONDS"
  • "METRIC_RATIO"
  • "METRIC_TALLY"
headers[].currency string The currency of this column. Only present if the header type is METRIC_CURRENCY.
rows[] list The output rows of the report. Each row is a list of cells; one for each dimension in the request, followed by one for each metric in the request. The dimension cells contain strings, and the metric cells contain numbers.
totals[] list The totals of the report. This is the same length as any other row in the report; cells corresponding to dimension columns are empty.
averages[] list The averages of the report. This is the same length as any other row in the report; cells corresponding to dimension columns are empty.
warnings[] list Any warnings associated with generation of the report.

CSV

"(dynamic)"
(foreach)
  string
(/foreach)
Property name Value Description Notes
(dynamic) string

Try it!

Use the APIs Explorer below to call this method on live data and see the response.