2
我想使用谷歌的batchInsert地圖引擎API。我用dojo/request來調用它。什麼是缺少在此請求谷歌地圖引擎?
代碼來調用下面的批量插入:
request("https://www.googleapis.com/mapsengine/v1/tables/1453899488279955151311853667273131550346/features/batchInsert",
{
headers : {
"Authorization": 'Bearer '+ token.access_token,
"Access-Control-Allow-Origin" : null,
"X-Requested-With": null,
"Content-Type": "application/json"
},
handleAs : 'json',
method : 'POST',
data :datastring
}
).then(function(data){
console.log("Got data :"+data);
}, function(err){
console.log("Got error :"+err.response.text);
}, function(evt){
console.log("Got Event :"+evt);
});
請求如下
{
"features":[
{"type":"Feature",
"geomerty":
{
"type":"Point",
"coordinates":[-34.678393740116476,150.765380859375]
},
"properties":
{
"gx_id":"2",
"FID":2,
"sapobjectid":"12345sdf",
"sapobjectname":"Test",
"Features":"Point"}
}
]
}
但我得到的錯誤作爲
Got error :{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "A value is required.",
"locationType": "other",
"location": "features[0].geometry"
}
],
"code": 400,
"message": "A value is required."
}
}
請讓我知道什麼,我我錯過了。