1

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

mbuechmann
  • 5,413
  • 5
  • 27
  • 40
Alex
  • 43
  • 6

2 Answers2

1

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

Authorization="X-api-key xxxxxxxxxxxx"

use:

X-api-key="xxxxxxxxxxxx"

user2551768
  • 488
  • 6
  • 11
1

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
Marco Vos
  • 2,888
  • 1
  • 9
  • 10
  • I tried this and I get, Expression. Error: The 'x-api-key' 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 'code' – Alex Oct 09 '18 at 13:19
  • I do not get this error. Is the credential-type set to anonymous? You can edit this by using [Data Source Settings] (home-tab), select the clockify connection, edit permissions, edit credential type. – Marco Vos Oct 09 '18 at 13:44
  • Just switch credentials and its not giving me any errors, :D. But theres no data do I need to edit the URL? – Alex Oct 09 '18 at 13:47
  • I don't now. I also did not get any data, but I presumed that was because you used another key in stead of "xxxxxxxxxx" – Marco Vos Oct 09 '18 at 14:01
  • So I replaced xxxxxxxx with my Key and it didn't return anything. Could I create a test account in Clockify for us to use? – Alex Oct 09 '18 at 14:03