我在cpp项目中使用或使用curl命令时出现Google Place API错误

时间:2014-05-13 19:32:55

标签: google-places-api

最近我开始使用Google Place API。我为我当前的项目创建了一个服务器密钥。因为我必须使用Place API,所以我在服务页面中打开它。

当我在浏览器中使用以下URL时,我会在浏览器中获得所需的输出。

https://maps.googleapis.com/maps/api/place/textsearch/json?query=restaurants+in+Sydney&sensor=true&key=MY_API_KEY

但是如果我在当前的C ++项目中使用上面的URL或者在ubuntu终端上使用curl命令,我会收到以下错误。

{
   "error_message" : "An internal error was found for this API project.",
   "html_attributions" : [],
   "results" : [],
   "status" : "REQUEST_DENIED"
}

我该怎么做才能纠正这种行为?

1 个答案:

答案 0 :(得分:0)

如果您使用了uri

https://maps.googleapis.com/maps/api/place/textsearch/json?query=restaurants+in+Sydney&sensor=true&key=MY_API_KEY

您向Google发送请求,使用密钥记录该帐户' MY_API_KEY'

我想您需要注册key并将其用作参数值