0

I am using both road api and map api. But I can't get apikey for road api work, in comparison, the apikey for map works fine.

Here is my apikey for road:

AIzaSyDRknPaFTzqrmHCTyQ6QGcrQMjGFQtK7bg

and request:

https://roads.googleapis.com/v1/nearestRoads?points=30.2601,-97.7095|\30.2341,-97.7229&%E2%80%8C%E2%80%8Bkey=AIzaSyDRknPaFTzqrmHCTyQ6QGcrQMjGFQtK7bg

The error is 403 permission denied.

Through the google's api console, that is showing that the above apikey should be working for road apis.

Thanks in advance.

user1470393
  • 317
  • 4
  • 12
  • 1
    This URL works for me (you have weird characters in your URL): https://roads.googleapis.com/v1/nearestRoads?points=30.2601,-97.7095|30.2341,-97.7229&key=AIzaSyDRknPaFTzqrmHCTyQ6QGcrQMjGFQtK7bg – geocodezip Apr 27 '17 at 14:25
  • I used the url in your comment that also worked for me. Then I was trying to find out what is wrong with my original url. 1. After I deleted the wield charater "\", it still doesn't work. 2. Then i located to the word "&key" as the problem. 3. I was then trying to see if it is "&", or "key" that caused the problem by copying those 2 strings separately to my original url (after deleting "\"). Neither of those worked, but if I copied "&key", it always works repeatedly. Still confused, but you did solve my problem. :-) – user1470393 Apr 27 '17 at 14:48
  • It is the weird character encoding of the `&` before key. – geocodezip Apr 27 '17 at 14:54

2 Answers2

0

This is an error for an unregistered request that was blocked. Are you signed up and logged in using Google Developers Console? Also check that Your API key is valid and that you've enabled the API for this key.

carnophage
  • 23
  • 3
0

Remove the weird character encoding of the & before key (and the extraneous \ before 30):

https://roads.googleapis.com/v1/nearestRoads?points=30.2601,-97.7095|30.2341,-97.7229&key=AIzaSyDRknPaFTzqrmHCTyQ6QGcrQMjGFQtK7bg

Works for me.

BTW - change the permissions on your key so it isn't usable by anyone (which means the URL above should stop working).

geocodezip
  • 158,664
  • 13
  • 220
  • 245