Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
katietran0467
Helper I
Helper I

POST API works well in Postman, not in Power BI

Hi everyone,

 

I followed the API Documentation here: https://docs.clockify.me/#tag/Time-Entry-Report/operation/generateDetailedReport

 

In Postman, it works very well.

 

katietran0467_1-1695882755646.png

 

However, it does not work in Power BI.

katietran0467_2-1695882892780.png

 

The script in Power BI as below.

katietran0467_3-1695882994709.png

 

The questions are:
1) Why could the same API request response in the different ways in Postman and Power BI?

2) How could we find the required actions for API in Power BI? For example, Postman will return the message to show what fields required but Power BI does not show any message but error.

 

Thanks everyone.

1 ACCEPTED SOLUTION
katietran0467
Helper I
Helper I

Hi everyone,

 

After many attempts, I found the reason: my Postman and my Power BI's API key is not the same: (1) with full permission and (2) with the limited permission.

 

I tested the API key with limited permission in Postman and the result is as below.

 

katietran0467_1-1696376986019.png

 

After testing, with the old API key with limited permission, it returns (400): Bad Request. If I added ""amountShown"": ""HIDE_AMOUNT"" in the body, it works as well.

 

Hope it helps.

View solution in original post

3 REPLIES 3
katietran0467
Helper I
Helper I

Hi everyone,

 

After many attempts, I found the reason: my Postman and my Power BI's API key is not the same: (1) with full permission and (2) with the limited permission.

 

I tested the API key with limited permission in Postman and the result is as below.

 

katietran0467_1-1696376986019.png

 

After testing, with the old API key with limited permission, it returns (400): Bad Request. If I added ""amountShown"": ""HIDE_AMOUNT"" in the body, it works as well.

 

Hope it helps.

OwenAuger
Super User
Super User

Hi @katietran0467 

I did some testing myself with a Clockify account, and was able to get the query working with what looks to be the same M code you posted.

 

I notice that the Clockify site links to a a convenient PBIT file by OscarValerock, with pre-configured Clockify API queries. I was also able to get this working too:

https://github.com/OscarValerock/Clockify-PowerBI#user-content-2-clockify-template

 

  1. The API response should be the same if the exact same headers/body are posted.
  2. Power Query doesn't provide great error messages for API calls like this - I think it is best to validate with Postman or another tool.

Here's my code with the keys obscured, that appears to match yours:

let
  url = "https://reports.api.clockify.me/v1/workspaces/XXXXXXXXXXXXXXXXXXXXXXXX/reports/detailed",
  headers = [
    #"content-type" = "application/json",
    #"X-Api-Key" = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
  ],
   body = "{
     ""dateRangeStart"": ""2023-01-01T00:00:00.000Z"",
     ""dateRangeEnd"": ""2023-12-31T00:00:00.000Z"",
     ""detailedFilter"": {
       ""page"": 0,
       ""pageSize"": 0       
     }
  }",

  Source = Json.Document(
    Web.Contents(
      url,
      [
        Headers = headers,
        Content=Text.ToBinary(body)
      ]
    )
  )
in
    Source

It returns a record containing two-fields: totals & timeentries, which matches what you had in Postman.

OwenAuger_0-1695888776508.png

 

 

 

Just checking you're using Anonymous authentication for all the API data sources?

 

 


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

Thanks for your reply and effort to test the API.

I connected to the API with param in URL, it is okay to connect. However, with this API, I could not connect.

I checked the permissions and it is anonymous.

katietran0467_0-1696375713239.png

 

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors