Google Drive API v3, is there a way to get a list of folders that are parents of fileId?

In v2, you could make a /filesrequest call fileId in childrento get a list of objects DriveFilethat were the parents of the provided file.

Now you need to make a call /files/:fileId?fields=parents, then make a separate call /files/:parentIdfor each returned parent, possibly turning one call into a dozen.

Is this correct, and if so, why? This is a huge success in our application, so I hope there is an undocumented method.

+4
source share
3 answers

"'fileId" " ( /) 2, - . , V2, - , . v3, , .

, , , . v2 , isRoot. , /root , ( , .)

, , , , . , ( .) , , . HTTP-/ .

, , , . , .

, , 2 HTTP- ( , 1000+ , :)

+2

, :

var request = service.Files.List();
 request.Q = "('root' in parents)";
 var FileListOfParentOnly = request.Execute();
0

In V3, you can list all the children of a parent, as described here: https://developers.google.com/drive/v3/web/search-parameters

Call example: of https://www.googleapis.com/drive/v3/files?q=parents in '0Byho0qAdzabmVl8xcDR1S0pNY3c'course, replace the spaces with %20, this will display all the files in the folder withid='0Byho0qAdzabmVl8xcDR1S0pNY3c'

-1
source

Source: https://habr.com/ru/post/1625560/


All Articles