Google Photos API 用滤镜获取带有相册信息的照片?

Google Photos API with filter to get photos with album information?

我正在查看新 Google 照片 API 的文档,但无法找到相册元数据的任何信息以及照片信息。

例如,如果我使用带有过滤器的列表库内容 API,生成的照片不会向我提供照片所属相册的详细信息。

现在的 API 有可能吗?

我也检查了 mediaItems ref。找不到这样的项目。有人探索过这个东西吗?

一个媒体项目可以属于多个相册,其中一些可能是共享的。

但是,库 API 不提供从媒体项到其所属专辑的映射。如果这是您缺少的东西,您可以 file a feature request 并描述您的用例。请务必描述您将如何使用此功能。

如果您想查看特定媒体项目(例如您通过搜索找到的媒体项目)是否是相册的一部分,您需要比较它们的 ID。例如,您可以列出相册的内容并检查您感兴趣的媒体项的 ID 是否是响应的一部分。

是的,您可以获得特定专辑的媒体。

查看此文档Listing album contents

To list all of the media items in an album, add the albumId field to your search request. For more information about albumId, see Listing albums. If the albumId is invalid, a Bad Request error is returned. If the ID is valid, but the album doesn't exist for the authenticated user, a Not Found error is returned. For more details regarding error handling, see Performance tips and Best practices.

POST https://photoslibrary.googleapis.com/v1/mediaItems:search
Content-type: application/json
Authorization: Bearer OAUTH2_TOKEN
{
  "pageSize":"100",
  "albumId": "ALBUM_ID"
}