YouTube Analytics API . reports

Instance Methods

close()

Close httplib2 connections.

query(currency=None, dimensions=None, endDate=None, filters=None, ids=None, includeHistoricalChannelData=None, maxResults=None, metrics=None, sort=None, startDate=None, startIndex=None, x__xgafv=None)

Retrieve your YouTube Analytics reports.

Method Details

close()
Close httplib2 connections.
query(currency=None, dimensions=None, endDate=None, filters=None, ids=None, includeHistoricalChannelData=None, maxResults=None, metrics=None, sort=None, startDate=None, startIndex=None, x__xgafv=None)
Retrieve your YouTube Analytics reports.

Args:
  currency: string, The currency to which financial metrics should be converted. The default is US Dollar (USD). If the result contains no financial metrics, this flag will be ignored. Responds with an error if the specified currency is not recognized.", pattern: [A-Z]{3}
  dimensions: string, A comma-separated list of YouTube Analytics dimensions, such as `views` or `ageGroup,gender`. See the [Available Reports](/youtube/analytics/v2/available_reports) document for a list of the reports that you can retrieve and the dimensions used for those reports. Also see the [Dimensions](/youtube/analytics/v2/dimsmets/dims) document for definitions of those dimensions." pattern: [0-9a-zA-Z,]+
  endDate: string, The end date for fetching YouTube Analytics data. The value should be in `YYYY-MM-DD` format. required: true, pattern: [0-9]{4}-[0-9]{2}-[0-9]{2}
  filters: string, A list of filters that should be applied when retrieving YouTube Analytics data. The [Available Reports](/youtube/analytics/v2/available_reports) document identifies the dimensions that can be used to filter each report, and the [Dimensions](/youtube/analytics/v2/dimsmets/dims) 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.",
  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: true, pattern: [a-zA-Z]+==[a-zA-Z0-9_+-]+
  includeHistoricalChannelData: boolean, If set to true historical data (i.e. channel data from before the linking of the channel to the content owner) will be retrieved.",
  maxResults: integer, The maximum number of rows to include in the response.", minValue: 1
  metrics: string, A comma-separated list of YouTube Analytics metrics, such as `views` or `likes,dislikes`. See the [Available Reports](/youtube/analytics/v2/available_reports) document for a list of the reports that you can retrieve and the metrics available in each report, and see the [Metrics](/youtube/analytics/v2/dimsmets/mets) document for definitions of those metrics. required: true, pattern: [0-9a-zA-Z,]+
  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.", pattern: [-0-9a-zA-Z,]+
  startDate: string, The start date for fetching YouTube Analytics data. The value should be in `YYYY-MM-DD` format. required: true, pattern: "[0-9]{4}-[0-9]{2}-[0-9]{2}
  startIndex: 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).", minValue: 1
  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # Response message for TargetedQueriesService.Query.
  "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`.
    { # The description of a column of the result table.
      "columnType": "A String", # The type of the column (`DIMENSION` or `METRIC`).
      "dataType": "A String", # The type of the data in the column (`STRING`, `INTEGER`, `FLOAT`, etc.).
      "name": "A String", # The name of the dimension or metric.
    },
  ],
  "errors": { # Request Error information. The presence of an error field signals that the operation has failed. # When set, indicates that the operation failed.
    "code": "A String", # Global error code. Deprecated and ignored. Set custom error codes in ErrorProto.domain and ErrorProto.code instead.
    "error": [ # Specific error description and codes
      { # Describes one specific error.
        "argument": [ # Error arguments, to be used when building user-friendly error messages given the error domain and code. Different error codes require different arguments.
          "A String",
        ],
        "code": "A String", # Error code in the error domain. This should correspond to a value of the enum type whose name is in domain. See the core error domain in error_domain.proto.
        "debugInfo": "A String", # Debugging information, which should not be shared externally.
        "domain": "A String", # Error domain. RoSy services can define their own domain and error codes. This should normally be the name of an enum type, such as: gdata.CoreErrorDomain
        "externalErrorMessage": "A String", # A short explanation for the error, which can be shared outside Google. Please set domain, code and arguments whenever possible instead of this error message so that external APIs can build safe error messages themselves. External messages built in a RoSy interface will most likely refer to information and concepts that are not available externally and should not be exposed. It is safer if external APIs can understand the errors and decide what the error message should look like.
        "location": "A String", # Location of the error, as specified by the location type. If location_type is PATH, this should be a path to a field that's relative to the request, using FieldPath notation (net/proto2/util/public/field_path.h). Examples: authenticated_user.gaia_id resource.address[2].country
        "locationType": "A String",
      },
    ],
    "requestId": "A String", # Request identifier generated by the service, which can be used to identify the error in the logs
  },
  "kind": "A String", # 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.
    [
      "",
    ],
  ],
}