Members: list
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
注意:只有个人创作者可以使用此端点为自己已启用频道会员功能的 YouTube 频道发出请求。如需申请访问权限,请与您的 Google 或 YouTube 代表联系。
列出频道的成员(以前称为“赞助者”)。该 API 请求必须获得频道所有者的授权。
对配额的影响:调用此方法的配额费用为 2 个单位。
请求
HTTP 请求
GET https://www.googleapis.com/youtube/v3/members
授权
此请求需要获得以下范围的授权:
范围 |
https://www.googleapis.com/auth/youtube.channel-memberships.creator |
参数
下表列出了此查询支持的参数。列出的所有参数都是查询参数。
参数 |
必需参数 |
part |
string
part 参数指定 API 响应将包含的 member 资源属性。将参数值设为 snippet 。 |
可选参数 |
mode |
string
mode 参数用于指明 API 响应中将包含哪些成员。将参数值设为以下值之一:
all_current (默认)- 按从新到旧的顺序列出当前成员。使用此值时,如果 API 响应不包含 nextPageToken ,则会到达列表末尾。
updates - 仅列出自上次 API 调用后加入或升级的成员。请注意,首次调用会启动新的更新流,但实际上不会返回任何成员。如需开始检索成员资格更新,您需要使用 nextPageToken 以所需的频率轮询端点。
请注意,使用此值时,API 响应始终包含 nextPageToken 。
|
maxResults |
unsigned integer
maxResults 参数指定结果集中应返回的商品数量上限。可接受的值包括0 到1000 (含 0 和 10000)。默认值为 5 。 |
pageToken |
string
pageToken 参数用于标识结果集中应返回的特定网页。该令牌特定于原始 API 请求中使用的 mode ,因此您无法使用通过一种模式检索到的页面令牌来随后切换到其他模式。 |
hasAccessToLevel |
string
hasAccessToLevel 参数值是一个级别 ID,用于指定结果集中的成员应具备的最低级别。 |
filterByMemberChannelId |
string
filterByMemberChannelId 参数指定了以逗号分隔的频道 ID 列表,可用于检查特定用户的成员资格状态。例如 UC_1,UC_2,UC_3 。每次调用最多可以指定 100 个渠道。 |
响应
属性
下表定义了此资源中显示的属性:
属性 |
kind |
string 标识 API 资源的类型。其值为 youtube#memberListResponse 。 |
etag |
etag
此资源的 Etag。 |
nextPageToken |
string
可用作 pageToken 参数值的令牌,用于检索结果集中的下一页。页面令牌可能会过期,因此您的应用应丢弃该令牌,在没有 pageToken 的情况下调用 API 来启动新请求。 |
pageInfo |
object
pageInfo 对象可封装结果集的分页信息。 |
pageInfo.totalResults |
integer
结果集中的结果总数。 |
pageInfo.resultsPerPage |
integer
API 响应中包含的结果数量。 |
items[] |
list
符合请求条件的成员列表。 |
错误
下表列出了 API 在响应对此方法的调用时可能会返回的错误消息。如需了解详情,请参阅错误消息文档。
错误类型 |
错误详情 |
说明 |
badRequest (400) |
channelMembershipsNotEnabled |
批准该请求的创作者频道未启用频道会员功能。 |
badRequest (400) |
invalidMode |
mode 参数值无效。
如果 pageToken 参数指定的令牌在检索时使用的模式与所指定的模式不同,则可能会发生此错误。 |
badRequest (400) |
invalidPageToken |
pageToken 参数值无效。如果请求中使用的页面令牌已过期或无法识别,则可能会发生此错误。 |
badRequest (400) |
invalidHasAccessToLevel |
hasAccessToLevel 参数值无效。没有与指定的 id 对应的级别。 |
badRequest (400) |
invalidFilterByMemberChannelId |
filterByMemberChannelId 参数值无效。如果 filterByMemberChannelId 参数值指定的渠道超过 100 个,就会发生此错误。 |
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-04-26。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2024-04-26。"],[[["\u003cp\u003eThis endpoint is designed for individual YouTube creators to retrieve a list of members for their own channel-memberships-enabled channel, and requires specific authorization.\u003c/p\u003e\n"],["\u003cp\u003eThe API request must be authorized with the scope \u003ccode\u003ehttps://www.googleapis.com/auth/youtube.channel-memberships.creator\u003c/code\u003e and has a quota cost of 2 units per call.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003epart\u003c/code\u003e parameter is required and must be set to \u003ccode\u003esnippet\u003c/code\u003e, while the \u003ccode\u003emode\u003c/code\u003e, \u003ccode\u003emaxResults\u003c/code\u003e, \u003ccode\u003epageToken\u003c/code\u003e, \u003ccode\u003ehasAccessToLevel\u003c/code\u003e, and \u003ccode\u003efilterByMemberChannelId\u003c/code\u003e are optional parameters for customizing the list of members returned.\u003c/p\u003e\n"],["\u003cp\u003eThe API response includes properties such as \u003ccode\u003ekind\u003c/code\u003e, \u003ccode\u003eetag\u003c/code\u003e, \u003ccode\u003enextPageToken\u003c/code\u003e, \u003ccode\u003epageInfo\u003c/code\u003e, and \u003ccode\u003eitems[]\u003c/code\u003e which contains a list of member resources, along with error handling for issues like invalid parameters or disabled channel memberships.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003emode\u003c/code\u003e parameter allows the retrieval of all current members or only new members, and when using \u003ccode\u003eupdates\u003c/code\u003e as a mode, you will need to retrieve members using the \u003ccode\u003enextPageToken\u003c/code\u003e.\u003c/p\u003e\n"]]],["This API endpoint allows authorized YouTube channel owners to retrieve a list of their channel members. Key actions include: making a `GET` request to the `members` endpoint with the `part=snippet` parameter, and optionally filtering results by mode (`all_current` or `updates`), maximum results (`maxResults`), page token (`pageToken`), member access level (`hasAccessToLevel`), or specific member channel IDs (`filterByMemberChannelId`). The response provides a list of members, pagination information, and any applicable error messages. Requires `youtube.channel-memberships.creator` authorization.\n"],null,[]]