google-mapsgoogle-apidirections

Google Direction APIs error: REQUEST_DENIED


We are developing and that needs the direction APIs to measure the distance between 2 addresses. The only option I have is http as this part of the app doesn't have a map.

I am trying to understand the proper usage of the direction APIs, related Keys and quota.

First we were issuing the http call without a key.

maps.googleapis.com/maps/api/directions/json?origin=43.65077%2C-79.378425&destination=43.63881%2C-79.42745

Sometimes we get back the proper response, but many times I get OVER_QUERY_LIMIT (even though we are hardly issuing any calls, it is impossible that we are triggering any limit)

Then after visiting this link: https://developers.google.com/maps/documentation/directions/usage-limits, we enabled the API key and added the key to the call. So the call now looks like this

http://maps.googleapis.com/maps/api/directions/json?origin=43.65077%2C-79.378425&destination=43.63881%2C-79.42745&key=AI***AQ

Every time, we issue the call, we get back REQUEST_DENIED


Solution

  • The error message I get with your request (including a valid key) is "Requests to this API must be over SSL. Load the API with https: instead of http:". You need to make the requests over https.

    https://maps.googleapis.com/maps/api/directions/json?origin=43.65077%2C-79.378425&destination=43.63881%2C-79.42745&key=VALID_API_KEY