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_v2.html">YouTube Analytics API</a> . <a href="youtubeAnalytics_v2.reports.html">reports</a></h1> 76<h2>Instance Methods</h2> 77<p class="toc_element"> 78 <code><a href="#query">query(startDate=None, endDate=None, currency=None, startIndex=None, filters=None, x__xgafv=None, dimensions=None, sort=None, includeHistoricalChannelData=None, maxResults=None, metrics=None, ids=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(startDate=None, endDate=None, currency=None, startIndex=None, filters=None, x__xgafv=None, dimensions=None, sort=None, includeHistoricalChannelData=None, maxResults=None, metrics=None, ids=None)</code> 83 <pre>Retrieve your YouTube Analytics reports. 84 85Args: 86 startDate: string, The start date for fetching YouTube Analytics data. The value should be in 87`YYYY-MM-DD` format. 88required: true, pattern: "[0-9]{4}-[0-9]{2}-[0-9]{2} 89 endDate: string, The end date for fetching YouTube Analytics data. The value should be in 90`YYYY-MM-DD` format. 91required: true, pattern: [0-9]{4}-[0-9]{2}-[0-9]{2} 92 currency: string, The currency to which financial metrics should be converted. The default is 93US Dollar (USD). If the result contains no financial metrics, this flag 94will be ignored. Responds with an error if the specified currency is not 95recognized.", 96pattern: [A-Z]{3} 97 startIndex: integer, An index of the first entity to retrieve. Use this parameter as a 98pagination mechanism along with the max-results parameter (one-based, 99inclusive).", 100minValue: 1 101 filters: string, A list of filters that should be applied when retrieving YouTube Analytics 102data. The [Available Reports](/youtube/analytics/v2/available_reports) 103document identifies the dimensions that can be used to filter each report, 104and the [Dimensions](/youtube/analytics/v2/dimsmets/dims) document defines 105those dimensions. If a request uses multiple filters, join them together 106with a semicolon (`;`), and the returned result table will satisfy both 107filters. For example, a filters parameter value of 108`video==dMH0bHeiRNg;country==IT` restricts the result set to include data 109for the given video in Italy.", 110 x__xgafv: string, V1 error format. 111 Allowed values 112 1 - v1 error format 113 2 - v2 error format 114 dimensions: string, A comma-separated list of YouTube Analytics dimensions, such as `views` or 115`ageGroup,gender`. See the [Available 116Reports](/youtube/analytics/v2/available_reports) document for a list of 117the reports that you can retrieve and the dimensions used for those 118reports. Also see the [Dimensions](/youtube/analytics/v2/dimsmets/dims) 119document for definitions of those dimensions." 120pattern: [0-9a-zA-Z,]+ 121 sort: string, A comma-separated list of dimensions or metrics that determine the sort 122order for YouTube Analytics data. By default the sort order is ascending. 123The '`-`' prefix causes descending sort order.", 124pattern: [-0-9a-zA-Z,]+ 125 includeHistoricalChannelData: boolean, If set to true historical data (i.e. channel data from before the linking 126of the channel to the content owner) will be retrieved.", 127 maxResults: integer, The maximum number of rows to include in the response.", 128minValue: 1 129 metrics: string, A comma-separated list of YouTube Analytics metrics, such as `views` or 130`likes,dislikes`. See the 131[Available Reports](/youtube/analytics/v2/available_reports) document for 132a list of the reports that you can retrieve and the metrics 133available in each report, and see the 134[Metrics](/youtube/analytics/v2/dimsmets/mets) document for definitions of 135those metrics. 136required: true, pattern: [0-9a-zA-Z,]+ 137 ids: string, Identifies the YouTube channel or content owner for which you are 138retrieving YouTube Analytics data. 139 140- To request data for a YouTube user, set the `ids` parameter value to 141 `channel==CHANNEL_ID`, where `CHANNEL_ID` specifies the unique YouTube 142 channel ID. 143- To request data for a YouTube CMS content owner, set the `ids` parameter 144 value to `contentOwner==OWNER_NAME`, where `OWNER_NAME` is the CMS name 145 of the content owner. 146required: true, pattern: [a-zA-Z]+==[a-zA-Z0-9_+-]+ 147 148Returns: 149 An object of the form: 150 151 { # Response message for TargetedQueriesService.Query. 152 "kind": "A String", # This value specifies the type of data included in the API response. 153 # For the query method, the kind property value will be 154 # `youtubeAnalytics#resultTable`. 155 "rows": [ # The list contains all rows of the result table. Each item in the list is 156 # an array that contains comma-delimited data corresponding to a single row 157 # of data. The order of the comma-delimited data fields will match the 158 # order of the columns listed in the `columnHeaders` field. 159 # 160 # If no data is available for the given query, the `rows` element will be 161 # omitted from the response. 162 # 163 # The response for a query with the `day` dimension will not contain rows for 164 # the most recent days. 165 [ 166 "", 167 ], 168 ], 169 "errors": { # Request Error information. # When set, indicates that the operation failed. 170 # 171 # The presence of an error field signals that the operation 172 # has failed. 173 "code": "A String", # Global error code. Deprecated and ignored. 174 # Set custom error codes in ErrorProto.domain and ErrorProto.code 175 # instead. 176 "requestId": "A String", # Request identifier generated by the service, which can be 177 # used to identify the error in the logs 178 "error": [ # Specific error description and codes 179 { # Describes one specific error. 180 "domain": "A String", # Error domain. RoSy services can define their own 181 # domain and error codes. This should normally be 182 # the name of an enum type, such as: gdata.CoreErrorDomain 183 "code": "A String", # Error code in the error domain. This should correspond to 184 # a value of the enum type whose name is in domain. See 185 # the core error domain in error_domain.proto. 186 "externalErrorMessage": "A String", # A short explanation for the error, which can be shared outside Google. 187 # 188 # Please set domain, code and arguments whenever possible instead of this 189 # error message so that external APIs can build safe error messages 190 # themselves. 191 # 192 # External messages built in a RoSy interface will most likely refer to 193 # information and concepts that are not available externally and should not 194 # be exposed. It is safer if external APIs can understand the errors and 195 # decide what the error message should look like. 196 "debugInfo": "A String", # Debugging information, which should not be 197 # shared externally. 198 "locationType": "A String", 199 "argument": [ # Error arguments, to be used when building user-friendly error messages 200 # given the error domain and code. Different error codes require different 201 # arguments. 202 "A String", 203 ], 204 "location": "A String", # Location of the error, as specified by the location type. 205 # 206 # If location_type is PATH, this should be a path to a field that's 207 # relative to the request, using FieldPath notation 208 # (net/proto2/util/public/field_path.h). 209 # 210 # Examples: 211 # authenticated_user.gaia_id 212 # resource.address[2].country 213 }, 214 ], 215 }, 216 "columnHeaders": [ # This value specifies information about the data returned in the `rows` 217 # fields. Each item in the `columnHeaders` list identifies a field returned 218 # in the `rows` value, which contains a list of comma-delimited data. The 219 # `columnHeaders` list will begin with the dimensions specified in the API 220 # request, which will be followed by the metrics specified in the API 221 # request. The order of both dimensions and metrics will match the ordering 222 # in the API request. For example, if the API request contains the parameters 223 # `dimensions=ageGroup,gender&metrics=viewerPercentage`, the API response 224 # will return columns in this order: `ageGroup`, `gender`, 225 # `viewerPercentage`. 226 { # The description of a column of the result table. 227 "dataType": "A String", # The type of the data in the column (`STRING`, `INTEGER`, `FLOAT`, etc.). 228 "columnType": "A String", # The type of the column (`DIMENSION` or `METRIC`). 229 "name": "A String", # The name of the dimension or metric. 230 }, 231 ], 232 }</pre> 233</div> 234 235</body></html>