Google API - DocumentList - 创建共享链接
使用文档列表 API v3.0,我已经创建了一个文档。但现在我想使用共享链接私下共享它。
协议指南表明我应该构建一个像这样的 POST 请求:
POST /feeds/default/private/full/<resource_id>/acl
GData-Version: 3.0
Authorization: OAuth <access_token>
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:gAcl='http://schemas.google.com/acl/2007'>
<category scheme='http://schemas.google.com/g/2005#kind'
term='http://schemas.google.com/acl/2007#accessRule'/>
<gAcl:role value='writer'/>
<gAcl:scope type='user' value='[email protected]'/>
</entry>
但我的范围有问题。指南列出了其中 4 个:
- user — 用户的电子邮件地址。 =>我想要一个链接,我什至不知道在流程结束时访问该文档的人的电子邮件地址。
- 群组 — Google 群组电子邮件地址。 =>我没有使用组。
- 域 — Google Apps 域。 =>我没有使用任何域。
- 默认 — 与所有用户公开共享。 =>我不希望该文件被公开。
那么我应该使用什么范围才能通过共享链接访问私人文档?
Using the Document List API v3.0, I'm already creating a document. But now I want to share it privately using a shared link.
The protocol guide indicate that I should build a POST request like this one:
POST /feeds/default/private/full/<resource_id>/acl
GData-Version: 3.0
Authorization: OAuth <access_token>
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:gAcl='http://schemas.google.com/acl/2007'>
<category scheme='http://schemas.google.com/g/2005#kind'
term='http://schemas.google.com/acl/2007#accessRule'/>
<gAcl:role value='writer'/>
<gAcl:scope type='user' value='[email protected]'/>
</entry>
But I have a problem with the Scope. The guide list 4 of them:
- user — a user's email address. => I want a link, I don't even know the email address of the person who'll access the document at the end of the process.
- group — a Google Group email address. => I use no group.
- domain — a Google Apps domain. => I use no domain.
- default — publicly shared with all users. => I don't want the document to be public.
So what scope should I use to have a private document accessible with a sharing link ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
据我所知,我需要使用默认范围,然后将角色限制为特定键。
Google API 文档根本没有解释应该放在关键属性中。但好消息是,我只是输入了一个随机字符串,并且该文件似乎可以通过共享链接访问,而无需全体公众访问。
现在可以通过以下 URL 访问该文档:
对于记录,如果我想让公众可以访问该文档(引用等),我只需删除 withKey 部分即可:
From what I've understood yet, I need to use the default scope, and then restrict the role to a specific key.
The Google API Documentation doesn't explain at all what's supposed to go in the key attribute. But the good news is that I just put a random string and the file apear to be accessible with the shared link, without beeing accessible to the whole public.
The document is now accessible with the following URL:
For the reccord, if I wanted to have the document accessible to the public ( referenced, etc. ) I would simply remove the withKey Part: