我叫错了树...事实证明,无法避免保存的报告中的分页,并且 count 参数什么也不做。此 API 正在开发中,因此可能会发生此类更改。相反,clockify 支持建议使用instead,这需要在requestPOST /workspaces/{workspaceId}/reports/summary/的正文中使用一些参数。例子:
{
"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
https://eriksvensen.wordpress.com/2014/09/15/specifying-json-query-in-power-query-example-statistics-sweden/
进一步的发展:
https://www.thebiccountant.com/2018/06/05/easy-post-requests-with-power-bi-and-power-query-using-json-fromvalue/
)