YouTube Analytics API . reports

Instance Methods

query(ids, start_date, end_date, metrics, sort=None, dimensions=None, filters=None, max_results=None, start_index=None)

Retrieve your YouTube Analytics reports.

Method Details

query(ids, start_date, end_date, metrics, sort=None, dimensions=None, filters=None, max_results=None, start_index=None)
Retrieve your YouTube Analytics reports.

Args:
  ids: string, Unique channel or content owner ID for retrieving YouTube Analytics data. Either channel==C or contentOwner==O where 'C' is the encrypted channel ID and 'O' is the content owner name. (required)
  start_date: string, Start date for fetching YouTube Analytics data. All requests should specify a start date formatted as YYYY-MM-DD. (required)
  end_date: string, End date for fetching YouTube Analytics data. All requests should specify an end date formatted as YYYY-MM-DD. (required)
  metrics: string, A comma-separated list of YouTube Analytics metrics. E.g., 'views' or 'likes,dislikes' (required)
  sort: string, A comma-separated list of dimensions or metrics that determine the sort order for YouTube Analytics data. By default the sort order is ascending, '-' prefix causes descending sort order.
  dimensions: string, A comma-separated list of YouTube Analytics dimensions. E.g., 'video', or 'ageGroup,gender'.
  filters: string, A list of dimension filters to be applied to YouTube Analytics data. Multiple filters can be joined together with the ';' character. The returned result table will satisfy both filters. E.g., video==dMH0bHeiRNg;country==IT will restrict the returned stats to the given video and the country Italy.
  max_results: integer, The maximum number of rows to include in the response.
  start_index: integer, An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter (one-based, inclusive).

Returns:
  An object of the form:

    { # Contains a single result table. The table is returned as an array of rows that contain the values for the cells of the table. Depending on the metric or dimension, the cell can contain a string (video ID, country code) or a number (number of views or number of likes).
    "kind": "youtubeAnalytics#resultTable", # Identifier used to mark the structure as a result table.
    "rows": [ # Contains all rows of the result table. Each row contains an array with the values for the columns. The order matches the order of the column information provided in the "columnHeaders" field. If no data is available for the given query, the "rows" element will be omitted from the response. The response for a query with the day dimension will not contain rows for the most recent days.
      [
        "",
      ],
    ],
    "columnHeaders": [ # Contains information about the columns returned in the "rows" fields. The order of the elements matches the order of the corresponding columns in "rows" field.
      {
        "dataType": "A String", # Type of the data in the column (STRING, INTEGER, FLOAT).
        "columnType": "A String", # The type of the column (DIMENSION, METRIC).
        "name": "A String", # The name of the dimension or metric.
      },
    ],
  }