Reputation: 83
I am using Google Drive SDK to get a list of my files and display them on my site! I am using a service account for server-side integration!
I have like 4-5 folders in my root directory and 50-60 files in each of them! What scopes should I use and what method should I use so as to retrieve all the folders and then their sub files?
I cant seem to find documentation for getting folders or so! In v2 it was by using childrens method but PHP SDK is on v3.
My flow would be like this.
Authenticate using service acccount->get list of folders->get list of files inside this folder->display them.
Upvotes: 1
Views: 849
Reputation: 22286
First make sure you understand that a Service Account is not your personal Google account. So unless you share all your folders, you will not be able to access your files by authenticating using a Service Account. See How do I authorise an app (web or installed) without user intervention? (canonical ?)
Once you are authenticating using the correct credentials. The best approach is to:-
files.list q='mimetype=application/vnd.google-apps.folder and trashed=false
files.list q=parents in (id1, id2,...) and trashed = false
See How do I search sub-folders and sub-sub-folders in Google Drive? for some background on how folders work.
Upvotes: 0