Periodically you’ll need to make an anonymous API call via Power BI and thus also run into some problems when you try to refresh via the Power BI service. Maybe it works just dandy when editing or even with just the root URL, but if PBI views the URL as being dynamic you more than likely will run into issues with refreshing. This seems to be some limitation with Web.Content() function, but I have found the fix below to allow the refresh to work. Let’s get automating!
When using the Web.Content() function formatting typically comes in the following form:
Source = Json.Document(Web.Contents("https://as.awmdm.com/api/mdm/devices/Search?", [Headers=[#"aw-tenant-code"="String", Authorization="Basic String", Accept="application/json", #"Content-Type"="application/json"]])),
If you try and refresh this in the PBI service it will throw an error.
We can fix this by isolating the root URL path. https://as.awmdm.com/ and api/mdm/devices/search? when split. We keep the root, but then identify the Relative Path as shown below.
Source = Json.Document(Web.Contents("https://as.awmdm.com/", [RelativePath="api/mdm/devices/search?pagesize=25000",Headers=[Authorization="Basic String", #"aw-tenant-code"="String=", Accept="application/json", #"Content-Type"="application/json"]])),
This surprisingly easy fix should have your data refreshing in no time.
“Humor is an antidote to all ills”
– Patch Adams