Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
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, @anneke
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
User | Count |
---|---|
47 | |
31 | |
28 | |
27 | |
26 |
User | Count |
---|---|
58 | |
55 | |
36 | |
33 | |
28 |