授权使用 goo.gl API 将 URL 添加到用户历史记录
随着 Google 几周前开放 goo.gl API,使用 POST 非常容易:
curl -F "url=LONGURL" http://goo.gl/api/shorten
响应如下:
{"short_url":"http://goo.gl/A9MR","added_to_history":false}
那么,有谁知道如何对 goo.gl API 执行授权 POST 以便缩短 URL是否会像使用浏览器一样添加到用户历史记录中? 我尝试使用我的 Google 邮件地址和密码提供基本的授权标头,但这不起作用。
With Google opening the goo.gl API a few weeks ago, it's quite easy to use it with POST:
curl -F "url=LONGURL" http://goo.gl/api/shorten
The response is like this:
{"short_url":"http://goo.gl/A9MR","added_to_history":false}
So, does anyone know how to perform an authorized POST to the goo.gl API so that the shortened URL is added to the users history as if you would use the browser?
I tried providing a basic Authorization header using my Google mail address and password, but that doesn't work.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它还不是真正的公共 API。您正在使用的内容是 goo.gl 网站本身使用的内容,但它并不是像您想要的那样设计供公共使用。不过,他们确实计划推出一个,当他们这样做时,我确信他们会将其添加为一种选项。
请参阅 这篇文章
编辑:现在可以使用 新推出的API。请参阅此处的文档。
It's not really a public API, yet. What you're using is what the goo.gl site uses itself, but it's not designed for public use like you're trying to do. They do plan on launching one though, and when they do I'm sure they'll add it as an option.
See this post
EDIT: This is now possible with the newly launched API. See the docs here.