How to get all time entries without paging (report detailed, with date range)

Hi All,

I’m trying to retrieve all time entries for a given period with reports/detailed. The problem is that if I don’t give detailedFilter page/pageSize params the 50 entries limit is implicitly applied. How can I do it ?

In the case, all entries are only accessible page-by-page, how do I find how many pages there are?

{
    "dateRangeStart":  "2023-04-01T00:00:00",
    "dateRangeEnd": "2023-04-30T23:59:59",
    "exportType": "JSON",
    "detailedFilter":{"options":{"totals":"EXCLUDE"}}
}

Hi Atsy,

You could go with pageSize param being set to 200, while page (number) would be a counter where it would grow by 1 each iteration with the condition of stopping the script being report having no data (since you are using totals exclude, if you include them, you may enter infinite loop due to totals being sent even on pages without any entries).

Hope this helps!

Hi Mishko,

Yes, it helps. But honestly, that’s a bit strange (in terms of API design) as it cannot be predicted how many requests are needed. Usually, in other APIs I’ve seen, there is a total number of records or pages returned with the first response.
But anyway, thank you. It’s clear what to do :slight_smile:

KR, Alexander

1 Like

Ah, but there is actually a total count in totals

...
   "entriesCount": 283,
...

I didn’t see that all this time. I apologize. Now it’s completely clear :slight_smile: Thanks for the hint

1 Like

Hi Alexander,

I’m glad that worked! And no worries, it’s easy to overlook a single piece of info like that when looking at the big picture.

If you need any assistance in the future, please stop by anytime, and if you happen to go through our API docs, and have any feedback about it, you can DM me here on forum and I will gladly pass it to the devs.

Cheers!

Half related to this, the thing that would really assist us is being able to retrieve timesheets based on the date they were created/updated, not the date they were entered for. We have users that go and edit old timesheets, and can’t always rely on the webhooks to send us a response