0

Does anyone know how to call the Clockify API in Power Bi?

I just cant seem to get it right. I have read through the Clockify API documentation and the I cant transpose the code in Power Bi.

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

2 Answers2

0

did you get around this? there is no support on official website of clockify as for now, but it seems that it could be done by the clockify API but same as your code it does not run.

0

So I don't know PBI but one issue I think I see with your call is the "Headers" should include a "Content-Type" - "application/json" header. You don't need the "Accept" header. And you might have shortened it, but your endpoint URL needs an actual endpoint - https://api.clockify.me/api/ won't return anything. Instead you should test trying to get the workspace information, for example, which I think would look something like this:

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

This one doesn't need the content-type header because it's just a GET request. I don't know how PBI creates different types of requests, but certain requests need to be GET requests, while others need to be POST/PUT/DELETE/etc.