我一直在尝试使用Clockify api生成报告,并且一直在跟踪official documentation。首先,我尝试使用自己的数据,但经过反复试验,我甚至开始尝试默认数据。也不走运。根据文档,这应该是可行的:
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/'但事实并非如此。答案将是:
{
"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
}我不知道我做错了什么,所以任何帮助都会非常感谢。
发布于 2018-12-13 01:02:54
问题出在他们的默认数据上--数组不应该用"“括起来,所以正确的数据应该是:
{
"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"
}这对我来说很有效,但是现在我得到了一个"No enum constant com.clockify.domain.model.DashboardSelection.false“error (代码3002)”,我还没能弄清楚。我使用的JSON昨天还能用,但今天就不行了……所以不确定到底是怎么回事。
编辑:删除"me“字段,它可以防止我收到的错误。如果您只想要自己的条目,只需在userIds字段中输入您的用户ID即可。
发布于 2020-02-23 02:51:16
这对我来说很有效:
data = {
"startDate":f"{start}T00:00:00.000Z",
"endDate": f"{end}T23:59:59.999Z",
"me": "false",
"userGroupIds": [],
"userIds": [],
"projectIds": [],
"clientIds": [],
"taskIds": [],
"tagIds": [],
"billable": "BOTH",
"includeTimeEntries": True,
"zoomLevel": "month",
"description": "",
"archived": "Active",
"roundingOn": False
}https://stackoverflow.com/questions/53347463
复制相似问题