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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
hnguyen76
Resolver II
Resolver II

Dataset refresh with Web API

Hi All,

I have a simple report that utilizes an internal API to retrieve exchange rates. Everything works but when I attempt to refresh via the service I'm receiving this error:

ExchangeRate_WebContent.png

My query works fine when refreshing it via the desktop application but it will need to be able to be successfully refreshed on the service in the future. Here is my current query for it:
exchange_query.png

Inside the query I have two parameters: StartMe and EndMe which really returns me a string to capture my dates

 

let
    StartMe = 
    let
        StartofMonth = Date.StartOfMonth(DateTime.LocalNow()),
        StartDate = Date.AddMonths(StartofMonth, -4),
        StartValue = Text.From(Date.Month(StartDate)) & "%2F" & Text.From(Date.Day(StartDate)) & "%2F" & Text.From(Date.Year(StartDate))
    in
        StartValue
in
    StartMe

 

Any help on the matter would be greatly appreciated! Thanks!

3 REPLIES 3
blopez11
Super User
Super User

Try setting the first parameter to Web.Contents to "https://apigateway.myinternal.com", then use the Web.Contents RelativePath option to add "currencyexchange/exchangerate", then use the Web.Contents option Query to add all of the parameters


The Power BI service does not like the url parameter to Web.Contents to be dynamic

 

Please see https://docs.microsoft.com/en-us/powerquery-m/web-contents , http://blog.datainspirations.com/2018/02/17/dynamic-web-contents-and-power-bi-refresh-errors/ and https://blog.crossjoin.co.uk/2016/08/16/using-the-relativepath-and-query-options-with-web-contents-i...

Thanks guys! I'll try the method from Chriss Webb's post and see if I can accomplish this!

GilbertQ
Super User
Super User

Hi there

Currently the Web.Contents is not supported when using it natively in the Power BI Service.

As far as I know you will have to create a data source in the Power BI Gateway to allow it to refresh successfully.




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







Power BI Blog

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.