googleapis.youtube.analytics
Module googleapis.youtube.analytics
API
![](https://bcentral-packageicons.azureedge.net/images/ballerinax_googleapis.youtube.analytics_1.4.0.png)
ballerinax/googleapis.youtube.analytics Ballerina library
Overview
This is a generated connector for Youtube Analytics API v2 OpenAPI specification. The Youtube Analytics API provides the capability to retrieve your YouTube Analytics data.
Prerequisites
Before using this connector in your Ballerina application, complete the following:
- Create a Google account
- Obtain tokens - Follow this link
Clients![](/images/permalink.svg)
googleapis.youtube.analytics: Client![](/images/permalink.svg)
This is a generated connector for Youtube Analytics API v2 OpenAPI specification. The Youtube Analytics API provides the capability to retrieve your YouTube Analytics data.
Constructor![](/images/permalink.svg)
Gets invoked to initialize the connector
.
The connector initialization requires setting the API credentials.
Create a Google account and obtain tokens by following this guide.
init (ConnectionConfig config, string serviceUrl)
- config ConnectionConfig - The configurations to be used when initializing the
connector
- serviceUrl string "https://youtubeanalytics.googleapis.com/" - URL of the target service
listGroupItems![](/images/permalink.svg)
function listGroupItems(string? xgafv, string? alt, string? callback, string? fields, string? quotaUser, string? uploadProtocol, string? uploadType, string? groupId, string? onBehalfOfContentOwner) returns ListGroupItemsResponse|error
Returns a collection of group items that match the API request parameters.
Parameters
- xgafv string? (default ()) - V1 error format.
- alt string? (default ()) - Data format for response.
- callback string? (default ()) - JSONP
- fields string? (default ()) - Selector specifying which fields to include in a partial response.
- quotaUser string? (default ()) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
- uploadProtocol string? (default ()) - Upload protocol for media (e.g. "raw", "multipart").
- uploadType string? (default ()) - Legacy upload protocol for media (e.g. "media", "multipart").
- groupId string? (default ()) - The
groupId
parameter specifies the unique ID of the group for which you want to retrieve group items.
- onBehalfOfContentOwner string? (default ()) - This parameter can only be used in a properly authorized request. Note: This parameter is intended exclusively for YouTube content partners that own and manage many different YouTube channels. The
onBehalfOfContentOwner
parameter indicates that the request's authorization credentials identify a YouTube user who is acting on behalf of the content owner specified in the parameter value. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The account that the user authenticates with must be linked to the specified YouTube content owner.
Return Type
- ListGroupItemsResponse|error - Successful response
insertGroupItems![](/images/permalink.svg)
function insertGroupItems(GroupItem payload, string? xgafv, string? alt, string? callback, string? fields, string? quotaUser, string? uploadProtocol, string? uploadType, string? onBehalfOfContentOwner) returns GroupItem|error
Creates a group item.
Parameters
- payload GroupItem -
- xgafv string? (default ()) - V1 error format.
- alt string? (default ()) - Data format for response.
- callback string? (default ()) - JSONP
- fields string? (default ()) - Selector specifying which fields to include in a partial response.
- quotaUser string? (default ()) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
- uploadProtocol string? (default ()) - Upload protocol for media (e.g. "raw", "multipart").
- uploadType string? (default ()) - Legacy upload protocol for media (e.g. "media", "multipart").
- onBehalfOfContentOwner string? (default ()) - This parameter can only be used in a properly authorized request. Note: This parameter is intended exclusively for YouTube content partners that own and manage many different YouTube channels. The
onBehalfOfContentOwner
parameter indicates that the request's authorization credentials identify a YouTube user who is acting on behalf of the content owner specified in the parameter value. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The account that the user authenticates with must be linked to the specified YouTube content owner.
deleteGroupItems![](/images/permalink.svg)
function deleteGroupItems(string? xgafv, string? alt, string? callback, string? fields, string? quotaUser, string? uploadProtocol, string? uploadType, string? id, string? onBehalfOfContentOwner) returns Response|error
Removes an item from a group.
Parameters
- xgafv string? (default ()) - V1 error format.
- alt string? (default ()) - Data format for response.
- callback string? (default ()) - JSONP
- fields string? (default ()) - Selector specifying which fields to include in a partial response.
- quotaUser string? (default ()) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
- uploadProtocol string? (default ()) - Upload protocol for media (e.g. "raw", "multipart").
- uploadType string? (default ()) - Legacy upload protocol for media (e.g. "media", "multipart").
- id string? (default ()) - The
id
parameter specifies the YouTube group item ID of the group item that is being deleted.
- onBehalfOfContentOwner string? (default ()) - This parameter can only be used in a properly authorized request. Note: This parameter is intended exclusively for YouTube content partners that own and manage many different YouTube channels. The
onBehalfOfContentOwner
parameter indicates that the request's authorization credentials identify a YouTube user who is acting on behalf of the content owner specified in the parameter value. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The account that the user authenticates with must be linked to the specified YouTube content owner.
listGroups![](/images/permalink.svg)
function listGroups(string? xgafv, string? alt, string? callback, string? fields, string? quotaUser, string? uploadProtocol, string? uploadType, string? id, boolean? mine, string? onBehalfOfContentOwner, string? pageToken) returns ListGroupsResponse|error
Returns a collection of groups that match the API request parameters. For example, you can retrieve all groups that the authenticated user owns, or you can retrieve one or more groups by their unique IDs.
Parameters
- xgafv string? (default ()) - V1 error format.
- alt string? (default ()) - Data format for response.
- callback string? (default ()) - JSONP
- fields string? (default ()) - Selector specifying which fields to include in a partial response.
- quotaUser string? (default ()) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
- uploadProtocol string? (default ()) - Upload protocol for media (e.g. "raw", "multipart").
- uploadType string? (default ()) - Legacy upload protocol for media (e.g. "media", "multipart").
- id string? (default ()) - The
id
parameter specifies a comma-separated list of the YouTube group ID(s) for the resource(s) that are being retrieved. Each group must be owned by the authenticated user. In agroup
resource, theid
property specifies the group's YouTube group ID. Note that if you do not specify a value for theid
parameter, then you must set themine
parameter totrue
.
- mine boolean? (default ()) - This parameter can only be used in a properly authorized request. Set this parameter's value to true to retrieve all groups owned by the authenticated user.
- onBehalfOfContentOwner string? (default ()) - This parameter can only be used in a properly authorized request. Note: This parameter is intended exclusively for YouTube content partners that own and manage many different YouTube channels. The
onBehalfOfContentOwner
parameter indicates that the request's authorization credentials identify a YouTube user who is acting on behalf of the content owner specified in the parameter value. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The account that the user authenticates with must be linked to the specified YouTube content owner.
- pageToken string? (default ()) - The
pageToken
parameter identifies a specific page in the result set that should be returned. In an API response, thenextPageToken
property identifies the next page that can be retrieved.
Return Type
- ListGroupsResponse|error - Successful response
updateGroups![](/images/permalink.svg)
function updateGroups(Group payload, string? xgafv, string? alt, string? callback, string? fields, string? quotaUser, string? uploadProtocol, string? uploadType, string? onBehalfOfContentOwner) returns Group|error
Modifies a group. For example, you could change a group's title.
Parameters
- payload Group -
- xgafv string? (default ()) - V1 error format.
- alt string? (default ()) - Data format for response.
- callback string? (default ()) - JSONP
- fields string? (default ()) - Selector specifying which fields to include in a partial response.
- quotaUser string? (default ()) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
- uploadProtocol string? (default ()) - Upload protocol for media (e.g. "raw", "multipart").
- uploadType string? (default ()) - Legacy upload protocol for media (e.g. "media", "multipart").
- onBehalfOfContentOwner string? (default ()) - This parameter can only be used in a properly authorized request. Note: This parameter is intended exclusively for YouTube content partners that own and manage many different YouTube channels. The
onBehalfOfContentOwner
parameter indicates that the request's authorization credentials identify a YouTube user who is acting on behalf of the content owner specified in the parameter value. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The account that the user authenticates with must be linked to the specified YouTube content owner.
insertGroups![](/images/permalink.svg)
function insertGroups(Group payload, string? xgafv, string? alt, string? callback, string? fields, string? quotaUser, string? uploadProtocol, string? uploadType, string? onBehalfOfContentOwner) returns Group|error
Creates a group.
Parameters
- payload Group -
- xgafv string? (default ()) - V1 error format.
- alt string? (default ()) - Data format for response.
- callback string? (default ()) - JSONP
- fields string? (default ()) - Selector specifying which fields to include in a partial response.
- quotaUser string? (default ()) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
- uploadProtocol string? (default ()) - Upload protocol for media (e.g. "raw", "multipart").
- uploadType string? (default ()) - Legacy upload protocol for media (e.g. "media", "multipart").
- onBehalfOfContentOwner string? (default ()) - This parameter can only be used in a properly authorized request. Note: This parameter is intended exclusively for YouTube content partners that own and manage many different YouTube channels. The
onBehalfOfContentOwner
parameter indicates that the request's authorization credentials identify a YouTube user who is acting on behalf of the content owner specified in the parameter value. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The account that the user authenticates with must be linked to the specified YouTube content owner.
deleteGroups![](/images/permalink.svg)
function deleteGroups(string? xgafv, string? alt, string? callback, string? fields, string? quotaUser, string? uploadProtocol, string? uploadType, string? id, string? onBehalfOfContentOwner) returns Response|error
Deletes a group.
Parameters
- xgafv string? (default ()) - V1 error format.
- alt string? (default ()) - Data format for response.
- callback string? (default ()) - JSONP
- fields string? (default ()) - Selector specifying which fields to include in a partial response.
- quotaUser string? (default ()) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
- uploadProtocol string? (default ()) - Upload protocol for media (e.g. "raw", "multipart").
- uploadType string? (default ()) - Legacy upload protocol for media (e.g. "media", "multipart").
- id string? (default ()) - The
id
parameter specifies the YouTube group ID of the group that is being deleted.
- onBehalfOfContentOwner string? (default ()) - This parameter can only be used in a properly authorized request. Note: This parameter is intended exclusively for YouTube content partners that own and manage many different YouTube channels. The
onBehalfOfContentOwner
parameter indicates that the request's authorization credentials identify a YouTube user who is acting on behalf of the content owner specified in the parameter value. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The account that the user authenticates with must be linked to the specified YouTube content owner.
queryReports![](/images/permalink.svg)
function queryReports(string? xgafv, string? alt, string? callback, string? fields, string? quotaUser, string? uploadProtocol, string? uploadType, string? currency, string? dimensions, string? endDate, string? filters, string? ids, boolean? includeHistoricalChannelData, int? maxResults, string? metrics, string? sort, string? startDate, int? startIndex) returns QueryResponse|error
Retrieve your YouTube Analytics reports.
Parameters
- xgafv string? (default ()) - V1 error format.
- alt string? (default ()) - Data format for response.
- callback string? (default ()) - JSONP
- fields string? (default ()) - Selector specifying which fields to include in a partial response.
- quotaUser string? (default ()) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
- uploadProtocol string? (default ()) - Upload protocol for media (e.g. "raw", "multipart").
- uploadType string? (default ()) - Legacy upload protocol for media (e.g. "media", "multipart").
- currency string? (default ()) - 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? (default ()) - A comma-separated list of YouTube Analytics dimensions, such as
views
orageGroup,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." pattern: [0-9a-zA-Z,]+
- endDate string? (default ()) - 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? (default ()) - 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 ofvideo==dMH0bHeiRNg;country==IT
restricts the result set to include data for the given video in Italy.",
- ids string? (default ()) - 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 tochannel==CHANNEL_ID
, whereCHANNEL_ID
specifies the unique YouTube channel ID. - To request data for a YouTube CMS content owner, set theids
parameter value tocontentOwner==OWNER_NAME
, whereOWNER_NAME
is the CMS name of the content owner. required: true, pattern: [a-zA-Z]+==[a-zA-Z0-9_+-]+
- includeHistoricalChannelData boolean? (default ()) - 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 int? (default ()) - The maximum number of rows to include in the response.", minValue: 1
- metrics string? (default ()) - A comma-separated list of YouTube Analytics metrics, such as
views
orlikes,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: true, pattern: [0-9a-zA-Z,]+
- sort string? (default ()) - 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? (default ()) - 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 int? (default ()) - 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
Return Type
- QueryResponse|error - Successful response
Records![](/images/permalink.svg)
googleapis.youtube.analytics: ClientHttp1Settings![](/images/permalink.svg)
Provides settings related to HTTP/1.x protocol.
Fields
- keepAlive KeepAlive(default http:KEEPALIVE_AUTO) - Specifies whether to reuse a connection for multiple requests
- chunking Chunking(default http:CHUNKING_AUTO) - The chunking behaviour of the request
- proxy ProxyConfig? - Proxy server related options
googleapis.youtube.analytics: ConnectionConfig![](/images/permalink.svg)
Provides a set of configurations for controlling the behaviours when communicating with a remote HTTP endpoint.
Fields
- auth BearerTokenConfig|OAuth2RefreshTokenGrantConfig - Configurations related to client authentication
- httpVersion HttpVersion(default http:HTTP_2_0) - The HTTP version understood by the client
- http1Settings ClientHttp1Settings? - Configurations related to HTTP/1.x protocol
- http2Settings ClientHttp2Settings? - Configurations related to HTTP/2 protocol
- timeout decimal(default 60) - The maximum time to wait (in seconds) for a response before closing the connection
- forwarded string(default "disable") - The choice of setting
forwarded
/x-forwarded
header
- poolConfig PoolConfiguration? - Configurations associated with request pooling
- cache CacheConfig? - HTTP caching related configurations
- compression Compression(default http:COMPRESSION_AUTO) - Specifies the way of handling compression (
accept-encoding
) header
- circuitBreaker CircuitBreakerConfig? - Configurations associated with the behaviour of the Circuit Breaker
- retryConfig RetryConfig? - Configurations associated with retrying
- responseLimits ResponseLimitConfigs? - Configurations associated with inbound response size limits
- secureSocket ClientSecureSocket? - SSL/TLS-related options
- proxy ProxyConfig? - Proxy server related options
- validation boolean(default true) - Enables the inbound payload validation functionality which provided by the constraint package. Enabled by default
googleapis.youtube.analytics: ErrorProto![](/images/permalink.svg)
Describes one specific error.
Fields
- argument string[]? - Error arguments, to be used when building user-friendly error messages given the error domain and code. Different error codes require different arguments.
- code 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 string? - Debugging information, which should not be shared externally.
- domain 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 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 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 string? - Location type.
googleapis.youtube.analytics: Errors![](/images/permalink.svg)
Request Error information. The presence of an error field signals that the operation has failed.
Fields
- code string? - Global error code. Deprecated and ignored. Set custom error codes in ErrorProto.domain and ErrorProto.code instead.
- 'error ErrorProto[]? - Specific error description and codes
- requestId string? - Request identifier generated by the service, which can be used to identify the error in the logs
googleapis.youtube.analytics: Group![](/images/permalink.svg)
A group.
Fields
- contentDetails GroupContentDetails? - A group's content details.
- errors Errors? - Request Error information. The presence of an error field signals that the operation has failed.
- etag string? - The Etag of this resource.
- id string? - The ID that YouTube uses to uniquely identify the group.
- kind string? - Identifies the API resource's type. The value will be
youtube#group
.
- snippet GroupSnippet? - A group snippet.
googleapis.youtube.analytics: GroupContentDetails![](/images/permalink.svg)
A group's content details.
Fields
- itemCount string? - The number of items in the group.
- itemType string? - The type of resources that the group contains. Valid values for this property are: *
youtube#channel
*youtube#playlist
*youtube#video
*youtubePartner#asset
googleapis.youtube.analytics: GroupItem![](/images/permalink.svg)
A group item.
Fields
- errors Errors? - Request Error information. The presence of an error field signals that the operation has failed.
- etag string? - The Etag of this resource.
- groupId string? - The ID that YouTube uses to uniquely identify the group that contains the item.
- id string? - The ID that YouTube uses to uniquely identify the
channel
,video
,playlist
, orasset
resource that is included in the group. Note that this ID refers specifically to the inclusion of that resource in a particular group and is different than the channel ID, video ID, playlist ID, or asset ID that uniquely identifies the resource itself. Theresource.id
property's value specifies the unique channel, video, playlist, or asset ID.
- kind string? - Identifies the API resource's type. The value will be
youtube#groupItem
.
- 'resource GroupItemResource? - The groupitem resource.
googleapis.youtube.analytics: GroupItemResource![](/images/permalink.svg)
The groupitem resource.
Fields
- id string? - The channel, video, playlist, or asset ID that YouTube uses to uniquely identify the item that is being added to the group.
- kind string? - Identifies the type of resource being added to the group. Valid values for this property are: *
youtube#channel
*youtube#playlist
*youtube#video
*youtubePartner#asset
googleapis.youtube.analytics: GroupSnippet![](/images/permalink.svg)
A group snippet.
Fields
- publishedAt string? - The date and time that the group was created. The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ) format.
- title string? - The group name. The value must be a non-empty string.
googleapis.youtube.analytics: ListGroupItemsResponse![](/images/permalink.svg)
Response message for GroupsService.ListGroupItems.
Fields
- errors Errors? - Request Error information. The presence of an error field signals that the operation has failed.
- etag string? - The Etag of this resource.
- items GroupItem[]? - A list of groups that match the API request parameters. Each item in the list represents a
groupItem
resource.
- kind string? - Identifies the API resource's type. The value will be
youtube#groupItemListResponse
.
googleapis.youtube.analytics: ListGroupsResponse![](/images/permalink.svg)
Response message for GroupsService.ListGroups.
Fields
- errors Errors? - Request Error information. The presence of an error field signals that the operation has failed.
- etag string? - The Etag of this resource.
- items Group[]? - A list of groups that match the API request parameters. Each item in the list represents a
group
resource.
- kind string? - Identifies the API resource's type. The value will be
youtube#groupListResponse
.
- nextPageToken string? - The token that can be used as the value of the
pageToken
parameter to retrieve the next page in the result set.
googleapis.youtube.analytics: OAuth2RefreshTokenGrantConfig![](/images/permalink.svg)
OAuth2 Refresh Token Grant Configs
Fields
- Fields Included from *OAuth2RefreshTokenGrantConfig
- refreshUrl string(default "https://accounts.google.com/o/oauth2/token") - Refresh URL
googleapis.youtube.analytics: ProxyConfig![](/images/permalink.svg)
Proxy server configurations to be used with the HTTP client endpoint.
Fields
- host string(default "") - Host name of the proxy server
- port int(default 0) - Proxy server port
- userName string(default "") - Proxy server username
- password string(default "") - Proxy server password
googleapis.youtube.analytics: QueryResponse![](/images/permalink.svg)
Response message for TargetedQueriesService.Query.
Fields
- columnHeaders ResultTableColumnHeader[]? - This value specifies information about the data returned in the
rows
fields. Each item in thecolumnHeaders
list identifies a field returned in therows
value, which contains a list of comma-delimited data. ThecolumnHeaders
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 parametersdimensions=ageGroup,gender&metrics=viewerPercentage
, the API response will return columns in this order:ageGroup
,gender
,viewerPercentage
.
- errors Errors? - Request Error information. The presence of an error field signals that the operation has failed.
- kind 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 anydata[]? - 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, therows
element will be omitted from the response. The response for a query with theday
dimension will not contain rows for the most recent days.
googleapis.youtube.analytics: ResultTableColumnHeader![](/images/permalink.svg)
The description of a column of the result table.
Fields
- columnType string? - The type of the column (
DIMENSION
orMETRIC
).
- dataType string? - The type of the data in the column (
STRING
,INTEGER
,FLOAT
, etc.).
- name string? - The name of the dimension or metric.
Import
import ballerinax/googleapis.youtube.analytics;
Metadata
Released date: almost 2 years ago
Version: 1.4.0
License: Apache-2.0
Compatibility
Platform: any
Ballerina version: 2201.2.1
GraalVM compatible: Yes
Pull count
Total: 1
Current verison: 0
Weekly downloads
Keywords
Business Intelligence/Analytics
Cost/Free
Vendor/Google
Contributors
Dependencies