Skip to main content
cancel
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.

Reply
adwilliams
Frequent Visitor

Web API Key Authentication

Hello,

I am trying to connect to a Web API in Power BI Desktop. The request requires token authentication with an "api_key" parameter.  I continue to get the error that an API key name must be specified in order to provide an API key, but I cannot find where to specify an API key name.

 

I have already tried the following and none have worked:

  1. Anonymus authentication with providing the API key in the URL as a parameter
  2. Basic authentication with the API key as the username
  3. Web API authentication and provided the api key as the key value
  4. Adding a Header in the advanced UI called "Authorization" and providing the key. I also tried to specify the API key name here as "api_key".

I have seen other posts suggesting to create a dataflow to solve this but I do not have the ability to create a dataflow. 

 

What is the proper way to provide token authentication for a Web API?

 

 

Thanks,

7 REPLIES 7
Victor_Lecomte
New Member

Hello @adwilliams ,

I am encountering the same issue. Were you able to find a solution?

Thanks,
Victor

v-eqin-msft
Community Support
Community Support

Hi @adwilliams ,

 

As the official document said, "api_key" is just an example, so it should be based on your actual URL in this format: "https://contoso.com/api/customers/get?api_key=****** 

Eyelyn9_1-1647594628924.png

 

 

Best Regards,
Eyelyn Qin

Hi! so "api_key" is actually the same as I need for my URL format.

 

Additionally, I attempted to do this just as a Blank Query in the advanced editor to bypass the Authentication in the Web API UI. I am still getting errors. Do you have any other tips on how to get this done?

 

There really should be a much easier way to provide auth for this...

adwilliams
Frequent Visitor

Hi-  I have tried that, I have started a blank query and input Web.Contents("my api URL", [ApiKeyName="api_key"]) and saved it, and tried to Get Data from Web using the same api URL and selecting Web API inputting my key in the box. 

 

I still get the warning that I need to specify an API key name. Could it be that it is not specified in the right editor? Is there any where else to pass this auth?

I tried the auth trick by putting the api_key in the URL as a parameter and selecting Anonymous, that did not work. I received the error that I have invalid credentials but when I test my call in Postman with the same api key, it is fine.

 

This is the query I have currently: which is still giving me the error that I have invalid credentials.

adwilliams_0-1647286033342.png

 

lbendlin
Super User
Super User

Have a read here Web.Contents - PowerQuery M | Microsoft Docs , specifically the ApiKeyName section.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

Top Solution Authors
Top Kudoed Authors