cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ibutur Frequent Visitor
Frequent Visitor

A web API key can only be specified when a web API key name is provided.

Hi guys,

 

I'm trying to connect to a database on Klipfolio. I'm using my ID as explained here:

https://klipfolio-api-reference-guide.readme.io/docs/data-source-instances-data

so, it's https://app.klipfolio.com/api/1.0/datasource-instances/{id}/data

 

I'm using this as Access web content. But when I enter the API Key in the Web API area, I get the following error message:

A web API key can only be specified when a web API key name is provided.

 

What does this mean? What do I need to do?

11 REPLIES 11
chrisu Member
Member

Re: A web API key can only be specified when a web API key name is provided.

It sounds like you need to specify an API key name in the headers area of Web.Contents using the advanced editor.  See Chris Webb's post on this for a good example: https://blog.crossjoin.co.uk/2014/03/26/working-with-web-services-in-power-query/.  

ibutur Frequent Visitor
Frequent Visitor

Re: A web API key can only be specified when a web API key name is provided.

Hi, when I add APIToken to the header, I get this error:

Details: "The 'APIToken' header is only supported when connecting anonymously. These headers can be used with all authentication types: Accept, Accept-Charset, Accept-Encoding, Accept-Language, Cache-Control, If-Modified-Since, Prefer, Referer"

beneuto Regular Visitor
Regular Visitor

Re: A web API key can only be specified when a web API key name is provided.

I have the same issue connecting to Microsoft Cognitive Services Sentiment Analysis API.   

 

Works no problem with the API key name and key hardcoded into the Web.Contents header section, but if I try to replace with the ApiKeyName option I get the same error.   This option supposedly just inserts the specified header using the Credentials dialog inputs so I don't see why the result is different.     

 

Surely this is a bug?

ericOnline Member
Member

Re: A web API key can only be specified when a web API key name is provided.

I know its a LONG time later, but here is how I solved this error: 

 

API Method

  • GET

Steps:

  • Click Get Data
  • Click Web
  • Click Advanced
  • Enter entire query string with parameters
  • Enter API Key and Value as a header
  • Click Connect
  • HERES THE SECRET: Select "Anonymous"
    • It was intuitive for me to want to click "API Key". But this is what resulted in the error.

I was then able to retrieve the API results and expand columns. AWESOME! 

 

Hope this helps!

ericOnline Member
Member

Re: A web API key can only be specified when a web API key name is provided.

For what its worth, I just found a good explanation of what this error message is referring to. It appears that when you specify "ApiKeyName = "youapikeygoeshere" " in a PowerQuery, this message will show up. 

 

See this video at the 17:54 mark.

 

Cheers!

nnosaj Frequent Visitor
Frequent Visitor

Re: A web API key can only be specified when a web API key name is provided.

This might look like a silly question for you, but how did you actually enter the API key and Value as a header?

 

I have this API from an Azure app service secured by Azure Active Directory, and I generated a key (client secret) from there.  I am struggling to put that key into the request header when creating a Power BI report (Get Data from Web).  I cannot find the API key name.  I mean I got the actual API key but i do not have the API key name or can't seem to find it. 

ericOnline Member
Member

Re: A web API key can only be specified when a web API key name is provided.

Hi @nnosaj. I'm fairly new at API calls and its been awhile since I worked on this project. I ended up writing a POST request in the Advanced Editor. Check this forum discussion between @ImkeF and myself. Might have some insights. 

Good luck!

Super User
Super User

Re: A web API key can only be specified when a web API key name is provided.

What kind of authentication does your app allow?

Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!

Imke Feldmann

How to integrate M-code into your solution -- Check out more PBI- learning resources here -- Performance Tipps for M-queries




nnosaj Frequent Visitor
Frequent Visitor

Re: A web API key can only be specified when a web API key name is provided.

Hi @ImkeF,

 

The .NET api itself, I created it without authentication, so at most, it is just anonymous authentication.  

 

The actual authentication (Authentication/Authorization), I set it up in Azure when I published and registered my api there. The provider I set is Azure Active Directory.  The registration allows you to generate a key for API access.  This key I put as client secret for my api.