Google Direction APIs error: REQUEST_DENIED
Asked Answered
T

3

0

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

Thacker answered 14/10, 2017 at 18:57 Comment(3)
Why do you say "The only option I have is http as this part of the app doesn't have a map"? 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.Niphablepsia
Can you confirm that Directions API is enabled in your project? Did you apply any restriction on the API key?Bluebeard
The issue was the fact that I was still using http after I added the key. Switching to https solved the problem for meThacker
N
0

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
Niphablepsia answered 14/10, 2017 at 22:37 Comment(0)
I
5

Ensure you have enabled the following APIs

  • Directions API
  • Distance Matrix API
  • Geocoding API
  • Geolocation API
  • Places API

In case its for Android, also enable the following

  • Maps SDK for Android
Incunabula answered 28/6, 2020 at 20:16 Comment(0)
M
1

To resolve this issue use the https:// instead of http:// in your base url. I have been testing some items and got the same error message. Once I changed it to https:// I was able to make the call.

Hope this helps anyone else with this issue.

Madras answered 23/1, 2021 at 14:49 Comment(0)
N
0

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
Niphablepsia answered 14/10, 2017 at 22:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.