Learn about the new Picker API and important Library API changes.
Details here.
Zarządzanie elementami multimedialnymi
Oprócz dostępu do zasobów multimedialnych i ich pobierania po przesłaniu możesz też zmieniać ich opisy.
Wymagany zakres autoryzacji
Zmiana opisów treści utworzonych przez aplikację wymaga uprawnień photoslibrary.edit.appcreateddata
. Więcej informacji o zakresach znajdziesz w artykule Zakresy autoryzacji.
Aby zmienić opis elementu multimedialnego, utwórz element media items update
call
z identyfikatorem elementu multimedialnego i dodaj nowy opis w żądaniu.
Aby zmienić opis elementu multimedialnego, aplikacja musi przesłać ten element, a obecnie uwierzytelniony użytkownik musi być jego właścicielem. Opis nie może mieć więcej niż 1000 znaków.
REST
Oto nagłówek żądania PATCH służący do aktualizacji opisu elementu multimedialnego:
PATCH https://photoslibrary.googleapis.com/v1/mediaItems/media-item-id?updateMask=description
To żądanie określa, które usługi są aktualizowane, przez uwzględnienie maski pól, wskazanej przez parametr updateMask
w adresie URL.
W treści prośby umieść nowy opis:
{
"description": "new-media-item-description"
}
Jeśli operacja się powiedzie, odpowiedź zwróci zaktualizowany element multimedialny:
{
"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"
}
O ile nie stwierdzono inaczej, treść tej strony jest objęta licencją Creative Commons – uznanie autorstwa 4.0, a fragmenty kodu są dostępne na licencji Apache 2.0. Szczegółowe informacje na ten temat zawierają zasady dotyczące witryny Google Developers. Java jest zastrzeżonym znakiem towarowym firmy Oracle i jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2024-11-09 UTC.
[null,null,["Ostatnia aktualizacja: 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"]]