I have been searching for google drive api documentation but have not been able to find a good one. Where can I find the details of its modules and functions to upload, download, get the list of files, etc. ??
Here is documentation: https://developers.google.com/drive/v3/web/about-sdk But I think you've already found it. There are 3 api's:
If you are programming some PC software you shold use HTTP Rest API. You will send http requests to google server instead of calling functions or modules. Here's samples for python
Also there is library for python to use http api
The Drive API allows you to upload certain types of binary data, or media. The specific characteristics of the data you can upload are specified on the reference page for any method that supports media uploads:
You can make upload requests in any of the following ways. Specify the method you are using with the uploadType request parameters - Simple Upload, Multipart upload and Resumable upload.
When creating a file in Google Drive, you can convert some types file into a Google Docs, Sheets or Slides document by specifying the mimeType
property of the file. The following sample shows how to upload a CSV file as a spreadsheet:
file_metadata = {
'name' : 'My Report',
'mimeType' : 'application/vnd.google-apps.spreadsheet'
}
media = MediaFileUpload('files/report.csv',
mimetype='text/csv',
resumable=True)
file = drive_service.files().create(body=file_metadata,
media_body=media,
fields='id').execute()
print 'File ID: %s' % file.get('id')
For downloading files, the API allows you to download files that are stored in Google Drive. Also, you can download exported versions of Google Documents (Documents, Spreadsheets, Presentations, etc.) in formats that your app can handle. Drive also supports providing users direct access to a file via the URL in the webViewLink
property.
To download files, you make an authorized HTTP GET
request to the file's resource URL and include the query parameter alt=media
. For example:
GET https://www.googleapis.com/drive/v3/files/0B9jNhSvVjoIVM3dKcGRKRmVIOVU?alt=media
Authorization: Bearer ya29.AHESVbXTUv5mHMo3RYfmS1YJonjzzdTOFZwvyOAUVhrs
Here is an example of performing a file download with our Drive API client libraries.
file_id = '0BwwA4oUTeiV1UVNwOHItT0xfa2M'
request = drive_service.files().get_media(fileId=file_id)
fh = io.BytesIO()
downloader = MediaIoBaseDownload(fh, request)
done = False
while done is False:
status, done = downloader.next_chunk()
print "Download %d%%." % int(status.progress() * 100)
Here is a Python Quickstart - simple Python command-line application that makes requests to the Drive API.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With