ChannelSections: update

更新频道部分。

配额影响: 调用此方法会消耗 50 个配额单位。

常见应用场景

请求

HTTP 请求

PUT https://www.googleapis.com/youtube/v3/channelSections

授权

此请求需要获得以下至少一个范围的授权(详细了解身份验证和授权)。

范围
https://www.googleapis.com/auth/youtubepartner
https://www.googleapis.com/auth/youtube
https://www.googleapis.com/auth/youtube.force-ssl

参数

下表列出了此查询支持的参数。列出的所有参数都是查询参数。

参数
必需参数
part string
在此操作中,part参数有两个用途。它用于标识写入操作将设置的属性,以及 API 响应将包含的属性。

以下列表包含您可以在参数值中包含的 part 名称:
  • contentDetails
  • id
  • snippet
可选参数
onBehalfOfContentOwner string
此参数只能在经过适当授权的请求中使用。注意: 此参数仅供 YouTube 内容合作伙伴使用。

onBehalfOfContentOwner 参数表示,请求的授权凭据标识的是代表参数值中指定的内容所有者行事的 YouTube 内容管理系统 (CMS) 用户。此参数适用于拥有和管理许多不同 YouTube 频道的 YouTube 内容合作伙伴。它允许内容所有者进行一次身份验证,即可访问其所有视频和频道数据,而无需为每个频道提供身份验证凭据。用户进行身份验证时使用的 CMS 账号必须与指定的 YouTube 内容所有者相关联。

请求正文

在请求正文中提供 channelSection 资源。 对于该资源:

  • 您必须为以下属性指定值:

    • snippet.type

  • 您可以为以下属性设置值:

    • snippet.type
    • snippet.title
    • snippet.position
    • contentDetails.playlists[]
    • contentDetails.channels[]

    如果您提交的是更新请求,并且您的请求未为已有值的属性指定值,则该属性的现有值将被删除。

响应

如果成功,此方法会在响应正文中返回 channelSection 资源。

错误

下表列出了 API 在响应对此方法的调用时可能会返回的出错提示。如需了解详情,请参阅错误消息文档。

错误类型 错误详情 说明
badRequest (400) notEditable 无法修改此频道部分。
badRequest (400) typeRequired channelSection 资源必须为 snippet.type 字段指定值。
forbidden (403) channelSectionForbidden 请求未经过适当的身份验证,或者此频道不支持该请求。
invalidValue (400) channelNotActive 至少有一个指定的频道未处于活跃状态。
invalidValue (400) channelsDuplicated 请求失败,因为它指定了重复的频道。
invalidValue (400) channelsNeeded 如果 snippet.type 属性的值为 multipleChannels,则必须指定 contentDetails.channels[] 属性,并且必须指定至少一个频道。
invalidValue (400) channelsNotExpected 请求提供的资源为 contentDetails.channels[] 属性指定了值,但此类型的频道部分不应包含频道。
invalidValue (400) contentDetailsNeeded 您要更新的资源必须包含此类型的频道部分的 contentDetails 对象。
invalidValue (400) idInvalid id 属性指定了无效的频道部分 ID。
invalidValue (400) idRequired id 属性必须指定一个值,用于标识要更新的频道部分。
invalidValue (400) inValidPosition snippet.position 属性包含无效值。
invalidValue (400) maxChannelsExceeded 请求失败,因为它尝试在频道部分中包含过多频道。
invalidValue (400) maxPlaylistExceeded 请求失败,因为它尝试在频道部分中包含过多播放列表。
invalidValue (400) onePlaylistNeeded 如果 snippet.type 属性的值为 singlePlaylist,则 contentDetails.playlists[] 属性必须指定一个播放列表。
invalidValue (400) ownChannelInChannels 您不能在显示在您自己频道上的频道部分中包含您自己的频道。
invalidValue (400) playlistIsPrivate 一个或多个指定的播放列表是私密的,因此无法包含在频道部分中。
invalidValue (400) playlistsDuplicated 请求失败,因为它指定了重复的播放列表。
invalidValue (400) playlistsNeeded 如果 snippet.type 属性的值为 singlePlaylist 或 multiplePlaylists,则必须指定 contentDetails.playlists[] 属性。
invalidValue (400) playlistsNotExpected 请求提供的资源为 contentDetails.playlists[] 属性指定了值,但此类型的频道部分不应包含播放列表。
invalidValue (400) snippetNeeded 您必须指定 snippet 才能更新频道部分。
invalidValue (400) titleLengthExceeded snippet.title 属性的值过长。
invalidValue (400) titleRequired 如果 snippet.type 属性的值为 multiplePlaylists 或 multipleChannels,则必须通过为 snippet.title 属性指定值来设置该部分的标题。
notFound (404) channelNotFound 找不到一个或多个指定的频道。
notFound (404) channelSectionNotFound 找不到您尝试更新的频道部分。
notFound (404) playlistNotFound 找不到一个或多个指定的播放列表。

试试看!

使用 APIs Explorer 调用此 API,查看 API 请求和响应。