Clockify Api - 获取每个用户过去 24 小时的小时数 [英] Clockify Api - get hours for each user for the last 24 hours
问题描述
我想知道你能不能帮我.
Hi I was wondering if you could help me.
获取过去 24 小时内给定工作区中每个用户记录的小时数报告的正确端点是什么?API 没有明确说明要使用哪个报告以及要在发布请求中提供哪些值才能获得此结果.
What would be the right endpoint to get a report for hours logged for each user in a given workspace the past 24 hours? The API doesn't make it clear which report to use and what values to supply in a post request to get this result.
对不起,如果我对这些功能有点天真,我被要求在没有 API 知识的情况下查看这个,我只是想让我了解它.
Excuse me if I seem a little naive about the capabilities, I have been asked to look at this without prior knowledge of the API and I'm just trying to get me head around it.
推荐答案
Clockify 似乎关闭了他们的旧 API(我正在使用).报告 API 记录在此处:https://clockify.me/developers-api#tag-Reports
Clockify just seem to have shut down their old api (I was using). The report API is documented here: https://clockify.me/developers-api#tag-Reports
这很有效.对于您的情况,请求可能如下所示:
And this works quite well. For your case, the requests could look like:
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-08-13T00:00:00.000Z",
"dateRangeEnd": "2020-08-13T23:59:59.000Z",
"summaryFilter": {"groups": ["USER"]},
"exportType": "JSON"
}'
没有过去 24 小时"不过,您必须自己调整日期.
There is no "last 24h" though, you will have to adjust the dates yourself.
您的案例可能有趣的地方:
What might be interesting for your case:
- 此示例仅返回用户的所有持续时间.如果您希望明确所有时间条目,请将
TIMEENTRY
添加为汇总组:
- This example just returns all durations by user. If you want all time entries explicitely, add
TIMEENTRY
as summary group:
"groups": ["USER", "TIMEENTRY"]
- 您还可以将其导出为不同的格式:支持
JSON
、CSV
、XLSX
、PDF
.
这篇关于Clockify Api - 获取每个用户过去 24 小时的小时数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!