本文介绍了Google自定义搜索API返回未配置访问权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在通过URL调用API:

We are calling API by url:

https://www.googleapis.com/customsearch/v1?key = MY_KEY& cx = CUSTOM_SEARCH_ID& q = flower

在响应中出现错误:

"error": {
  "errors": [
   {
    "domain": "usageLimits",
    "reason": "accessNotConfigured",
    "message": "Access Not Configured. Please use Google Developers Console to activate the API for your project."
   }
  ],
  "code": 403,
  "message": "Access Not Configured. Please use Google Developers Console to activate the API for your project."
}

我们已启用自定义搜索API和Google + API.仍然超过错误.我们是否还需要启用其他一些API?

WE have enabled Custom Search API and Google + API. Still getting above error. Should we needto enable some other API too?

请帮助.

推荐答案

(我在这里重复我给你的答案).

(I'm repeating here the answer I gave you here).

不,我相信自定义搜索API是唯一需要启用的API.

No, I believe that custom search API is the only API that you need to enable.

因此,我将考虑您是否具有正确的密钥和CSE ID.

So, I would consider whether you have the right key and CSE ID.

要验证您的CSE ID,请从此处进行测试查询(填写): https://console.developers. google.com/project/PROJECT_ID/apiui/api/customsearch/method/search.cse.list

To verify your CSE ID, do a test query from here (fill in ):https://console.developers.google.com/project/PROJECT_ID/apiui/api/customsearch/method/search.cse.list

如果您的查询在此起作用,但仍无法在您的代码中起作用,那么问题可能出在您的钥匙上.如果您只是在执行一个简单的URL请求(如您在Q中所示),那么我希望您正在使用服务器密钥.而且,当然,您使用的密钥必须来自启用了CSE API的同一项目.

If your query works there, but still doesn't work in your code, then perhaps the issue is your key. If you are just doing a simple URL request (as you show in your Q), then I would expect you are using a server key. And, of course, the key you are using must be from the same project where you have enabled the CSE API.

这篇关于Google自定义搜索API返回未配置访问权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 10:43
查看更多