Reputation: 6848
I've read almost all api reference in google. There was a method to get a file or upload a file. In get file you need to pass file id
:
var request = gapi.client.drive.files.get({
'fileId': fileId
});
But what I want to achieve is to get users permission through my app (client app), and I then should see users' files. User himself should choose one of the the files.
Is there any way to achieve it?
Upvotes: 0
Views: 4938
Reputation: 22286
if the purpose is to allow the user to choose one of his own files, then you might want to consider using the JS Picker https://developers.google.com/picker/docs/
If you really want to retrieve the list of files into your app, then the simplest way is to use $http.get with a url of https://www.googleapis.com/drive/v2/files
In your question you posted code to do a GET, rather than a LIST. GET (https://developers.google.com/drive/v2/reference/files/get) will fetch all of the meta data for a single file, given its ID. LIST (https://developers.google.com/drive/v2/reference/files/list) will fetch meta data for all files (generally qualified with a q parameter to filter out trashed files).
Upvotes: 4