Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Connect Power BI to a web API (breathe hr)

Hi,

 

I'm trying to connect to Breathehr.com, which is a web based service. Trail gives you all options to play with it so went for it and created some dummy data. Sadly I can't connect to the API using the key.

 

They say on their website:

"Authentication to the breathe API is achieved with a token, sent in the HTTP headers of every request. The X-API-KEY header should contain the string shown in the app on/settings/modules/api_setup"

 

There are two kesys to be found. Production and sandbox:

" prod-GCcDDZpORrpQDXdAmRqoZg17-ElVGaqlSyHUaplPa8I; sandbox-y3et1u8ZDZN_NcNQtAzjuIdMuS704vGLlcVqoRstwuo" 

 

I'm tryingto use one of them as it was suggested by the community in few topics:

 

let
    Source = Json.Document(Web.Contents("https://hr.breathehr.com/allowances?identifier=centiq", [Headers =[Authorization="Bearer " & "prod-GCcDDZpORrpQDXdAmRqoZg17-ElVGaqlSyHUaplPa8I"]]))
in
    Source

 

 

Unfortunately i get an error:

 

Also, if i try this:

 

let
    Source = Json.Document(Web.Contents("https://hr.breathehr.com/allowances?identifier=centiq", [Headers=[#"x-api-key"="prod-GCcDDZpORrpQDXdAmRqoZg17-ElVGaqlSyHUaplPa8I"]])),
    #"Converted to Table" = Record.ToTable(Source)
in
    #"Converted to Table"

 

Same error happens:

"DataSource.Error: The downloaded data is HTML, which isn't the expected type. The URL may be wrong or you might not have provided the right credentials to the server."

 

Can anyone help?

  • Anonymous's avatar
    Anonymous
    6 years ago

    Hi Rena,

     

    Thanks for your message. I tried your solution, but unfortunatelly I get this error:

     

    It was a stupid mistake. I was using a wrong link. Rather, than the URL showing report i was interested, I should've used what the service suggested in the documentation:

    https://api.breathehr.com/v1/employees

2 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Rena,

       

      Thanks for your message. I tried your solution, but unfortunatelly I get this error:

       

      It was a stupid mistake. I was using a wrong link. Rather, than the URL showing report i was interested, I should've used what the service suggested in the documentation:

      https://api.breathehr.com/v1/employees