Search code examples
urldownloadgoogle-drive-api

Google Drive File Download URL


Is the only way to download a file through Google Drive through the download_url that is provided? I have the file_id and would like to make one simple call to download the file. Right now it looks like you have to make one call to fetch the file metadata and retrieve the download_url, then another to actually download the file. Is this the only way?

Also, the download_url is described as a "short lived url". How long will this url be available for?

Thanks


Solution

  • Using the download_url is the correct way to download a file from Drive. I'd strongly advise against trying to build the download urls yourself as the resulting code will be likely to break.

    A download_url is usually available for hours, but instead of relying on that you should always retrieve the updated file before downloading a file from Drive. More information at this other question: How long does the Google Drive SDK "short lived" download URL exist for?