Hello!
I can’t find a way to run a timer in Break Mode.
If I use the Clockify UI in my browser to run the timer in Break Mode and then I use the API to get the task info I have this:
Time Entry ID: @{
id=653a69cc24a15446026a1562;
description=Test_Break_mode;
tagIds=;
userId=0000a0000ad0b000b0e00c00;
billable=True;
taskId=6537a314205d0441c51041f3;
projectId=0000a000000d0000c00000ed;
workspaceId=00000dcd0000a00000b0f0fa;
timeInterval=;
customFieldValues=System.Object;
type=BREAK;
kioskId=;
hourlyRate=;
costRate=;
isLocked=False
}
You can see that the “type” is set to “BREAK”. For a task where the timer was ran in normal mode the “type” is set to “REGULAR”.
But when I use this to create a time entry via ppowershell:
$startTimeEntryUrl = "https://api.clockify.me/api/v1/workspaces/$workspaceID/user/$userID/time-entries"
$timeEntryData = @{
"workspaceId" = $newWorkspaceId;
"projectId" = $newProjectId;
"taskId" = $newTaskID;
"start" = (Get-Date -Format "yyyy-MM-ddTHH:mm:ssZ");
"billable" = $true;
"description" = $whatAreYouDoing
"type" = "BREAK"
}
$NewAccountHeaders = @{
"content-type" = "application/json";
"X-Api-Key" = $newAccountApiKey
}
$newEntryUri = "https://api.clockify.me/api/v1/workspaces/$workspaceId/time-entries"
$timeEntry = $timeEntryData | ConvertTo-Json -depth 32
$result = Invoke-WebRequest -Headers $NewAccountHeaders -Method POST -Uri $newEntryUri -Body $timeEntry
if ($result.StatusCode -eq 201)
{
Write-Host "Result: 201 Created."
}
else
{
Write-Host "Result: Failed to create this entry."
}
No matter that the “type” is explicitly set to “BREAK”, the timer is started in normal mode.
So, I have two question:
1 - does the API support creating a time entry in BREAK MODE?
2 - if it supports it, where I can find info about how to achieve what I need?