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
ใน URL
ใส่คำอธิบายใหม่ในส่วนเนื้อหาของคำขอ
{
"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 Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2024-11-09 UTC
[[["เข้าใจง่าย","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"]],["อัปเดตล่าสุด 2024-11-09 UTC"],[[["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."]]],["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"]]