Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Frequent Visitor

Load Data from Rest Api with Bearer Token

Hello Everyone, thanks for your help.
I am trying to load  a Rest Api that you will be able to see at the end of the text through a power  Query that I used to load the data to my power bi Dashboard.  I was able to pull the data from the rest api to the power bi report using anonymous connection and ignoring privacy levels from power bi Query and desktop. It refreshes fine with a manual refresh and it loads all the data properly.
But the issue is that when I load it to Power BI Service, it does not authenticate the credentials in any way and I have also been getting the  error messages below depending on the combination of privacy levels I use, I've tried them all. THe rest api is created on a postgre data base and it requires a bearer token to be pulled, I would really appreciate your guidance on a suggestion to load the query properly so I can authenticate either using anonymous or web api, but currenlty none works because anonymous does not authenticate also if I try power bi service and web api says 'need an api key name to be able to use an api key'.

Please guide me how to solve this I've been reading about creating custom connectors but I am not aware of to do it, or perhabs I can have the team that works on the api modifying the rest api configuration so it better fits power bi, any help is appreciated.

Here you can find the most recurrent errors I'm getting related to an issue with the Authorization header and privacy levels. 

Data source error: [ValidateMarkupTags][ccon]Expression.Error: The '[ccon]Authorization[/ccon]' header is only supported when connecting anonymously. These headers can be used with all authentication types: [ccon]Accept, Accept-Charset, Accept-Encoding, Accept-Language, Cache-Control, Content-Type, If-Modified-Since, Prefer, Range, Referer[/ccon]. [/ccon]. The exception was raised by the IDbCommand interface. Table: it changes
Time: 2023-09-27 15:27:02Z

Information is needed in order to combine data. Please specify a privacy level for each data source.;Information about a data source is required.. The exception was raised by the IDbCommand interface. Table: itchanges.

*Rest api general specifications and header*

curl --location --request GET 'Corplinkhereurl \

--header 'Content-Type: application/json' \

--header 'Authorization: Bearer APIKEY*
Source = Json.Document(Web.Contents("mycorplink",
[Headers=[Authorization="Bearer myapikey]])),
#"Converted to Table" = Table.FromRecords({Source}),
#"Expanded data" = Table.ExpandListColumn(#"Converted to Table", "data")
#"Expanded data"



Super User
Super User

you are missing the closing double quotes after the token. Also note that a JWT and an API Key are techincally different things.  It is rather unusual to use an API key as a token.

This issue was solved by turning the bearer authentication into a token in the header authentication directly from the API, notice from my research if you want to connect a bearer token you have to use a custom connector otherwise the rest api configuration must be modified.

Helpful resources

PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors