Get shared link through Google Drive API


I am working on an app using Google Drive. I want the user to be able to share files by link, setting the permissions to anyone and withLink as described in the Google Developers documentation.

However, I cannot figure out what link to share. When I share a file in the Google Drive browser interface, I see the Link to share in the format:[…]/edit?usp=sharing

A link in this format is not part of the file resource object, nor it is returned from the http call setting the permissions. I hope someone can explain to me how to get this link through the REST api?

Best Solution

You can use the alternateLink property in the File resource to get a link that can be shared for opening the file in the relevant Google editor or viewer:


[With API V3]( it is suggested to use the webViewLink property.

Related Question