我已注册并完成了电子邮件验证.然后,我尝试使用最多的baisc API来缩短测试链接.以下是我的HTTP数据包. POST /v4/shorten HTTP/1.1Host: api-ssl.bitly.comContent-Type: application/jsonAuthorization: Bearer my-ge
POST /v4/shorten HTTP/1.1
Host: api-ssl.bitly.com
Content-Type: application/json
Authorization: Bearer my-generic-access-token
Cache-Control: no-cache
{
"group_guid": "shorten_link_testing",
"domain": "mytesting.site.com",
"long_url": "http://mytesting.site.com/"
}
以下是bit.ly的返回:
{
"message": "FORBIDDEN",
"resource": "bitlinks",
"description": "You are currently forbidden to access this resource."
}
我正在使用Postman进行测试,所以我很确定这不是我的代码问题.消息格式符合bit.ly文档中的格式,因此至少连接是成功的.据我所知,bit.ly应该为每个帐户每月提供10,000个免费缩短链接配额,对吧?我错过了什么,以至于我被禁止使用缩短链接服务?
group_guid param需要引用与您的bitly帐户关联的组的ID.使用您的通用访问令牌命中此api端点,以获取与您的帐户相关联的组/ guid列表:获得 https://api-ssl.bitly.com/v4/groups.
显然,域参数是可选的,因为您的帐户可能有一个与之关联的默认域.完全删除域名参数后,它对我有用.
https://groups.google.com/forum/#!topic/bitly-api/9RywN3ETLkg
希望这可以帮助!!
