Sophie Roos
Sophie Roos

Reputation: 21

Why can't I add a existing MediaItem to an existing Album using the online Api Explorer?

I'm using the albumId that I got from the albums.list method. It is, in my eyes, a valid ID, because I can use the albums.get method to get the album.

I'm using the mediaItemId that I got from the mediaItems.list method. It is, again in my eyes, a valid ID, because i can use the mediaItems.get method to get the mediaItem.

Both work without problems!

When I'm trying to add the mediaItem to the album, using the albums.batchAddMediaItems method, I get an

error: No permission to add media items to this album.

The request The error

I used OAuth 2.0 and checked every scope that can be checked.

Upvotes: 2

Views: 1032

Answers (2)

bare-naked
bare-naked

Reputation: 26

I think it's worse than this, no? Google won't allow you to (programmatically) add media that has NOT been uploaded by your app to an album ... even if you/your-app (programmatically) created that album

So the batchAddMediaItemsToAlbum functionality only supports the use-case that your app uploads media, and you want to organise them into albums. But not the (surely more common?) use-case where you want to (programmatically) organise the chaos of GPhotos

Upvotes: 0

Matt Pengelly
Matt Pengelly

Reputation: 1596

I asked the same question. I posted an answer there: Google photos api adding photos to existing album is broken

See "Media items can be created only within the albums created by your app. For more information, see Authentication and authorization scopes." from this link: https://developers.google.com/photos/library/guides/upload-media

The jist of it is that google api wont let you programatically modify an album that wasnt also created programatically. If you create the album via the api, get the response with the ID and then append to the album afterward. You shouldn't see that error response.

Upvotes: 5

Related Questions