0

I'm migrating to Google Drive REST API (Android SDK v3) and i can't figure out how to request file system entries for a Google Drive directory assuming i have it's fileId.

I looked into REST API and i can't see how i can pass fileId. It looks like search can be used ("%fileId%" in parents), but is it actually the recommended way? Any proper way of doing that?

4ntoine
  • 19,816
  • 21
  • 96
  • 220
  • 2
    When you want to retrieve the file list in the specific folder, it is required to use the search query, which shown in your question, of the Files: list method of Drive API. And if you want to retrieve all files and folders including the subfolders in the specific folder, it is required to recursively retrieve them using the parent ID and file ID. Because at Google Drive, all files and folders are managed with the unique ID. If this was not the direction you expect, I apologize. This thread might be useful. https://stackoverflow.com/q/41741520/7108653 – Tanaike Apr 22 '20 at 00:44
  • @Tanaike i guess your comment can be considered as an answer. Since it's a comment i can't do it but i've upvoted it at least. – 4ntoine Apr 22 '20 at 17:49
  • 1
    Thank you for replying. I noticed that an answer has already been posted now. I'm glad your issue was resolved. – Tanaike Apr 22 '20 at 23:38

1 Answers1

0

In v2 there was the Children resource, which you could use to list a folder's children (there was also the Parents resource, which you could use to list a file's parents). Because this resources functionalities could be achieved with Files: list, they were dropped in v3.

So in v3, the way to list files in a folder is by using the search query, as you said, like q: 'your-folder-id' in parents.

And if you want to include all files and folders inside subfolders, refer to the thread referenced by Tanaike.

Reference:

Iamblichus
  • 18,540
  • 2
  • 11
  • 27