2025 年 4 月 1 日,我们移除了 Library API 中的部分镜重。
点击此处了解详情。
Google uses AI technology to translate content into your preferred language. AI translations can contain errors.
管理媒体内容
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
除了在上传媒体内容后访问和检索这些内容之外,您还可以更改其说明。
必需的授权范围
更改应用创建内容的说明需要 photoslibrary.edit.appcreateddata 范围。如需详细了解范围,请参阅授权范围。
如需更改媒体内容的说明,请使用媒体内容的标识符发出 media items update
call,并在请求中添加新的说明。
如需更改媒体项的说明,您的应用必须已上传媒体项,并且当前经过身份验证的用户必须是所有者。说明不得超过 1,000 个字符。
REST
以下是用于更新媒体内容描述的 PATCH 请求标头:
PATCH https://photoslibrary.googleapis.com/v1/mediaItems/media-item-id?updateMask=description
此请求通过添加字段掩码(由网址中的 updateMask 参数表示)来确定要更新的媒体资源。
在请求正文中添加新说明:
{
"description": "new-media-item-description"
}
如果成功,响应将返回更新后的媒体内容:
{
"id": "media-item-id",
"description": "new-media-item-description",
"productUrl": "media-item-product-url",
"baseUrl": "media-items-in-album",
"mimeType": "mime-type-of-media",
"mediaMetadata": {
...
},
"contributorInfo": {
...
},
"fileName": "item-filename"
}
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-29。
[null,null,["最后更新时间 (UTC):2025-08-29。"],[],["To modify a media item's description, use a `media items update call` with a PATCH request, specifying the item's ID and the `updateMask` parameter. Include the new description in the request body, ensuring it's under 1,000 characters. This requires the `photoslibrary.edit.appcreateddata` scope, with the app having uploaded the media, and the authenticated user must be the owner. A successful request returns the updated media item details, including the new description.\n"]]