通过Google Drive API获取共享链接 [英] Get shared link through Google Drive API

查看:340
本文介绍了通过Google Drive API获取共享链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Google云端硬盘开发应用。我希望用户能够通过链接共享文件,将权限设置为任何人 withLink ,如 Google Developers文档



然而,我无法弄清楚要分享什么链接。当我在Google Drive浏览器界面中共享文件时,我会看到 Link以格式共享

https://docs.google.com/presentation/d /[...]/edit?usp=sharing



这种格式的链接不是文件资源对象的一部分,也不是从http调用设置权限。我希望有人能向我解释如何通过REST api获得这个链接?

您可以使用 alternateLink 属性以获取可在相关Google编辑器或查看器中打开文件的共享链接。



https://developers.google.com/drive/v2/reference/files

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:

https://docs.google.com/presentation/d/[...]/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?

解决方案

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:

https://developers.google.com/drive/v2/reference/files

这篇关于通过Google Drive API获取共享链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆