MembershipsLevels: list
注意:只有个人创作者可以使用此端点为自己已启用频道会员功能的 YouTube 频道提出请求。如需申请访问权限,请与您的 Google 或 YouTube 代表联系。
列出授权了请求的频道的会员级别。关卡按隐式显示顺序返回。向此方法发出的 API 请求会产生以下响应之一:
对配额的影响:调用此方法的配额费用为 1 个单位。
请求
HTTP 请求
GET https://www.googleapis.com/youtube/v3/membershipsLevels
此请求需要获得以下范围的授权:
范围 |
https://www.googleapis.com/auth/youtube.channel-memberships.creator |
参数
下表列出了此查询支持的参数。列出的所有参数都是查询参数。
参数 |
必需参数 |
part |
string
part 参数指定 API 响应将包含的 membershipsLevel 资源属性。参数值是以英文逗号分隔的资源部分列表。以下列表显示了可检索的部分:
|
响应
如果成功,此方法将返回采用以下结构的响应正文:
{
"kind": "youtube#membershipsLevelListResponse",
"etag": etag,
"items": [
membershipsLevel Resource
]
}
属性
下表定义了此资源中显示的属性:
属性 |
kind |
string 标识 API 资源的类型。其值为 youtube#membershipsLevelListResponse 。 |
etag |
etag
此资源的 Etag。 |
items[] |
list
授权 API 请求的频道所拥有的 membershipsLevel 资源的列表。 |
错误
下表列出了 API 在响应对此方法的调用时可能会返回的错误消息。如需了解详情,请参阅错误消息文档。
错误类型 |
错误详情 |
说明 |
badRequest (400) |
channelMembershipsNotEnabled |
批准该请求的创作者频道未启用频道会员功能。 |
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-04-26。
[null,null,["最后更新时间 (UTC):2024-04-26。"],[[["This API endpoint allows individual YouTube creators with channel memberships enabled to retrieve a list of their channel's membership levels."],["The API response will either include a list of membership levels, an empty list if memberships are enabled but no levels are set, or an error if memberships are not enabled."],["A successful request returns a JSON response containing the resource type, Etag, and a list of `membershipsLevel` resources."],["Requests to this method have a quota cost of 1 unit and require authorization with the scope `https://www.googleapis.com/auth/youtube.channel-memberships.creator`."],["The request requires the `part` parameter with a string value that can contain either `id`, `snippet`, or both, as comma separated values."]]],["This API endpoint allows individual creators to retrieve channel membership levels for their YouTube channel. A `GET` request requires authorization with the `youtube.channel-memberships.creator` scope and the `part` parameter to specify the properties. The response, in JSON format, lists membership levels or an empty list if levels are undefined. If channel memberships aren't enabled, the API returns a `channelMembershipsNotEnabled` error. This method has a quota cost of 1 unit per call.\n"]]