HomeBusiness IntelligencePower BI Refresh with Anonymous API Query

Power BI Refresh with Anonymous API Query

Category

Date

read time

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.

Something went really wrong

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

Michael Heath

Michael Heath is an enablement specialist with over 15 years of experience. His background in Education, Behavioral Neuroscience, Game Theory, and IT has afforded him a unique perspective and ability to provide creative transformative solutions for the modern workplace. From napkin ideation to law, Michael utilizes human-centered techniques to solve problems in a creative and innovative way. His design thinking methodologies have resulted in millions of hours saved by strategizing big wins around usage and adoption of the Microsoft Power Platform. In his spare time, Michael loves experiencing new places, cultures, and foods with his family. He also enjoys lacing up a pair of hiking boots and exploring the great outdoors.

Recent posts