# YouTube Analytics API . reports

## Instance Methods

Retrieve your YouTube Analytics reports.

### Method Details

`query(ids=None, 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, Identifies the YouTube channel or content owner for which you are retrieving YouTube Analytics data.
    - To request data for a YouTube user, set the ids parameter value to channel==CHANNEL_ID, where CHANNEL_ID specifies the unique YouTube channel ID.
    - To request data for a YouTube CMS content owner, set the ids parameter value to contentOwner==OWNER_NAME, where OWNER_NAME is the CMS name of the content owner. (required)
      start_date: string, The start date for fetching YouTube Analytics data. The value should be in YYYY-MM-DD format. (required)
      end_date: string, The end date for fetching YouTube Analytics data. The value should be in YYYY-MM-DD format. (required)
      metrics: string, A comma-separated list of YouTube Analytics metrics, such as views or likes,dislikes. See the Available Reports document for a list of the reports that you can retrieve and the metrics available in each report, and see the Metrics document for definitions of those metrics. (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. The '-' prefix causes descending sort order.
      dimensions: string, A comma-separated list of YouTube Analytics dimensions, such as views or ageGroup,gender. See the Available Reports document for a list of the reports that you can retrieve and the dimensions used for those reports. Also see the Dimensions document for definitions of those dimensions.
      filters: string, A list of filters that should be applied when retrieving YouTube Analytics data. The Available Reports document identifies the dimensions that can be used to filter each report, and the Dimensions document defines those dimensions. If a request uses multiple filters, join them together with a semicolon (;), and the returned result table will satisfy both filters. For example, a filters parameter value of video==dMH0bHeiRNg;country==IT restricts the result set to include data for the given video in 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", # This value specifies the type of data included in the API response. For the query method, the kind property value will be youtubeAnalytics#resultTable.
        "rows": [ # The list contains all rows of the result table. Each item in the list is an array that contains comma-delimited data corresponding to a single row of data. The order of the comma-delimited data fields will match the order of the columns listed 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": [ # This value specifies information about the data returned in the rows fields. Each item in the columnHeaders list identifies a field returned in the rows value, which contains a list of comma-delimited data. The columnHeaders list will begin with the dimensions specified in the API request, which will be followed by the metrics specified in the API request. The order of both dimensions and metrics will match the ordering in the API request. For example, if the API request contains the parameters dimensions=ageGroup,gender&metrics=viewerPercentage, the API response will return columns in this order: ageGroup,gender,viewerPercentage.
          {
            "dataType": "A String", # The type of the data in the column (STRING, INTEGER, FLOAT, etc.).
            "columnType": "A String", # The type of the column (DIMENSION or METRIC).
            "name": "A String", # The name of the dimension or metric.
          },
        ],
      }