Reading Google Photos API documentation on how to add position media items inside the album I can't understand what should be the request body. https://developers.google.com/photos/library/guides/add-enrichments#supported-positioning
I want to move mediaItem-1
to be before mediaItem-2
in album album-1
. How my request body should look like?
POST https://photoslibrary.googleapis.com/v1/albums/album-1:addEnrichment
{
"newEnrichmentItem": {
enrichment-to-be-added // What goes here?
},
"albumPosition": {
"position": "after-media-item",
"relativeMediaItemId": "mediaItem-2"
}
}
EDIT: I don't want to reupload a media item to the cloud, so there will be only one version of the same media item.
A position can only be specified when creating a media item or adding enrichments. Existing media items in an album can't be reorganized, so it's important to set the position of an item when it's being added.
Reference: https://developers.google.com/photos/library/guides/add-enrichments#intro-positions
The method you are using is for Album Enrichment.
Enrichment Types:
Text enrichments
A text enrichment is a plain text string that can be inserted to annotate the album.
Location enrichments
A location enrichment is a marker and the name of the place that can be inserted to annotate a location.
Map enrichments
A map enrichment is a map with a specified origin and destination that can be inserted in the album.
Additional References: https://developers.google.com/photos/library/reference/rest/v1/albums/addEnrichment?hl=en_US#request-body
Sample media item creation with position: https://developers.google.com/photos/library/reference/rest/v1/mediaItems/batchCreate#request-body
albumPosition
(UPDATE)
Workaround:
Delete mediaItem-2 in album-1
Create mediaItem-2 in album-1 with position parameter which will place mediaItem-2 after mediaItem-1 https://developers.google.com/photos/library/reference/rest/v1/AlbumPosition#PositionType
Your request body for create media item: