I’m using Google Drive with REST calls. I want to upload any kind of file to client’s drive. I use two links from google drive in my web application, the “visualization” and “download” links.
I get download link from “webContentLink” json property, and visualization link from “alternateLink”.
Some files like spreadsheets, documents and plain text must be converted, so I set the “convert” parameter to “true”.
The problem
with the file sent is converted to another google docs type, the json returned doesn’t have the “webContentLink” property! How can I have both links download and visualization when I’m working with converted document files?
EDITED
I’m looking for the download link for the original file uploaded before it’s converted. If I upload an xls for example, I would like to have a download link for the original xls file.
With “exportLinks” list, I have a bunch of links for xlsx, but I have no way to get “the right one”, the mime types in “exportLinks” are different from the original file mimeType. And for some files, one of the two spreadsheet exportLinks given is broken…
If you want download links for google native documents, you have to fetch the
exportLinksproperties of the JSON returned.You will have several of them, depending on the format of the file. One at least is common to all native format, the one with
"application/pdf"mime type.