【发布时间】:2017-01-26 08:59:12
【问题描述】:
我对 Google API 真的很陌生,所以请耐心等待。我正在尝试从我的博客中获取帖子。博客设置为私人。
问题出在这里:
{
"error": {
"errors": [
{
"domain": "usageLimits",
"reason": "ipRefererBlocked",
"message": "The calling IP address x does not match the IP restrictions configured on the API key. Please use the API Console to update your key restrictions.",
"extendedHelp": "https://console.developers.google.com/apis/credentials?project=x"
}
],
"code": 403,
"message": "The calling IP address x does not match the IP restrictions configured on the API key. Please use the API Console to update your key restrictions."
}
}
我有一个 Google 帐户,其中有博客、Google API 控制台中的项目和它的 API 密钥。我尝试将 API 密钥限制更改为 HTTP,但出现同样的问题,您的错误消息略有不同。
抓取工作如下:
var apikey = "x";
var blogId = "x";
$(function(){
$.ajax({
type: "GET",
url:"https://www.googleapis.com/blogger/v3/blogs/"+blogId+"/posts?key="+apikey,
dataType: "json",
success: function(data) {
console.log(data);
}
});
});
我仔细检查了所有变量,它们都是正确的。 API 密钥是正确的,BlogId 也是如此。
用这个炖控制台给我 403 错误。我希望我说得足够清楚。找到答案后我会修复这篇文章:)
【问题讨论】:
标签: api google-api blogger