Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/api/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
谷歌博客API:安全获取博客帖子_Api_Google Api_Blogger - Fatal编程技术网

谷歌博客API:安全获取博客帖子

谷歌博客API:安全获取博客帖子,api,google-api,blogger,Api,Google Api,Blogger,我对谷歌API真的很陌生,所以请容忍我。我正在尝试从我的博客中获取帖子。博客设置为私有 问题在于: { "error": { "errors": [ { "domain": "usageLimits", "reason": "ipRefererBlocked", "message": "The calling IP address x does not match the IP restrictions configured on the API key. P

我对谷歌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."
 }
}
我有一个谷歌帐户,我有博客,谷歌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密钥用于访问公共数据。公共数据是不属于用户个人的数据。例如,上传到YouTube的视频是公开的

您的博客数据是私人用户数据。您需要使用Oauth2来访问它。一旦使用oauth2进行了身份验证,就需要使用access_token={tokenfrom auth}而不是使用Key


我不知道为什么IP地址不起作用,我以前并没有为此烦恼过

好吧,我不知道!谢谢你!我应该如何进行?我试图弄清楚如何使用Oauth2.0访问Google Blogger API,但我被卡住了。我不知道我该怎么办。我一直在阅读文档,它对我没有帮助。我不是一个ajax开发人员,所以我帮不了什么忙。这可能有助于你将不得不改变它使用blogger一旦你得到它的工作与人。javascript是我能找到的最接近的。一旦你有了某种工作岗位,你的代码就会出现在一个新问题下。