Clockify API & Powerbi

1.9k Views Asked by At

I have been done the rabbit role for the last day trying to connect to the clockify API using Power Bi. (My experience with API's is minimal).

Any help to put my in the right direction would be appreciated

I'm assuming out of all my attempts this is the most correct approach.

= let
    Source = Json.Document(Web.Contents("https://api.clockify.me/api/", [Headers=[Accept="application/json", Authorization="X-api-key xxxxxxxxxxxx"]])),
    messages = Source[messages]
in 
    Source

I keep getting this error:

Expression.Error: The 'Authorization' 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, Content-Type, If-Modified-Since, Prefer, Referer

2

There are 2 best solutions below

2
On BEST ANSWER

You authorization header seems to be wrong. Instead of using:

Authorization="X-api-key xxxxxxxxxxxx"

use:

X-api-key="xxxxxxxxxxxx"

5
On

Try this:

let
   Source = Json.Document(Web.Contents("https://api.clockify.me/api/", 
   [Headers=[Accept="application/json", #"x-api-key"="xxxxxxxxxx"]])),
   messages = Source[messages]
in 
   Source