Forum Discussion
Power Query - Blank Query - API Call Service Refresh
I have this piece of code where I call external API to get some data but an issue I am having is that once I publish this to Power BI service if fails to refresh you to dynamic data source etc. However, I tried to follow Chriss's tutorial on resolving this problem with no luck. When I call it by using the whole URL, I get data, so i am wondering if I am breaking it down correctly.
This URL works https://url.com/api/something/calls?limit=3&start=0
let
headers = [#"Content-Type" = "application/json", #"Accept"="application/json"],
getJson = (url) =>
let
Source = Json.Document(Web.Contents(url, [RelativePath = "pokemon?", Query=[limit="100", offset="0"], Headers = headers]))
in
Source,
data = getJson("https://pokeapi.co/api/v2")
in
data
Any suggestions?
12 Replies
- lbendlinSuper User
Remove the question mark from RelativePath
is the query parameter called start or offset?
- stribor45Post Prodigy
I tried without question mark as well and that didn't work. It is an offset
- bastostiagoFrequent Visitor
Hi stribor45, generally, when I use a REST API to get data, I employ a Dataflow in Power BI Service, and then connect my report to this dataflow.
With this setup, I encounter an issue because I have to schedule both the dataflow and the dataset. To resolve this, I use Power Automate to trigger the dataset refresh automatically once the dataflow finishes refreshing.
I hope this explanation is clear enough.
- stribor45Post Prodigy
Do you have an example/tutorial about Dataflow set up with API? I am suprised because all of these tutorials suggest using RelativePath and Query parametars of the WebContents function yet I am not able to make it work with simple example so I am wondering if I missing something simple or these cant be done currently any more