Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions browser-js/get-year-report.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
const api_key = 'YOUR API KEY' // Replace with your API key
const workspace_id = "YOUR WORKSPACE ID" // Replace with your workspace id

const yearFilter = {
"dateRangeStart": "2022-01-01T00:00:00.000",
"dateRangeEnd": "2022-12-31T23:59:59.000",
"summaryFilter": {
"groups": [
"USER",
],
}
}

async function yearsClockifyReports() {
const response = await fetch('https://reports.api.clockify.me/v1/workspaces/' + workspace_id + '/reports/summary', {
headers: {
'X-Api-Key': api_key,
'Content-Type': 'application/json',
'Accept': 'application/json'
},
method: 'POST',
body: JSON.stringify(yearFilter)
})
const reports = await response.json()
return reports
}

function main() {
const yearReport = await yearsClockifyReports()
console.log(yearReport)
}