Html程序  |  120行  |  6.27 KB

<html><body>
<style>

body, h1, h2, h3, div, span, p, pre, a {
  margin: 0;
  padding: 0;
  border: 0;
  font-weight: inherit;
  font-style: inherit;
  font-size: 100%;
  font-family: inherit;
  vertical-align: baseline;
}

body {
  font-size: 13px;
  padding: 1em;
}

h1 {
  font-size: 26px;
  margin-bottom: 1em;
}

h2 {
  font-size: 24px;
  margin-bottom: 1em;
}

h3 {
  font-size: 20px;
  margin-bottom: 1em;
  margin-top: 1em;
}

pre, code {
  line-height: 1.5;
  font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace;
}

pre {
  margin-top: 0.5em;
}

h1, h2, h3, p {
  font-family: Arial, sans serif;
}

h1, h2, h3 {
  border-bottom: solid #CCC 1px;
}

.toc_element {
  margin-top: 0.5em;
}

.firstline {
  margin-left: 2 em;
}

.method  {
  margin-top: 1em;
  border: solid 1px #CCC;
  padding: 1em;
  background: #EEE;
}

.details {
  font-weight: bold;
  font-size: 14px;
}

</style>

<h1><a href="youtubeAnalytics_v1.html">YouTube Analytics API</a> . <a href="youtubeAnalytics_v1.reports.html">reports</a></h1>
<h2>Instance Methods</h2>
<p class="toc_element">
  <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>
<p class="firstline">Retrieve your YouTube Analytics reports.</p>
<h3>Method Details</h3>
<div class="method">
    <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>
  <pre>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)
  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.
  max_results: integer, The maximum number of rows to include in the response.
  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.
  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.
  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.
  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).
  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.

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.
      },
    ],
  }</pre>
</div>

</body></html>