通过 Power Query 访问完整的 Clockify 保存的报告
Access full Clockify saved report through Power Query
基于 Alex 的问题(以及自己对此的回答)here 我已经连接到保存的 clockify 报告,该报告在一段时间内没有问题。然而最近 clockify 在保存的报告中引入了分页,结果只有(最多)前 50 个条目从报告中 returned。
Clockify 支持已将我指向 "count" 或 "page" 的方向作为可能的解决方案("count"(默认 50)应指示 returned 条目的数量"page" 应指明报告的页码 returned)。不幸的是,我无法改变 returned.
的内容。
= Json.Document(
Web.Contents("api.clockify.me/api/reports/{my report}",
[Headers= [ContentType="application/json",
#"X-Api-Key"="{my API Key}",
count="9999"
]
]
)
)
上面的例子,我相信应该return最多9999个条目,但实际上只有return最多50个。"count"参数被完全忽略了...
我找错人了...
事实证明,在保存的报告中没有办法避免分页,而且 count 参数什么也不做。此 API 正在开发中,因此,可能会发生这样的更改。
相反,clockify 支持建议改用 POST /workspaces/{workspaceId}/reports/summary/
,这需要 request 主体中的一些参数。示例:
{
"startDate": "2018-01-01T00:00:00.000Z",
"endDate": "2018-12-31T23:59:59.999Z",
"me": "false", (Options: "false", "true", "TEAM", "ME", "null")
"userGroupIds": [],
"userIds": [],
"projectIds": [],
"clientIds": [],
"taskIds": [],
"tagIds": [],
"billable": "BOTH", (Options: "BOTH", "BILLABLE", "NOT_BILLABLE")
"includeTimeEntries": "true",
"zoomLevel": "week", (Options: "week", "month", "year")
"description": "",
"archived": "Active", (Options: "Active", "All", "Archived")
"roundingOn": "false"
}
(我从 clockify 支持中获得了更多参数,但据我所知,目前它们没有什么不同。我在下面对它们进行了注释。)
我让这个在 Power Query 中工作:
let
url="https://api.clockify.me/api/workspaces/{workspaceId}/reports/summary/",
content ="{
""startDate"": ""2017-01-01T00:00:00.000Z"",
""endDate"": ""2025-12-31T23:59:59.999Z"",
""me"": ""false"",
""userGroupIds"": [],
""userIds"": [],
""projectIds"": [],
""clientIds"": [],
""taskIds"": [],
""tagIds"": [],
""billable"": ""BOTH"",
""includeTimeEntries"": ""true"",
""zoomLevel"": ""week"",
""description"": """",
""archived"": ""Active"",
""roundingOn"": ""false"",
""groupingOn"": ""false""
"/* ,
""groupedByDate"": ""false"",
""page"":0,
""count"":9999,
""sortDetailedBy"": ""timeAsc"" (Options: "description", "descriptionAsc", "userName", "userNameAsc", "duration", "durationAsc", "time", "timeAsc")
*/
&" }",
Source = Json.Document(
Web.Contents(url, [Headers= [ #"X-Api-Key"="{yourAPIkey}"
,ContentType="application/json"
,#"Content-Type"="application/json"
]
,Content=Text.ToBinary(content)
]
)
)
in
Source
(来源:
https://community.powerbi.com/t5/Desktop/How-to-add-body-into-Web-Contents/td-p/128996
进一步发展:
基于 Alex 的问题(以及自己对此的回答)here 我已经连接到保存的 clockify 报告,该报告在一段时间内没有问题。然而最近 clockify 在保存的报告中引入了分页,结果只有(最多)前 50 个条目从报告中 returned。
Clockify 支持已将我指向 "count" 或 "page" 的方向作为可能的解决方案("count"(默认 50)应指示 returned 条目的数量"page" 应指明报告的页码 returned)。不幸的是,我无法改变 returned.
的内容。= Json.Document(
Web.Contents("api.clockify.me/api/reports/{my report}",
[Headers= [ContentType="application/json",
#"X-Api-Key"="{my API Key}",
count="9999"
]
]
)
)
上面的例子,我相信应该return最多9999个条目,但实际上只有return最多50个。"count"参数被完全忽略了...
我找错人了...
事实证明,在保存的报告中没有办法避免分页,而且 count 参数什么也不做。此 API 正在开发中,因此,可能会发生这样的更改。
相反,clockify 支持建议改用 POST /workspaces/{workspaceId}/reports/summary/
,这需要 request 主体中的一些参数。示例:
{
"startDate": "2018-01-01T00:00:00.000Z",
"endDate": "2018-12-31T23:59:59.999Z",
"me": "false", (Options: "false", "true", "TEAM", "ME", "null")
"userGroupIds": [],
"userIds": [],
"projectIds": [],
"clientIds": [],
"taskIds": [],
"tagIds": [],
"billable": "BOTH", (Options: "BOTH", "BILLABLE", "NOT_BILLABLE")
"includeTimeEntries": "true",
"zoomLevel": "week", (Options: "week", "month", "year")
"description": "",
"archived": "Active", (Options: "Active", "All", "Archived")
"roundingOn": "false"
}
(我从 clockify 支持中获得了更多参数,但据我所知,目前它们没有什么不同。我在下面对它们进行了注释。)
我让这个在 Power Query 中工作:
let
url="https://api.clockify.me/api/workspaces/{workspaceId}/reports/summary/",
content ="{
""startDate"": ""2017-01-01T00:00:00.000Z"",
""endDate"": ""2025-12-31T23:59:59.999Z"",
""me"": ""false"",
""userGroupIds"": [],
""userIds"": [],
""projectIds"": [],
""clientIds"": [],
""taskIds"": [],
""tagIds"": [],
""billable"": ""BOTH"",
""includeTimeEntries"": ""true"",
""zoomLevel"": ""week"",
""description"": """",
""archived"": ""Active"",
""roundingOn"": ""false"",
""groupingOn"": ""false""
"/* ,
""groupedByDate"": ""false"",
""page"":0,
""count"":9999,
""sortDetailedBy"": ""timeAsc"" (Options: "description", "descriptionAsc", "userName", "userNameAsc", "duration", "durationAsc", "time", "timeAsc")
*/
&" }",
Source = Json.Document(
Web.Contents(url, [Headers= [ #"X-Api-Key"="{yourAPIkey}"
,ContentType="application/json"
,#"Content-Type"="application/json"
]
,Content=Text.ToBinary(content)
]
)
)
in
Source
(来源: https://community.powerbi.com/t5/Desktop/How-to-add-body-into-Web-Contents/td-p/128996
进一步发展: