The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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
Solved! Go to Solution.
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:
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?
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:
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?
User | Count |
---|---|
83 | |
82 | |
37 | |
34 | |
32 |
User | Count |
---|---|
92 | |
79 | |
61 | |
51 | |
51 |