powerquery - 通过 Power Query 访问完整的 Clockify 保存报告
问题描述
基于 Alex 的问题(以及对此的自己的回答),我已经与保存的 clockify 报告建立了联系,该报告在一段时间内没有问题。然而,最近clockify 在保存的报告中引入了分页,结果只有(最多)前50 个条目从报告中返回。
Clockify 支持已将我指向“计数”或“页面”作为可能的解决方案(“计数”(默认为 50)应指示返回条目的数量,“页面”应指示返回报告的页面)。不幸的是,我无法改变返回的内容。
= Json.Document(
Web.Contents("api.clockify.me/api/reports/{my report}",
[Headers= [ContentType="application/json",
#"X-Api-Key"="{my API Key}",
count="9999"
]
]
)
)
上面的例子,我相信应该最多返回 9999 个条目,但实际上最多只返回 50 个。“count”参数完全被忽略了......
解决方案
我叫错了树...事实证明,无法避免保存的报告中的分页,并且 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
进一步的发展:
推荐阅读
- javascript - 在 Angular/Typescript 中单击按钮/图标时,如何将文本字段变为输入字段?
- python - AttributeError:“模型”对象没有属性“时代”-Keras
- android - Android Studio 打开不正确的 java 类文件。错误:“链接资源失败。”
- javascript - 如何在移动设备上禁用页面堆积?
- java - 需要通过 jenkins slave(Windows)上的浏览器窗口上传文件,但文件在 jenkins master(linux)上
- c# - 动态传递 GroupBy Key
- uwp - 如何将本地文件夹图像设置为 BitmapImage 源?
- c# - 使用 File.CreateText() 创建的文件不是 UTF-8
- c# - WPF BitmapSource 图像显示问题
- php - 谷歌翻译 API - 发送的字符太多 - 如何调试?