Forum Discussion
Bad request 400 when doing more than 4 API calls
I have this supplier of call data (Dstny) and have come to a sort of deadend on how to move further here, so hope someone in here know a reason or work around.
I have 4 API calls:
- Queues
- Groups
- Users
- Calls
It works like a charm, but here is the issue. Calls have data that I need to seperate into its own table, because it multiplies the call lines ( it tracks who responded the call and was redirected to etc. so a one to many table).
Normally I would dublicate / reference the table - in this instance the call table, to create a table that gives me this one to many realationship. But it is here the trouble start. Whenever I dublicate that table or the user or group table it returns a error 400:
DataSource.Error: Web.Contents kunne ikke hente indhold fra 'https://statistics.connect.dstny.dk/api/report/v1-1/generate' (400): Bad Request
Detaljer:
DataSourceKind=Web
DataSourcePath=https://statistics.connect.dstny.dk/api/report/v1-1/generate
Url=https://statistics.connect.dstny.dk/api/report/v1-1/generate
That request only appears when I duplicate / reference the table. I have contacted Dstny support and they say the limit is on Power BI, but from what I read there is a limit in PBI for 120 API calls per minut, so that is not it imho. They also say that another issue might be that PBI creates all the API in one single batch and they only allow for 6 calls within 20 seconds. But that does not sound correct since I create 4 API calls with a secret request and then the data request. That sums in my head to either 4 calls, so below limit, or 8 calls (secret + data), 2 above limit.
I have tried to add a delay, but it seems as PBI don't care. It asks for the connection and then create the delay.
Anyways, I don't know what to do. Does anyone have experienced something similar and a work around? Just for the record, I have many other data suppliers where it works.
Hi Bokazoit,
Power Query runs duplicated or referenced queries separately, often at the same time, which means the same Web.Contents call can be executed multiple times and may exceed the API’s short-window limit. To prevent this, call the API once in a single staging query, store or buffer the result, and use that in-memory result to build all downstream tables. Avoid duplicating queries with Web.Contents, as each duplicate will make a new API call.
Why does my query run multiple times - Power Query | Microsoft Learn
Chris Webb's BI Blog: Why Does Power BI Query My Data Source More Than Once?
Web.Contents - PowerQuery M | Microsoft Learn
Thank you.
2 Replies
- v-saisrao-msftCommunity Support
Hi Bokazoit,
Power Query runs duplicated or referenced queries separately, often at the same time, which means the same Web.Contents call can be executed multiple times and may exceed the API’s short-window limit. To prevent this, call the API once in a single staging query, store or buffer the result, and use that in-memory result to build all downstream tables. Avoid duplicating queries with Web.Contents, as each duplicate will make a new API call.
Why does my query run multiple times - Power Query | Microsoft Learn
Chris Webb's BI Blog: Why Does Power BI Query My Data Source More Than Once?
Web.Contents - PowerQuery M | Microsoft Learn
Thank you.
- v-saisrao-msftCommunity Support
Hi Bokazoit,
Have you had a chance to review the solution we shared earlier? If the issue persists, feel free to reply so we can help further.
Thank you.