What are the reasons "The Google Maps API Server rejected your request. An internal error was found for this API project."?

It uses the static map API.

I have a webpage with 3 img tags, each of which is a call to the static maps API (NB, of course, this is not a real API key).

These 3 tags are identical, except for the magnification, which is 10, 13 and 16 for three images.

The API key is taken from a project in which the static map API is enabled, billing is configured and enabled.

I sent about 60 requests (this is a completely new development project, so I'm just getting started).

What I see is that sometimes all three cards are displayed. In other cases, one (random out of three) card fails with

403 "The Google Maps API server rejected your request. An internal error was detected for this API project."

Therefore, if I refresh the page 5 times, that is 15 requests, I will get about 4 failures and 11 successes.

So why does Google Maps accidentally reject some requests with this 403?

+12
google-maps google-maps-api-3
source share
2 answers

Are you sure your API key is correct?

From https://developers.google.com/maps/documentation/staticmaps/#Limits :

The Google Static Maps API has the following usage limits:

  • Keyless API:

    1000 requests of static cards for each IP address in a 24-hour period. 50 requests for static cards per IP address per minute. This means that if you have one page containing more than 50 maps, the page will exceed this limit.

Additional image requests can be acquired based on each application at the rate indicated in the FAQ. An additional quota is purchased through the API console and requires the use of an API key.

If the user exceeds these limits, the server will return an HTTP 403 status and display the image below to indicate that the quota has been exceeded:

403 screenshot

It seems that 50 cards per minute can explain your random 403 errors.

If this is not a problem, I would apply for support for Google Geo support, as it is indicated as an "internal error."

0
source share

So, if I refresh the page 5 times, i.e. 15 requests, I get about 4 failures and 11 successes.

I think your requests will exceed the limit in a short time. I'm not sure how you show the map, but I recommend that you download the map sequentially.

Example: using JavaScript with https://github.com/caolan/async

<!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> <style type="text/css"> html,body { height: 100%; margin: 0; padding: 0 } </style> <script type="text/javascript" src="async.js"></script> <script type="text/javascript"> function loadImg(params, callback) { var url = "http://maps.googleapis.com/maps/api/staticmap?" + params + "&zoom=1&size=100x100" + "&sensor=false&key={YOUR_KEY_IS_HERE}"; var img = new Image(); img.src = url; img.onload = function() { document.body.appendChild(img); callback(); }; img.onerror = function() { callback(url); } } function loadMaps() { var urlList = [ "markers=label:0|LosAngles", "markers=label:1|NewYork", "markers=label:2|SanFrancisco", "markers=label:3|Frorida", "markers=label:4|Arizona", "markers=label:5|Ohaio", "markers=label:6|Hawai", "markers=label:7|Texus", "markers=label:8|Seattle", "markers=label:9|Florida", "markers=label:A|kansas", "markers=label:B|utah", "markers=label:C|iowa", "markers=label:D|oregon", "markers=label:E|alaska", "markers=label:F|Washington DC" ]; async.eachSeries(urlList, loadImg, function(err) { if (err) { console.log("error", err); } else { console.log("all image are loaded"); } }); } </script> </head> <body onload="loadMaps()"> </body> </html> 

enter image description here

-one
source share

All Articles