Search code examples
powerbipowerquerypowerbi-datasource

Power BI Web Source Wont Update through Gateway


I have an API source I am using on a report. It works fine on my Desktop, and I added the URL and Basic Login credentials to my Gateway. I get an error that my source is unable to update, but I don't know why. When I test the connection in my Gateway it says it connects fine. For some reason my published data set doesn't recognize the report's source as the same one as the one in my gateway.

Is there any additional step required in publishing a Web Data Source in order to make it use the gateway's web source?

This is the Error I get: This is the Error I get

This is the Gateway's connection to the API: This is the Gateway's connection to the API

This is the (Much Truncated) version of the Query I am using to retrieve the data:

let 
    Url = "https://rest.avatax.com/api/v2/companies/XXXX/transactions/",
    RawData = Web.Contents(Url),
    Json    = Json.Document(RawData)
in  
    Json

Solution

  • This an incredibly annoying "feature", but the Power BI service does a different code analysis than Power BI Desktop. The way to overcome it is to present a static URL like this:

    let 
        Source = Json.Document(Web.Contents("https://rest.avatax.com/api/v2/companies/XXXX/transactions/"))
    in  
        Source
    

    Chris Webb described this in more detail (along with hacks to make the URL dynamic) in this blog post:

    https://blog.crossjoin.co.uk/2016/08/23/web-contents-m-functions-and-dataset-refresh-errors-in-power-bi/