0

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?

Alexander Baier
  • 230
  • 2
  • 7

2 Answers2

1

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.

user2551768
  • 488
  • 6
  • 11
  • I am not able to get this to work, what am I missing? https://api.clockify.me/api/v1/workspaces/myWorkSpace/reports/summary – Steve Feb 01 '20 at 16:00
0

With Clockify's new API this is possible, here an example with cURL:

curl --request POST \
  --url https://reports.api.clockify.me/v1/workspaces/<YOUR WORKSPACE>/reports/summary \
  --header 'content-type: application/json' \
  --header 'x-api-key: <YOUR API KEY>' \
  --data '{
    "dateRangeStart": "2020-07-13T00:00:00.000Z",
    "dateRangeEnd": "2020-08-13T23:59:59.000Z",
    "summaryFilter": {"groups": ["PROJECT", "TASK"]},
    "exportType": "JSON"
}'

You can even select different export types, see https://clockify.me/developers-api#tag-Reports.

Paul Wellner Bou
  • 532
  • 5
  • 16