Reputation: 11
I need to loop through every page with timeentry results (so far i know i have 4 pages). The reason why i need to loop through the pages is the api has a limit of 1000 results each page. My issue seems to be in how to factor in the pagination in my "body". Below is my function to get the first 1000 results, and so far i have created 4 queries, to get all 4 pages with tme entry results. There has to be smarter method, than creating a function for each page :-)
let
body = "{ ""dateRangeStart"": ""2023-01-01T00:00:00.000"", ""dateRangeEnd"": ""2023-05-31T23:59:59.000"", ""detailedFilter"": { ""page"": ""1"", ""pageSize"": ""1000"" } }", Source = Json.Document(Web.Contents(
"https://reports.api.clockify.me/v1/workspaces/MYWORKSPACEID/reports/detailed",
[ Headers = [#"Content-Type"="application/json",
#"X-Api-Key"="MYAPI"],
Content=Text.ToBinary(body) ])
),
timeentries = Source[timeentries],....
Upvotes: 1
Views: 99