调用blogger API时访问未配置错误

时间:2021-10-16 07:29:45

I am trying to fetch a blog details using jQuery and JSON. I have also set up an API key (for browser application)to access the blog but my API key is not working properly.Please suggest how to configure it properly.

我正在尝试使用jQuery和JSON获取博客详细信息。我还设置了一个API密钥(用于浏览器应用程序)来访问博客,但我的API密钥无法正常工作。请建议如何正确配置它。

Code:

<!Doctype html>
        <html>
        <head>
        <title>My Page</title> 

            <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>

        </head>
        <body>
        <script>

        var url =  'https://www.googleapis.com/blogger/v2/blogs/',
            apikey = '/posts?key=API_KEY',
            blogId = '4011997376355783864';


            $.ajax({

                url: url +blogId+apikey,

                dataType: "jsonp",

                success  : function(data){

                    console.log(data);
                },
                error   :function(request, error){
                    alert('error');
                }

            });


        </script>
        </body>
        </html>

Error :

error: Objectcode: 403
errors: Array[1]
message: "Access Not Configured. Please use Google Developers Console to activate the API for your project."

Key details :

关键细节:

调用blogger API时访问未配置错误

1 个解决方案

#1


0  

I am developing an Android application that I want to connect with some Blogger' blogs and of course, I needed access to Blogger API v3. I had the same error in the request:

我正在开发一个Android应用程序,我想与一些Blogger的博客连接,当然,我需要访问Blogger API v3。我在请求中遇到了同样的错误:

{
 "error": {
  "errors": [
   {
    "domain": "usageLimits",
    "reason": "accessNotConfigured",
    "message": "Access Not Configured. The API is not enabled for your project, or there is a per-IP or per-Referer restriction configured on your API key and the request does not match these restrictions. Please use the Google Developers Console to update your configuration.",
    "extendedHelp": "https://console.developers.google.com"
   }
  ],
  "code": 403,
  "message": "Access Not Configured. The API is not enabled for your project, or there is a per-IP or per-Referer restriction configured on your API key and the request does not match these restrictions. Please use the Google Developers Console to update your configuration."
 }
}

I had created an API Key for the application (Android key) and I think that I was doing in the right way but that errors pushed me every time I tried until I created another API Key type (server key or browser key) and magic happened.

我已经为应用程序创建了一个API密钥(Android密钥),我认为我正在以正确的方式进行操作但每次尝试时都会出现错误,直到我创建了另一个API密钥类型(服务器密钥或浏览器密钥)并且发生了魔法。

I did not understand the logic until now but I seriously think that things like that can be described in the official docs.

直到现在我才明白逻辑,但我认真地认为这样的事情可以在官方文档中描述。

#1


0  

I am developing an Android application that I want to connect with some Blogger' blogs and of course, I needed access to Blogger API v3. I had the same error in the request:

我正在开发一个Android应用程序,我想与一些Blogger的博客连接,当然,我需要访问Blogger API v3。我在请求中遇到了同样的错误:

{
 "error": {
  "errors": [
   {
    "domain": "usageLimits",
    "reason": "accessNotConfigured",
    "message": "Access Not Configured. The API is not enabled for your project, or there is a per-IP or per-Referer restriction configured on your API key and the request does not match these restrictions. Please use the Google Developers Console to update your configuration.",
    "extendedHelp": "https://console.developers.google.com"
   }
  ],
  "code": 403,
  "message": "Access Not Configured. The API is not enabled for your project, or there is a per-IP or per-Referer restriction configured on your API key and the request does not match these restrictions. Please use the Google Developers Console to update your configuration."
 }
}

I had created an API Key for the application (Android key) and I think that I was doing in the right way but that errors pushed me every time I tried until I created another API Key type (server key or browser key) and magic happened.

我已经为应用程序创建了一个API密钥(Android密钥),我认为我正在以正确的方式进行操作但每次尝试时都会出现错误,直到我创建了另一个API密钥类型(服务器密钥或浏览器密钥)并且发生了魔法。

I did not understand the logic until now but I seriously think that things like that can be described in the official docs.

直到现在我才明白逻辑,但我认真地认为这样的事情可以在官方文档中描述。