2025 年 4 月 1 日,Library API 中的部分範圍已遭到移除。
詳情請參閱這篇文章。
Google uses AI technology to translate content into your preferred language. AI translations can contain errors.
管理媒體項目
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
除了上傳後存取及擷取媒體項目,您還可以變更媒體項目的說明。
必要的授權範圍
如要變更應用程式建立內容的說明,您必須使用 photoslibrary.edit.appcreateddata 範圍。如要進一步瞭解範圍,請參閱「授權範圍」。
如要變更媒體項目的說明,請使用媒體項目 ID 發出 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"
}
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-29 (世界標準時間)。
[null,null,["上次更新時間: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"]]