Quản lý các mục nội dung nghe nhìn
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Ngoài việc truy cập và truy xuất các mục nội dung nghe nhìn sau khi tải lên, bạn cũng có thể thay đổi nội dung mô tả của các mục đó.
Phạm vi uỷ quyền bắt buộc
Bạn cần có phạm vi photoslibrary.edit.appcreateddata
để thay đổi nội dung mô tả của nội dung do ứng dụng tạo. Để biết thêm thông tin về phạm vi, hãy xem phần Phạm vi uỷ quyền.
Để thay đổi nội dung mô tả của một mục nội dung đa phương tiện, hãy tạo media items update
call
bằng giá trị nhận dạng của mục nội dung đa phương tiện đó và đưa nội dung mô tả mới vào yêu cầu.
Để thay đổi nội dung mô tả của một mục nội dung nghe nhìn, ứng dụng của bạn phải tải mục nội dung nghe nhìn đó lên và người dùng hiện đã được xác thực phải là chủ sở hữu. Nội dung mô tả không được dài quá 1.000 ký tự.
REST
Dưới đây là tiêu đề yêu cầu PATCH để cập nhật nội dung mô tả của một mục nội dung nghe nhìn:
PATCH https://photoslibrary.googleapis.com/v1/mediaItems/media-item-id?updateMask=description
Yêu cầu này xác định những thuộc tính đang được cập nhật bằng cách đưa vào một mặt nạ trường, được biểu thị bằng tham số updateMask
trong URL.
Thêm nội dung mô tả mới vào nội dung yêu cầu:
{
"description": "new-media-item-description"
}
Nếu thành công, phản hồi sẽ trả về mục nội dung nghe nhìn đã cập nhật:
{
"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"
}
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-08-29 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-08-29 UTC."],[[["\u003cp\u003eAfter uploading media items to Google Photos, you can change their descriptions using the Google Photos API.\u003c/p\u003e\n"],["\u003cp\u003eModifying descriptions of app-created content requires the \u003ccode\u003ephotoslibrary.edit.appcreateddata\u003c/code\u003e scope and ownership by the authenticated user.\u003c/p\u003e\n"],["\u003cp\u003eTo update a description, use the \u003ccode\u003emediaItems/patch\u003c/code\u003e endpoint with the item's ID and a request body containing the new description.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eupdateMask\u003c/code\u003e parameter in the request URL specifies that only the description is being modified.\u003c/p\u003e\n"],["\u003cp\u003eThe response to a successful update request will return the complete updated media item object.\u003c/p\u003e\n"]]],["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"],null,["# Manage media items\n\nIn addition to [accessing and\nretrieving](/photos/library/guides/access-media-items) media items after you\n[upload](/photos/library/guides/upload-media) them, you can also change their\ndescriptions.\n\nRequired authorization scope\n----------------------------\n\nChanging descriptions of app-created content requires the\n`photoslibrary.edit.appcreateddata` scope. For more information on scopes, see\n[Authorization scopes](/photos/overview/authorization).\n\nChanging media item descriptions\n--------------------------------\n\nTo change a media item's description, make a [`media items update\ncall`](/photos/library/reference/rest/v1/mediaItems/patch) with the identifier\nof the media item, and include the new description in the request.\n\nTo change a media item's description, your app must have uploaded the media\nitem, and the currently authenticated user must be the owner. Descriptions can\nbe no more than 1,000 characters in length. \n\n### REST\n\nHere's a PATCH request header to update a media item description: \n\n```\nPATCH https://photoslibrary.googleapis.com/v1/mediaItems/media-item-id?updateMask=description\n```\n\nThis request determines what properties are being updated by including a\nfield mask, indicated by the `updateMask` parameter in the URL.\n\nInclude the new description in the body of the request: \n\n```restructuredtext\n{\n \"description\": \"new-media-item-description\"\n}\n```\n\nIf successful, the response returns the updated media item: \n\n```restructuredtext\n{\n \"id\": \"media-item-id\",\n \"description\": \"\u003cvar translate=\"no\"\u003enew-media-item-description\u003c/var\u003e\",\n \"productUrl\": \"media-item-product-url\",\n \"baseUrl\": \"media-items-in-album\",\n \"mimeType\": \"mime-type-of-media\",\n \"mediaMetadata\": {\n ...\n },\n \"contributorInfo\": {\n ...\n },\n \"fileName\": \"\u003cvar translate=\"no\"\u003eitem-filename\u003c/var\u003e\"\n}\n```"]]