Forum Discussion
Anonymous
5 years agoNot applicable
How to avoid HTTP 502/503 when accessing a REST API
We are reading data from a REST API. The process is fairly common: do one call to get a list of IDs, then do one or more calls for each ID to get the details. For a small data set, everything works...
- 5 years ago
Hi Anonymous
You can use Function.InvokeAfter to introduce a delay between requests. This code has a 2 second delay between web requests
let id_list = {1 .. 5}, GetWeb = (id) => Json.Document(Web.Contents("https://jsonplaceholder.typicode.com/todos/" & Text.From(id))), Output = List.Transform(id_list, each Function.InvokeAfter( ()=>GetWeb(_), #duration(0,0,0,2))) in Outputregards
Phil
If I answered your question please mark my post as the solution.
If my answer helped solve your problem, give it a kudos by clicking on the Thumbs Up.
PhilipTreacy
5 years agoSuper User
Hi Anonymous
You can use Function.InvokeAfter to introduce a delay between requests. This code has a 2 second delay between web requests
let
id_list = {1 .. 5},
GetWeb = (id) => Json.Document(Web.Contents("https://jsonplaceholder.typicode.com/todos/" & Text.From(id))),
Output = List.Transform(id_list, each Function.InvokeAfter( ()=>GetWeb(_), #duration(0,0,0,2)))
in
Output
regards
Phil
If I answered your question please mark my post as the solution.
If my answer helped solve your problem, give it a kudos by clicking on the Thumbs Up.
Anonymous
5 years agoNot applicable
Beautiful!