无法从公共Google日历api v3获取活动

时间:2014-12-13 12:15:00

标签: android google-api google-calendar-api

按照本教程http://www.androidhive.info/2012/01/android-json-parsing-tutorial,我已将其改编为使用此网址“https://www.googleapis.com/calendar/v3/calendars/[calendar_ID]/events?singleEvents=true&orderBy=startTime&key=[my_API_key]”解析公共Google日历,而不是示例中的网址。这个日历是公开的。

当我执行应用程序时,响应如下:

{
 "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."
 }
}

问题出在哪里?我做错了什么?

1 个答案:

答案 0 :(得分:1)

最后我找到了解决方案。

在此网址https://www.googleapis.com/calendar/v3/calendars/[calendar_ID]/events?singleEvents=true&orderBy=startTime&key=[my_API_key]中,我使用的是Android应用的API密钥。当我为浏览器的API密钥更改此密钥时,问题就消失了。