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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Griggs
Frequent Visitor

POST API - Web.Contents failed to get contents

I have the following query that is working fine in Power BI desktop (I have anonymised the API Key and Workspace ID in the relative path). However, when publised, I am getting an error:Failed to update data source credentials: Web.Contents failed to get contents from 'https://reports.api.clockify.me/' (404): Not Found
Is there any way round this?

let
    // Inline dynamic date range: last 365 days
    todayDate = DateTime.Date(DateTime.LocalNow()),
    startDate = Date.ToText(Date.AddDays(todayDate, -365), "yyyy-MM-dd") & "T00:00:00Z",
    endDate = Date.ToText(todayDate, "yyyy-MM-dd") & "T23:59:59.999Z",

    // API credentials and endpoint parts
    apiKey = "-",
    baseUrl = "https://reports.api.clockify.me",  
    relativePath = "v1/workspaces/-/reports/detailed",

    // JSON request body
    requestBody = [
        dateRangeStart = startDate,
        dateRangeEnd = endDate,
        exportType = "JSON",
        detailedFilter = [
            page = 1,
            pageSize = 1000
        ]
    ],
    binaryBody = Json.FromValue(requestBody),

    // API call
    response = Web.Contents(baseUrl, [
        RelativePath = relativePath,
        Headers = [
            #"X-Api-Key" = apiKey,
            #"Content-Type" = "application/json"
        ],
        Content = binaryBody
    ]),

    // Parse and transform response
    json = Json.Document(response),
    entries = json[timeentries],
    table = Table.FromList(entries, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    output = Table.ExpandRecordColumn(table, "Column1", {
        "_id", "description", "userId", "timeInterval", "billable", "projectId", "taskId", "tagIds",
        "approvalRequestId", "type", "isLocked", "currency", "amount", "rate", "earnedAmount",
        "earnedRate", "costAmount", "costRate", "projectName", "projectColor", "clientName",
        "clientId", "taskName", "userName", "userEmail"
    })
in
    output

 

1 ACCEPTED SOLUTION
OwenAuger
Super User
Super User

Hi @Griggs

I took your query and added my own Clockify API Key & Workspace ID, and initially received the same error when setting up Data Source Credentials in the Power BI Service.

 

After some testing, it seems the only way to avoid the error and validate the Data source credentials is to bypass the connection test by enabling "Skip test connection" as shown here:

OwenAuger_0-1751113078862.png

This seems to be one of those cases where the Power BI Service simply can't validate the API URL. Changing the split between Base & Relative URLs didn't seem to help in this case.

 

In any case, after enabling "Skip test connection", I was able to successfully refresh the semantic model in the Service.

 

Are you also able to get refresh working in the same way?


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

View solution in original post

1 REPLY 1
OwenAuger
Super User
Super User

Hi @Griggs

I took your query and added my own Clockify API Key & Workspace ID, and initially received the same error when setting up Data Source Credentials in the Power BI Service.

 

After some testing, it seems the only way to avoid the error and validate the Data source credentials is to bypass the connection test by enabling "Skip test connection" as shown here:

OwenAuger_0-1751113078862.png

This seems to be one of those cases where the Power BI Service simply can't validate the API URL. Changing the split between Base & Relative URLs didn't seem to help in this case.

 

In any case, after enabling "Skip test connection", I was able to successfully refresh the semantic model in the Service.

 

Are you also able to get refresh working in the same way?


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

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.