Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Landcrab
Helper I
Helper I

Is it possible to limit number of calls to API per minute?

Hi there,

 

Is there any way to restrict Power BI/ Power Query to respect a limit of 60 API calls per minute when loading data?

 

In Power BI Desktop using OData connector, I get a 503 Service Unavailable error because Power BI/ Power Query fires off too many API requests at the same time. The data I am attempting to load consists of less than 100 sales transactions, so no real volume to speak of.

 

Although its a server (5xx error), the SaaS application provide says in needs to be handled in Power BI to restrict the number of calls to the API, haven't found any want to configure that in Power BI so far 😞

 

Any suggestions would be much appreciated.

 

1 ACCEPTED SOLUTION
PhilipTreacy
Super User
Super User

Hi @Landcrab 

Yes you can use Function.InvokeAfter.

This code has a 2 second delay between web requests.  Modify as needed,or post your query here for help.

You can try reducing the delay to 1 second but I'm not sure if the timing within PQ/PBI would be accurate.

 

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

 

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.



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

2 REPLIES 2
PhilipTreacy
Super User
Super User

Hi @Landcrab 

Yes you can use Function.InvokeAfter.

This code has a 2 second delay between web requests.  Modify as needed,or post your query here for help.

You can try reducing the delay to 1 second but I'm not sure if the timing within PQ/PBI would be accurate.

 

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

 

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.



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Thank you @PhilipTreacy thats the sort of thing I was after.

For anyone else looking for a simple example of this check out Chris Webb's blog post > https://blog.crossjoin.co.uk/2015/04/30/using-function-invokeafter-in-power-query/

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors