Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi guys,
I'm creating a Template report so that users can connect to their data.
As a source i'm using some parametric rest APIs not managed by me.
Here's a little snippet of my M code (this works):
let
Source = Json.Document(
Web.Contents(
"https://api.test.com/",
[
RelativePath= "prefix/" & parameter & "/suffix",
Headers=[Authorization=parToken],
Query=[attr1 = "valattr1", attr2 = "100"],
Timeout = #duration(0, 0, 1, 0)
]
)
)
When installing the template the user must specify the parameter so that powerquery can make the API calls.
In this example, if the user's parameter is 123 the working API's path is https://api.test.com/prefix/123/suffix.
The issue is that in order to check if the connection works after the user inserts the parameter powerbi check on the static part of the path (https://api.test.com/) but, without the relative part it dosen't works and a 404 exception is thrown.
Do you have any clue on how to avoid this?
Thank you!
Thomas
Hey @nhch ! I've been facing this exact issue myself for a while now. Did you manage to solve this?
Hi my friend,
You will not like my answer but at least it will save you from useless development.
Online the common advice to solve this issue is to develop a custom connector. I've done it. But in order to make it work you need to have access to a PowerBI Gateway installed on the host machine.
It's almost obvious to say that if you are facing this issue you don't have access to the host machine.
So the custom connector IS NOT a solution in our case.
After that i tried proxing in Azure. A pain.
The only real way i found to do this is to have a PHP Proxy server.
This works but you need a server.
I hope this helps!
Hey @nhch, thanks for the update. I appreciate the guidance - as you say, not the solution I was hoping for but at least you've said me some more painful and fruitless testing time!
Hey @nhch ! I've been facing this exact issue myself for a while now. Did you manage to solve this?
UPDATE:
I tried to remove the relative path and it dosn't return 404.
Having a static path still don't work tho because when trying to connect it skip the attributes which are used for authentication purposes.
Any clue?
HI @nhch ,
Some of rest API which required the anonymous authorization not able to receive credentials on the detail level.
For this scenario, you need to use 'relative path' options to use the root part receive the credentials and authorization, and use this for the API authoraztion that setting in the 'relative path'.
Using The RelativePath And Query Options With Web.Contents() In Power Query And Power BI M Code
Regards,
Xiaoxin Sheng
In this case the authentication is given by the attribute in the "Header", not in the path, so i can't use the relative path for authentication.
Furthermore, I want to specify that the connection in the powerbi happens flowlesly, the issue is when i'm installing the app created by the Template.
There is a step in the installation process in wich PowerBi asks the user to populate the parameters, and to insert his token for authentication purpooses (and that's fine), after that it tries to connect to the data sources and, in doing so, it tries just to connect to the static path without using the authentication's token (the parameter).
The api throws an error and the user can't connect.
I hope this clarify the issue!
Thanks,
Thomas
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
84 | |
75 | |
68 | |
41 | |
35 |
User | Count |
---|---|
102 | |
56 | |
52 | |
46 | |
40 |