Search code examples
restapiclockify

Clockify API: Group Report by Project and aggregate by Task


Calling the REST-Api, I want to get a list of tasks with their corresponding summed tracked time grouped by their project. As an example, if I have the following time entries:

  • 2h, Task1, ProjectA
  • 1h, Task1, ProjectA
  • 3h, Task2, ProjectB
  • 30m, Task2, ProjectA

I would like to get the following report:

  • ProjectA
    • Task1, 3h
    • Task2, 30m
  • ProjectB
    • Task2, 3h

At the moment this is possible via the UI, but I could not find a way to do this by calling the API.

Does anyone know how this works?


Solution

  • Unfortunately there is no endpoint that would return data grouped that way without additional formatting on the client side.

    If you're up for some data transformation on the client you can use for example:

    GET workspaces/{workspaceId}/reports/summary
    

    It will contain a section 'projectAndTotalTime' which will show summed time entry duration per project, and a section 'timeEntries' with individual entries that you can group/sort by project on the client.