Groups: insert
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
请求
HTTP 请求
POST https://youtubeanalytics.googleapis.com/v2/groups
授权
此请求需要获得以下至少一个范围的授权(详细了解身份验证和授权)。
范围 |
https://www.googleapis.com/auth/yt-analytics.readonly |
查看 YouTube 分析工具为您的 YouTube 内容出具的报告。此范围可让您访问用户活动指标,例如观看次数和评分次数。 |
https://www.googleapis.com/auth/yt-analytics-monetary.readonly |
查看 YouTube 分析工具为您的 YouTube 内容出具的财务报告。此范围可让您访问用户活动指标以及估算的收入和广告效果指标。 |
https://www.googleapis.com/auth/youtube |
管理您的 YouTube 账号。在 YouTube Analytics API 中,频道所有者使用此作用域来管理 YouTube 数据分析组和组项。 |
https://www.googleapis.com/auth/youtubepartner |
查看和管理您在 YouTube 上的 YouTube 资产和关联内容。在 YouTube Analytics API 中,内容所有者使用此作用域来管理 YouTube 数据分析组和组项。 |
参数
下表列出了此查询支持的参数。列出的所有参数都是查询参数。
参数 |
可选参数 |
onBehalfOfContentOwner |
string
此参数只能在经过适当授权的请求中使用。注意:此参数仅适用于拥有和管理许多不同 YouTube 频道的 YouTube 内容合作伙伴。
onBehalfOfContentOwner 参数表示请求的授权凭据标识了代表参数值中指定的内容所有者行事的 YouTube 用户。有了它,内容所有者只需验证一次身份,即可访问自己所有的视频和频道数据,而无需为每个频道提供身份验证凭据。用户进行身份验证时所用的账号必须与指定的 YouTube 内容所有者相关联。 |
请求正文
在请求正文中提供组资源。对于该资源,您必须为以下属性指定值。
snippet.title
contentDetails.itemType
错误
该 API 未定义任何仅适用于此 API 方法的错误消息。不过,此方法可能仍会返回错误消息文档中列出的常规 API 错误。
试试看!
使用 APIs Explorer 调用此 API,并查看 API 请求和响应。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-21。
[null,null,["最后更新时间 (UTC):2025-08-21。"],[[["\u003cp\u003eThis API method creates a new YouTube Analytics group, which can be populated with items via the \u003ccode\u003egroupItems.insert\u003c/code\u003e method.\u003c/p\u003e\n"],["\u003cp\u003eAuthorization for this request requires one of four possible scopes, including options for read-only access to analytics data, monetary reports, or management of YouTube accounts and assets.\u003c/p\u003e\n"],["\u003cp\u003eThe API call uses a POST request to \u003ccode\u003ehttps://youtubeanalytics.googleapis.com/v2/groups\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe request body must contain a group resource with values specified for \u003ccode\u003esnippet.title\u003c/code\u003e and \u003ccode\u003econtentDetails.itemType\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eonBehalfOfContentOwner\u003c/code\u003e parameter allows content partners to authenticate once to access data for multiple channels they manage, and it is intended exclusively for that use case.\u003c/p\u003e\n"]]],["This outlines how to create a YouTube Analytics group via a POST request to `https://youtubeanalytics.googleapis.com/v2/groups`. Authorization requires specific scopes, including read-only and monetary analytics, channel management, or content partner access. The request body must include a group resource with `snippet.title` and `contentDetails.itemType`. Content owners can use `onBehalfOfContentOwner` to manage multiple channels. Upon success, a group resource is returned. Items can be added to the group using the `groupItems.insert` method.\n"],null,["# Groups: insert\n\nCreates a YouTube Analytics group. After creating a group, use the [groupItems.insert](/youtube/analytics/reference/groupItems/insert) method to add items to the group.\n\nRequest\n-------\n\n### HTTP request\n\n```\nPOST https://youtubeanalytics.googleapis.com/v2/groups\n```\n\n### Authorization\n\nThis request requires authorization with at least one of the following scopes ([read more about authentication and authorization](/youtube/analytics/authentication)).\n\n| Scopes ||\n|----------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| https://www.googleapis.com/auth/yt-analytics.readonly | View YouTube Analytics reports for your YouTube content. This scope provides access to user activity metrics, like view counts and rating counts. |\n| https://www.googleapis.com/auth/yt-analytics-monetary.readonly | View YouTube Analytics monetary reports for your YouTube content. This scope provides access to user activity metrics and to estimated revenue and ad performance metrics. |\n| https://www.googleapis.com/auth/youtube | Manage your YouTube account. In the YouTube Analytics API, channel owners use this scope to manage YouTube Analytics groups and group items. |\n| https://www.googleapis.com/auth/youtubepartner | View and manage YouTube assets and associated content on YouTube. In the YouTube Analytics API, content owners use this scope to manage YouTube Analytics groups and group items. |\n\n### Parameters\n\nThe table below lists the parameters that this query supports. All of the parameters listed are query parameters.\n\n| Parameters ||\n|--------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| **Optional parameters** |||\n| `onBehalfOfContentOwner` | `string` This parameter can only be used in a properly [authorized request](/youtube/analytics/authentication). **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. |\n\n### Request body\n\nProvide a [group resource](/youtube/analytics/reference/groups#resource) in the request body.\nFor that resource, you must specify a value for the following properties.\n\n\u003cbr /\u003e\n\n- `snippet.title`\n- `contentDetails.itemType`\n\n\u003cbr /\u003e\n\nResponse\n--------\n\nIf successful, this method returns a [group resource](/youtube/analytics/reference/groups#resource) in the response body.\n\nErrors\n------\n\nThe API does not define any error messages that are unique to this API method. However, this method could still return general API errors listed in the [error message](/youtube/analytics/reference/errors#general) documentation.\n\nTry it!\n-------\n\nUse the APIs Explorer to call this API and see the API request and response."]]