MikeLim
MikeLim

Reputation: 1219

Change alternateLink(/edit) to embedLink(/preview)

As per https://developers.google.com/drive/v2/reference/files (files), I hope to use embedLink to display a file in web page via IFrame.

embedLink seems to be only available for certain file types, primarily Google Docs format and video; and is of format https://docs.google.com/document/d/1EmwDVqmUBAYcjz/preview

alternateLink is always available and is of format https://docs.google.com/document/d/1EmwDVqmUBAYcjz/edit

Since embedLink value is not always available, can I replace /edit with /preview and use it?

Upvotes: 0

Views: 679

Answers (1)

Claudio Cherubino
Claudio Cherubino

Reputation: 15014

You can use the alternateLink when you want to open the file in the appropriate Google viewer. However, it is strongly recommended not to manually construct the URLs.

Instead, you should always retrieve the file metadata and then use the value of the specific field you need. The URL format is not guaranteed, so if you try to guess those links your application may break any time.

Upvotes: 1

Related Questions