0

I am trying to integrate Google Maps Javascript API with my Rails Web Application running on locally on a VM. I can't get the Javascript code from the API. The sample I am following is this.

https://developers.google.com/maps/documentation/javascript/tutorial?csw=1

And the error I receive while trying to load the code is this.

GET https://maps.googleapis.com/maps/api/js?key=MY_KEY&callback=initMap net::ERR_NAME_NOT_RESOLVED

Note I am sending my actual key in the call to API. Already tried solution provided to this question

Google Maps v3 api for localhost not working

Cœur
  • 37,241
  • 25
  • 195
  • 267
Babar
  • 1,202
  • 1
  • 12
  • 21
  • Yes, I tried changing the URL before posting the question but nothing happened. :) thanks though – Babar Nov 27 '15 at 13:36
  • If you are running it in a VM perhaps the network settings are wrong. Are you able to resolve maps.googleapis.com at all from within the VM? – sourcx Nov 27 '15 at 13:45
  • 1
    @Frank I guess you are right, since my main machine is on VM with restricted access i can't do anything on the VM.... I will check when I get direct access to internet and post my findings here. I guess it was more of my stupidity then anything else :/ – Babar Nov 27 '15 at 14:13
  • Allright, not stupidity per se. You probably expected something else making you blind for the net::ERR_NAME_NOT_RESOLVED. Glad to help! – sourcx Nov 27 '15 at 14:30

1 Answers1

0

It is possible to create a Browser API Key for test purposes that only works only for your machines IP or localhost. However make sure you do not deploy that to production :)

Just go to google developer console and and add one. I believe you can also add one for something like: *localhost*. I've done that before for some of their other services.

It depends on if you are using Google Maps API for "work" or not. See these docs:

If you're switching from the free API services to a Maps API for Work implementation, you must remove the key parameter from your requests.

Link to above quote: See section on Client ID

Cliff Ribaudo
  • 8,932
  • 2
  • 55
  • 78