Question

I want to use the batchInsert of Google map engine API. I am calling this with dojo/request.

Code to call the batch insert as below:

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);
                });

Request as below

{
"features":[
{"type":"Feature",
"geomerty":
{
"type":"Point",
"coordinates":[-34.678393740116476,150.765380859375]
},
"properties":
{
"gx_id":"2",
"FID":2,
"sapobjectid":"12345sdf",
"sapobjectname":"Test",
"Features":"Point"}
}
]
} 

But I am getting the error as

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

Please let me know what I am missing.

Was it helpful?

Solution

I think it's a syntax problem: "geomerty".

Try the request again using "geometry" instead.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top