Hi,
I’m using Power Query to get distance and travel time between data points. I’m now running into the issue of Error 429 being returned, which, if I’ve read correctly, is the error returned when too many requests/sec are made.
I’m unaware of any way of throttling Power Query (at this stage anyway) but, I need to ask if there is any way to workaround this error.
For those that may be interested, below is the M code for an API request to extract the travel time and distance.
let
Coordinates = (lat1 as text , long1 as text, lat2 as text, long2 as text) =>
let
Authkey = “Your API Key Here”,
url = “https://api.openrouteservice.org/v2/directions/driving-car/json”,
body = “{”“coordinates”":[[" & long1 &","& lat1 & “],[” & long2 &","& lat2 &"]}",Source = Json.Document(Web.Contents(url, [ Headers= [#"Authorization"= Authkey, #"Content-Type"="application/json; charset=utf-8", #"Accept"="application/json, application/geo+json, application/gpx+xml, img/png; charset=utf-8"], Content = Text.ToBinary( body)] ) ), routes = Source[routes], routes1 = routes{0}, summary = routes1[summary], #"Converted to Table" = Record.ToTable(summary), #"Pivoted Column" = Table.Pivot(#"Converted to Table", List.Distinct(#"Converted to Table"[Name]), "Name", "Value", List.Sum) in #"Pivoted Column" in Coordinates