Skip to main content
Showing results for 
Search instead for 
Did you mean: 

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Frequent Visitor

PowerBI Template - parametric REST API - anonymous connection issue

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):

    Source = Json.Document(
                RelativePath= "prefix/" & parameter & "/suffix",
                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
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 ( 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!

Helper I
Helper I

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!

Helper I
Helper I

Hey @nhch ! I've been facing this exact issue myself for a while now. Did you manage to solve this?

Frequent Visitor

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 


Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

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!


Helpful resources

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.


Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.