How to avoid getting a 429 error after several calls, eg using SpatialDataService.GeoDataAPIManager.getBoundary?

Jonathan 0 Reputation points
2023-03-08T11:00:28.3066667+00:00

Hi, I'm trying to get several boundaries using the Bingmaps "Microsoft.Maps.SpatialDataService.GeoDataAPIManager.getBoundary" method. Something like 30/40 calls at the start when you get into the web page. I managed to convert those asynchronous calls into synchronous ones to split the number of calls. It works most of the time but sometimes, it raises a 429 GET error even at the first call that only gets boundaries of one country. When the page is right loaded then, I use layers and don't need to make those 30/40 calls again. I'm currently thinking that saving those results would be a possible solution. Is there a way to save those getboundaries results and load them at the start or any other solution?

Azure Maps
Azure Maps
An Azure service that provides geospatial APIs to add maps, spatial analytics, and mobility solutions to apps.
587 questions
{count} votes

1 answer

Sort by: Most helpful
  1. rbrundritt 15,211 Reputation points Microsoft Employee
    2023-03-08T15:40:28.26+00:00

    A 429 error is related to rate limiting/throttling (queries per second/QPS). It looks like you are using Bing maps, not Azure Maps so the limits work a bit differently. In Bing Maps, all non-production keys are throttled at around 5 QPS, and the default for production keys is around 50 QPS. If using a production key (e.g. are paying for the service) you can contact the Bing Maps Enterprise Support team (https://www.microsoft.com/en-us/maps/support) and request the limit be raised on your account.

    2 people found this answer helpful.