Google Drive API向“照片"空间中的查询返回空列表 [英] Google drive API returns empty list to queries on 'photos' space

查看:60
本文介绍了Google Drive API向“照片"空间中的查询返回空列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将驱动器api drive.files.list用于照片空间将返回空文件列表.如果未指定空间,则会得到文件列表,其中一些文件既是驱动器空间又是照片空间的成员,如下所示:

Using the drive api drive.files.list for the photos space is returning empty file lists. If I do not specify a space, I get a list of files, some of which are members of both the drive and photos spaces, as shown here:

查询:

GET https://www.googleapis.com/drive/v3/files?pageSize=1000&fields=files&key={YOUR_API_KEY}

响应(很多文件元数据,包括具有'spaces'属性的文件)

Response (lots of file metadata, including files with 'spaces' property like this):

..."spaces": ["photos","drive"],...

但是,如果我查询从照片"空间中查找文件,则会得到以下信息:

However if I query looking for files from the 'photos' space, I get this:

查询:

GET https://www.googleapis.com/drive/v3/files?pageSize=1000&spaces=photos&fields=files&key={YOUR_API_KEY}

响应:

{"files": []}

因此,我似乎拥有正确的权限,因为如果未指定'space',它将返回所有文件信息,但是将'photos'的过滤约束添加到'space'属性中将导致不返回文件元数据(空列表).

So it seems I have the permissions correct since it will return to me all file information if 'space' is not specified, however adding the filter constraint of 'photos' to the 'space' property causes no file metadata to be returned (empty list).

此功能在过去的几年中一直有效,并且最近似乎已失效.

This feature worked for the last couple of years, and recently seems to have broken.

任何提示表示赞赏!

推荐答案

在当前阶段,不推荐使用照片空间.

In the current stage, photos space is introduced as deprecated.

(不建议使用)照片空间包括上载到Google相册的所有图像和视频.

(DEPRECATED) The photos space includes all images and videos uploaded to Google Photos.

引用: https://developers.google.com/drive/v3/web/about-organization#spaces

因为Google相册是最近更新的.(关于此,您可能已经知道.)通过此更新,云端硬盘API的端点可以检索Google Photos中的文件,而无需 spaces = photos .如果您只想检索Google相册中的文件,请使用 q .

Because Google Photos was updated recently. (About this, you may have already known.) By this update, files in Google Photos are retrieved by the Drive API's endpoint without spaces=photos. If you want to retrieve only files in Google Photos, please use q.

您可以使用以下文件夹ID在Google相册中检索文件.

You can retrieve files in Google Photos using folder ID as follows.

GET https://www.googleapis.com/drive/v3/files?q=%22### folder ID of Google Photos ###%22+in+parents&key={YOUR_API_KEY}

如果看不到"Google相册"文件夹

根据您的问题,您可能已经完成了以下设置.如果已经完成,请忽略此操作.

If you cannot see the folder of "Google Photos"

From your question, you may have already done the following setting. If you have already done, please ignore this.

如果看不到"Google相册"文件夹,请访问 https://support.google.com/photos?p=drive ,然后检查文档.启用Google云端硬盘后,您可以查看该文件夹并检索该文件夹ID.在这种情况下,"Google相册"中的文件和文件夹将变为空格":[驱动器"] .

If you cannot see the folder of "Google Photos", please access to https://support.google.com/photos?p=drive, and check the document. When Google Drive is enabled, you can see the folder and retrieve the folder ID. In this situation, files and folders in "Google Photos" become "spaces": ["drive"].

如果我误解了你的情况,对不起.

If I misunderstand your situation, I'm sorry.

这篇关于Google Drive API向“照片"空间中的查询返回空列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆