We are using the Google Places API to add places and those should reflect in the Map loaded with the API key from the same console project. However, the added places do not reflect on the map, even after a long period of time.
https://developers.google.com/places/webservice/add-place
if somebody has used these APIs, please suggest some insight as to why this is happening. I had enabled the APis from the console project.
Thanks
Code is as follows:
function addPlaceToGoogle(data, callback) {
var request = require('request');
var requestUrl = 'https://maps.googleapis.com/maps/api/place/add/json?key=' + config.get("google_key");
var type = "store";
if (data.type) {
type = data.type;
}
var newData =
{
"location": {
"lat": data.latitude,
"lng": data.longitude
},
"accuracy": 50,
"name": data.address,
"address": data.address,
"types": [type]
};
var request = require('request');
var options = {
uri: requestUrl,
method: 'POST',
json: newData
};
request(options, function(error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body) // Print the shortened url.
if (body.status == 'OK') {
data.placeId = body.place_id;
} else {
data.placeId = "";
}
data.type = type;
callback(null, data);
}
});
}