Jade
Jade

Reputation: 31

Getting a list of files from several folders in one request using Google Drive REST API

I'm trying to get metadata for all files in a particular publicly shared Google Drive folder using the v3/drive.files.list API. My current approach is to first get a list of everything in root,

q='some-id' in parents

and then repeat similar queries for all the subdirectiories found. What I'd like to do instead of requesting data for each subdirectory individually is to combine queries like so:

q='some-subdir-id-1' in parents or 'some-dubdir-id-2' in parents

(edited: originally posted query with and by mistake)

However, in APIs explorer this (sometimes) returns only files in one of directories, and in .NET binding it simply returns an empty list with no exceptions being thrown. So, is there a way to have multiple 'something' in parents parameters in a single query?

Test case.

Upvotes: 1

Views: 1262

Answers (1)

Tanaike
Tanaike

Reputation: 201378

You want to retrieve all files in several folders by one query. If my understanding is correct, how about this query?

q='some-subdir-id-1' in parents or 'some-dubdir-id-2' in parents or 'some-dubdir-id-3' in parents

Note :

  • At above query, using or, the files in the folders of some-subdir-id-1, some-subdir-id-2 and some-subdir-id-3 are retrieved.
  • When parents is used for fields, you can also retrieve the parents for each file, simultaneously.

Reference :

If this was not what you want, I'm sorry.

Upvotes: 1

Related Questions