我们正在更新 Data API,以便与 YouTube 统计 Shorts 短视频观看次数的方式保持一致。
了解详情
PlaylistImages: insert
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
将图片添加到播放列表。
此方法支持媒体上传。上传的文件必须符合以下限制条件:
- 文件大小上限:2MB
- 接受的宽高比:1:1(方形)
- 接受的媒体 MIME 类型:
image/jpeg
、image/png
配额影响:调用此方法将产生 50 个单位的配额费用。
请求
HTTP 请求
POST https://www.googleapis.com/youtube/v3/playlistImages
授权
此请求需要获得以下至少一个范围的授权(详细了解身份验证和授权)。
范围 |
https://www.googleapis.com/auth/youtubepartner |
https://www.googleapis.com/auth/youtube |
https://www.googleapis.com/auth/youtube.force-ssl |
参数
下表列出了此查询支持的参数。列出的所有参数均为查询参数。
参数 |
必需参数 |
part |
string
part 参数指定了一个
包含一个或多个 playlistImage 资源的逗号分隔列表
API 响应将包含的属性。
如果参数
表示包含子属性的属性,子属性
会包含在响应中。
|
可选参数 |
onBehalfOfContentOwner |
string
此参数只能在适当授权的请求中使用。注意:此参数专用于 YouTube 内容合作伙伴。
onBehalfOfContentOwner 参数用于指明请求的授权凭据可标识代表参数值中指定的内容所有者执行操作的 YouTube 内容管理系统用户。此参数适用于拥有和管理多个不同 YouTube 频道的 YouTube 内容合作伙伴。有了它,内容所有者只需验证一次身份,即可访问自己所有的视频和频道数据,而无需为每个频道提供身份验证凭据。用户进行身份验证时使用的内容管理系统账号必须与指定的 YouTube 内容所有者相关联。 |
onBehalfOfContentOwnerChannel |
string
此参数只能在适当授权的请求中使用。注意:此参数仅适用于 YouTube 内容合作伙伴。
onBehalfOfContentOwnerChannel 参数
用于指定视频所面向的频道的 YouTube 频道 ID
已添加。如果请求为
onBehalfOfContentOwner 参数,且只能在
与该参数结合使用。此外,该请求必须是
使用与内容所有者的
onBehalfOfContentOwner 参数指定。最后,
onBehalfOfContentOwnerChannel 参数值的通道
指定的广告必须与内容拥有者相关联的
onBehalfOfContentOwner 参数指定的值。
此
参数适用于拥有和管理许多
不同 YouTube 频道它允许内容所有者进行身份验证一次
并代表参数中指定的渠道执行操作
而无需为每个字段提供身份验证凭据
独立频道 |
请求正文
在请求正文中提供 playlistImages 资源。
对于该资源:
-
您必须为以下属性指定一个值:
snippet.playlistId
snippet.type
-
您可以为以下属性设置值:
snippet.width
snippet.height
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-08-16。
[null,null,["最后更新时间 (UTC):2024-08-16。"],[[["\u003cp\u003eThis API method adds an image to a playlist, supporting media uploads with a maximum file size of 2MB and a 1:1 aspect ratio, and only accepts \u003ccode\u003eimage/jpeg\u003c/code\u003e and \u003ccode\u003eimage/png\u003c/code\u003e MIME types.\u003c/p\u003e\n"],["\u003cp\u003eUsing this method requires authorization with scopes such as \u003ccode\u003ehttps://www.googleapis.com/auth/youtubepartner\u003c/code\u003e, \u003ccode\u003ehttps://www.googleapis.com/auth/youtube\u003c/code\u003e, or \u003ccode\u003ehttps://www.googleapis.com/auth/youtube.force-ssl\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003epart\u003c/code\u003e parameter is required to specify the \u003ccode\u003eplaylistImage\u003c/code\u003e resource properties to be included in the API response.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eonBehalfOfContentOwner\u003c/code\u003e and \u003ccode\u003eonBehalfOfContentOwnerChannel\u003c/code\u003e parameters are available for YouTube content partners managing multiple channels to authenticate once and access data across all channels.\u003c/p\u003e\n"],["\u003cp\u003eThe request body requires a \u003ccode\u003eplaylistImages\u003c/code\u003e resource with \u003ccode\u003esnippet.playlistId\u003c/code\u003e and \u003ccode\u003esnippet.type\u003c/code\u003e, and it can include optional \u003ccode\u003esnippet.width\u003c/code\u003e and \u003ccode\u003esnippet.height\u003c/code\u003e properties.\u003c/p\u003e\n"]]],["To add an image to a playlist, send a POST request to `https://www.googleapis.com/youtube/v3/playlistImages`, ensuring authorization with appropriate scopes. Uploaded images must be square (1:1 aspect ratio), under 2MB, and be either JPEG or PNG. The request requires the `part` parameter, and the request body must include `snippet.playlistId` and `snippet.type`. Optional parameters include `onBehalfOfContentOwner` and `onBehalfOfContentOwnerChannel`. A successful call returns a `playlistImages` resource and has a quota cost of 50 units.\n"],null,["# PlaylistImages: insert\n\nAdds an image to a playlist.\n\nThis method supports media upload. Uploaded files must conform to these constraints:\n\n- **Maximum file size:** 2MB\n- **Accepted aspect ratio:** 1:1 (square)\n- **Accepted Media MIME types:** `image/jpeg`, `image/png`\n\n**Quota impact:** A call to this method has a [quota cost](/youtube/v3/getting-started#quota) of 50 units.\n\nRequest\n-------\n\n### HTTP request\n\n```\nPOST https://www.googleapis.com/youtube/v3/playlistImages\n```\n\n### Authorization\n\nThis request requires authorization with at least one of the following scopes ([read more about authentication and authorization](/youtube/v3/guides/authentication)).\n\n| Scope |\n|-----------------------------------------------------|\n| `https://www.googleapis.com/auth/youtubepartner` |\n| `https://www.googleapis.com/auth/youtube` |\n| `https://www.googleapis.com/auth/youtube.force-ssl` |\n\n### Parameters\n\nThe following table lists the parameters that this query supports. All of the parameters listed are query parameters.\n\n| Parameters ||\n|---------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| **Required parameters** |||\n| `part` | `string` The **part** parameter specifies a comma-separated list of one or more `playlistImage` resource properties that the API response will include. If the parameter identifies a property that contains child properties, the child properties will be included in the response. |\n| **Optional parameters** |||\n| `onBehalfOfContentOwner` | `string` This parameter can only be used in a properly [authorized request](/youtube/v3/guides/authentication). **Note:** This parameter is intended exclusively for YouTube content partners. The **onBehalfOfContentOwner** parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. 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 CMS account that the user authenticates with must be linked to the specified YouTube content owner. |\n| `onBehalfOfContentOwnerChannel` | `string` This parameter can only be used in a properly [authorized request](/youtube/v3/guides/authentication). **Note:** This parameter is intended exclusively for YouTube content partners. \u003cbr /\u003e The **onBehalfOfContentOwnerChannel** parameter specifies the YouTube channel ID of the channel to which a video is being added. This parameter is required when a request specifies a value for the `onBehalfOfContentOwner` parameter, and it can only be used in conjunction with that parameter. In addition, the request must be authorized using a CMS account that is linked to the content owner that the `onBehalfOfContentOwner` parameter specifies. Finally, the channel that the `onBehalfOfContentOwnerChannel` parameter value specifies must be linked to the content owner that the `onBehalfOfContentOwner` parameter specifies. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and perform actions on behalf of the channel specified in the parameter value, without having to provide authentication credentials for each separate channel. |\n\n### Request body\n\nProvide a [playlistImages resource](/youtube/v3/docs/playlistImages#resource) in the request body.\n\nFor that resource:\n\n- You must specify a value for these properties:\n\n - `snippet.playlistId`\n - `snippet.type`\n- You can set values for these properties:\n\n - `snippet.width`\n - `snippet.height`\n\nResponse\n--------\n\nIf successful, this method returns a [playlistImages resource](/youtube/v3/docs/playlistImages#resource) in the response body."]]