To directly download a raw file from Google Drive use the URL:
https://drive.google.com/uc?export=download&id=
followed by the ID of the file. So we can find the ID of files by opening
the file in Google Drive, but that defeats the point of having a direct download
doesn't it?
https://developers.google.com/drive/v3/reference/files/list
shows us how to get a list of files. And we can apply that to a single request
via:
https://www.googleapis.com/drive/v3/files?q=<query>&key=<authorization
token>
but:
1. we need an authorization token to access the users drive. Basically this
tells google who's drive to access. So the user has to figure out how to
provide that. At this point, it's not terribly difficult,
http://stackoverflow.com/questions/18116152/how-do-i-get-a-file-list-for-a-google-drive-public-hosted-folder
"Go to Google Console:
https://console.developers.google.com/
In left menu select 'Credentials'. Click 'Create credentials' and select
API key. Click 'Browser key' Copy the generate key."
2. We need the ID of the folder (which we then have to find under the /main/
folder, which has ID 'root' to ensure we are looking there and not finding
a folder of the same name under a sub folder). To find a specific folder
called "Public" in the main folder, q is (html encoded):
name='Public' and 'root' in parents
Note that the "in parents" part means that the file we are looking for has
a parent with that ID. e.g.
https://www.googleapis.com/drive/v3/files?q=name%3D'Public'+and+'root'+in+parents&key={YOUR_API_KEY}
To find things in a specific folder, given the ID of the folder:
name='test.TXT' and '0B0ap0WDOII5mbjdwajNBMlRoZUU' in parents
e.g.
https://www.googleapis.com/drive/v3/files?q=name%3D'test.TXT'+and+'0B0ap0WDOII5mbjdwajNBMlRoZUU'+in+parents&key={YOUR_API_KEY}
Except... That doesn't
work:
https://code.google.com/a/google.com/p/apps-api-issues/issues/detail?id=4971