Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
I have made an model where there is data retrieved with an API. The API is called multiple times, and it's done with the following code in the advanced editor:
response = try Web.Contents("[API LInk]", [Headers=headers, RelativePath = SiteID Query = [group_id = GroupID,page_size = "1000", period = DateText]]) otherwise null,
I can refresh the data in Power BI Desktop, but when I try this in on app.powerbi.com I get the following error: Expression.Error: Failed to retrieve data from API. . The exception was raised by the IDbCommand interface.
How can I fix this error?
Thanks in advance!
Hi, @Anonymous
First of all, make sure that the authentication method used in Power BI service is consistent with that used in Power BI Desktop. Check if Api has a rate limit or timeout setting. Power BI service is likely to trigger these restrictions more often than Power BI desktop. You can also use tools like Postman to independently test the Api call. This helps to verify whether the problem is with Api itself or the way Power BI service handled the request.
You can also refer to the following links:
Troubleshoot Power BI REST APIs - Power BI | Microsoft Learn
How to Get Your Question Answered Quickly
Best Regards
Yongkang Hua
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
The most tricky part to call API from Service is to define the [RelativePath]-part and then the [Query]-part.
Do you have the correct split (into base-url, RelativePath, Query) of your url you'd like to call?
Regards
Hi anneke
API refreshes in the Service is a tricky topic indeed.
Without understanding your error fully, I have a hunch it is related to the engine not being able to return a static result from your base URL.
Chris Webb has some excellent resources on the topics:
Perhaps trying one his tricks mught do it for you!
_____________________________________________________
I hope my comment was helpful.
If your question was answered, please mark your post as 'Solved' and consider giving me a 'Thumbs Up'.
Find me on LinkedIn, Sessionize, or my blog Downhill Data
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.