I've been trying to generate a report with the Clockify api, and I've been following the official documentation. First I tried with my own data, but after trial and error, I started even trying the default data. No luck either. According to the documentation, this should work:
curl -X POST -H 'X-Api-Key: {apikey}' -H 'content-type: application/json' -d '{
"startDate": "2018-06-18T00:00:00.000Z",
"endDate": "2018-06-24T23:59:59.999Z",
"me": "false",
"userGroupIds": "[]",
"userIds": "[]",
"projectIds": "[]",
"clientIds": "[]",
"taskIds": "[]",
"tagIds": "[]",
"billable": "BOTH",
"includeTimeEntries": "true",
"zoomLevel": "week",
"description": "",
"archived": "Active",
"roundingOn": "false"
}' -v -i
'https://api.clockify.me/api/workspaces/{workspace}/reports/summary/'
But it doesn't. The response will be:
{
"message": "Could not read document: Can not deserialize instance of java.util.ArrayList out of VALUE_STRING token\n at [Source: java.io.PushbackInputStream@4a679880; line: 5, column: 19] (through reference chain: com.clockify.adapter.http.summaryReport.GetSummaryReportRequest[\"userGroupIds\"]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.util.ArrayList out of VALUE_STRING token\n at [Source: java.io.PushbackInputStream@4a679880; line: 5, column: 19] (through reference chain: com.clockify.adapter.http.summaryReport.GetSummaryReportRequest[\"userGroupIds\"])",
"code": 3002
}
I don't know what I'm doing wrong, so any help would be much appreciated.
The issue is with their default data - the arrays shouldn't be surrounded in "", so the correct data would be:
This was working for me but now I'm getting a "No enum constant com.clockify.domain.model.DashboardSelection.false" error (code 3002) and I haven't been able to figure it out. The JSON I was using was working yesterday but today it is not... so not sure what is going on.
Edit: Remove the "me" field, it prevents the error that I'm getting. Instead just put in your user ID into the userIds field if you only want your own entries.