Meteor HTTP post请求不适用于google add place api

Meteor HTTP post请求不适用于google add place api,http,meteor,google-maps-api-3,Http,Meteor,Google Maps Api 3,我正在使用HTTP post请求在meteor js中使用google api添加位置。我使用的代码是 var url=”https://maps.googleapis.com/maps/api/place/add/json?key=“+谷歌钥匙; Meteor.http.post(url, {params:{ “地点”:{ “lat”:-33.8669710, “液化天然气”:151.1958750 }, “准确度”:50, “名称”:“谷歌鞋!”, “电话号码”:(02)9374 4000,

我正在使用HTTP post请求在meteor js中使用google api添加位置。我使用的代码是

var url=”https://maps.googleapis.com/maps/api/place/add/json?key=“+谷歌钥匙;
Meteor.http.post(url,
{params:{
“地点”:{
“lat”:-33.8669710,
“液化天然气”:151.1958750
},
“准确度”:50,
“名称”:“谷歌鞋!”,
“电话号码”:(02)9374 4000,
“地址”:“2009年澳大利亚新南威尔士州皮尔蒙特皮尔拉马路48号”,
“类型”:[“鞋店”],
“网站”:http://www.google.com.au/",
“语言”:“en-AU”
}
},函数(错误,结果){
log(参数);
})
我犯了一个错误

{[错误:失败[400]{“状态”:“请求被拒绝”}]
我尝试过更改参数和google Key,但错误没有改变。有人能帮我将http post请求与google api一起使用吗?基于api文档的位置,提前感谢

“状态”:“请求被拒绝”由Google Places API Web服务在以下情况下返回:

  • 您尚未在Google开发者控制台中激活Google Places API Web服务
  • 您的请求中缺少关键参数
  • key参数与Google Developers控制台中的your API密钥不匹配
  • 您的API密钥未在Google Developers控制台中正确设置:
    • 如果您使用的是浏览器键,请检查允许的引用是否正确
    • 如果您使用的是服务器密钥,请检查允许的IP是否正确
    • 不支持Android和iOS密钥,请使用浏览器或服务器密钥
  • 请求未作为HTTPS请求发送,所有Google Places API Web服务请求都需要HTTPS
  • 发送请求时使用了不正确的HTTP方法:
    • 除Place Add外,所有请求都必须作为GET请求发送
    • 所有地点添加请求必须作为POST请求发送
您指定的请求主体看起来是完整的,如果缺少一些配置,您可以查看GoogleDeveloper控制台


希望这会有所帮助!

您是否尝试用
数据
代替
参数

Meteor.http.post(url,
    {data: {
          "location": {
            "lat": -33.8669710,
            "lng": 151.1958750
          },
          "accuracy": 50,
          "name": "Google Shoes!",
          "phone_number": "(02) 9374 4000",
          "address": "48 Pirrama Road, Pyrmont, NSW 2009, Australia",
          "types": ["shoe_store"],
          "website": "http://www.google.com.au/",
          "language": "en-AU"
        }
    },function(err, result){
        console.log(arguments);
    })

在我的远程服务器上运行良好,但在本地主机上,我有一个
无效的\u请求
响应,因为我认为是键。

使用npm的
请求
模块。我不认为Meteor.http有
https
post支持。@MariusDarila有没有办法在Meteor js中使用请求模块?您在Meteor 1.2中使用哪个Meteor版本@MariusDarila Meteor 1.2.1
request.postSync(uri,选项);
from将为您完成这项工作