Learn about the new Picker API and important Library API changes.
Details here.
管理媒体内容
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
除了在上传媒体内容后访问和检索这些内容之外,您还可以更改其说明。
必需的授权范围
更改应用创建内容的说明需要 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):2024-11-09。
[[["易于理解","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-11-09。"],[[["After uploading media items to Google Photos, you can change their descriptions using the Google Photos API."],["Modifying descriptions of app-created content requires the `photoslibrary.edit.appcreateddata` scope and ownership by the authenticated user."],["To update a description, use the `mediaItems/patch` endpoint with the item's ID and a request body containing the new description."],["The `updateMask` parameter in the request URL specifies that only the description is being modified."],["The response to a successful update request will return the complete updated media item object."]]],[]]