Forum Discussion

jasonfordx's avatar
jasonfordx
Helper II
8 years ago
Solved

Connect API with Header ApiKeyName not going through

Dear community,

 

Im trying to connect my Excel/PowerBI and is not working. I read the entire forum and I could not reach the right answer for it.

 

My provider gave me the following instructions:

 

Authentication
The API requires an HTTP header x-api-key(see examples below)
Supported formats
- JSON (default)
- Flattened CSV

Basic execution
curl -s -L -H ""x-api-key: **********" "https://api.educationcenter.com/1.0/books"
Filtered field

 

I've tried several way to connect there. Going in Excel/PowerBI:

 

By myself, cliking in Data > Get Data > From other sources > From web > Advanced

 

Headers:

 

ContentType: application/json

Accept: application/json

Authorization: "x-api-key: **********"

 

But the error message is:

 

We couldnt't authenticate with the credentials provided. Please try again

 

Anyone has any clues please?

 

 

12 Replies

  • v-yulgu-msft's avatar
    v-yulgu-msft
    Microsoft Employee

    Hi jasonfordx,

     

    From the error message, it points that the provided credential is invalid. You may need to check the API key to make sure it have access to source data and you have typed with correct key.

     

    Regards,

    Yuliana Gu

    • Michal_cwiok's avatar
      Michal_cwiok
      Resolver II

      I am not an expert, but my quick research suggests that the header name should be "X-API-KEY" and its value being API-KEY. Now you have header name "Authorization" and value "X-API-KEY:YOUR_KEY".

       

      Try something like this

      let
       
      Http_query = Json.Document(Web.Contents("<Your URL>", 
                [Headers=
                        [X-AP-KEY ="<Your API KEY>"]
                 ]
                 )),
      Data = Http_query{0}
       
      in 
       
         Data

      Let me know, if it works. I think this is the right direction.

    • jasonfordx's avatar
      jasonfordx
      Helper II

      Dear Ms. Gu, good morning, how are you?

       

      My private API key works using curl for Windows. This is why I am comfortable telling you that the private key is working and valid. But I had the same question before. I was trying to reach their data using Excel for the first time and not being able to access. So I was like: Problably I need to talk with them because may be my key. But using Curl worked, so I was like, .... may be a synthax problem hehehehe.

       

      Ty for your time and support.