• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html><body>
2<style>
3
4body, h1, h2, h3, div, span, p, pre, a {
5  margin: 0;
6  padding: 0;
7  border: 0;
8  font-weight: inherit;
9  font-style: inherit;
10  font-size: 100%;
11  font-family: inherit;
12  vertical-align: baseline;
13}
14
15body {
16  font-size: 13px;
17  padding: 1em;
18}
19
20h1 {
21  font-size: 26px;
22  margin-bottom: 1em;
23}
24
25h2 {
26  font-size: 24px;
27  margin-bottom: 1em;
28}
29
30h3 {
31  font-size: 20px;
32  margin-bottom: 1em;
33  margin-top: 1em;
34}
35
36pre, code {
37  line-height: 1.5;
38  font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace;
39}
40
41pre {
42  margin-top: 0.5em;
43}
44
45h1, h2, h3, p {
46  font-family: Arial, sans serif;
47}
48
49h1, h2, h3 {
50  border-bottom: solid #CCC 1px;
51}
52
53.toc_element {
54  margin-top: 0.5em;
55}
56
57.firstline {
58  margin-left: 2 em;
59}
60
61.method  {
62  margin-top: 1em;
63  border: solid 1px #CCC;
64  padding: 1em;
65  background: #EEE;
66}
67
68.details {
69  font-weight: bold;
70  font-size: 14px;
71}
72
73</style>
74
75<h1><a href="youtubeAnalytics_v1.html">YouTube Analytics API</a> . <a href="youtubeAnalytics_v1.reports.html">reports</a></h1>
76<h2>Instance Methods</h2>
77<p class="toc_element">
78  <code><a href="#query">query(ids, start_date, end_date, metrics, currency=None, max_results=None, filters=None, dimensions=None, sort=None, start_index=None, include_historical_channel_data=None)</a></code></p>
79<p class="firstline">Retrieve your YouTube Analytics reports.</p>
80<h3>Method Details</h3>
81<div class="method">
82    <code class="details" id="query">query(ids, start_date, end_date, metrics, currency=None, max_results=None, filters=None, dimensions=None, sort=None, start_index=None, include_historical_channel_data=None)</code>
83  <pre>Retrieve your YouTube Analytics reports.
84
85Args:
86  ids: string, Identifies the YouTube channel or content owner for which you are retrieving YouTube Analytics data.
87- 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.
88- 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)
89  start_date: string, The start date for fetching YouTube Analytics data. The value should be in YYYY-MM-DD format. (required)
90  end_date: string, The end date for fetching YouTube Analytics data. The value should be in YYYY-MM-DD format. (required)
91  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)
92  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.
93  max_results: integer, The maximum number of rows to include in the response.
94  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.
95  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.
96  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.
97  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).
98  include_historical_channel_data: 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.
99
100Returns:
101  An object of the form:
102
103    { # 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).
104    "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.
105    "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.
106      [
107        "",
108      ],
109    ],
110    "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.
111      {
112        "dataType": "A String", # The type of the data in the column (STRING, INTEGER, FLOAT, etc.).
113        "columnType": "A String", # The type of the column (DIMENSION or METRIC).
114        "name": "A String", # The name of the dimension or metric.
115      },
116    ],
117  }</pre>
118</div>
119
120</body></html>