Filter an API call based on object created time
Options
I have an API that calls a large amount of user inputted data that I want to paginate by time. For this I need to edit my current API that calls all data by user and make a version that calls only entries made in on the current day, and a version that calls only entries made in the current week.
I have got as far as cloning the API I already have and looking at adding a conditional but I'm running into issues knowing where to go next:
[Screenshot 2022-01-14 at 18.37.38.png]
Any help much appreciated!
Thanks
I have got as far as cloning the API I already have and looking at adding a conditional but I'm running into issues knowing where to go next:
[Screenshot 2022-01-14 at 18.37.38.png]
Any help much appreciated!
Thanks
Comments
-
To get entries of the current day, I would consider using the timestamp_epoch_day filter like this:
[CleanShot 2022-01-14 at 14.22.12.png]
timestamp_epoch_day is the day number since Jan 1., 1970
To get entries of the same week, I would consider a couple of where statements grouped together such as:
[CleanShot 2022-01-14 at 14.26.29.png]
To get the same week, you would want to use timestamp_week and timestamp_year so that you are making sure the week and year is the same. Since there isn't an epoch filter for week. -
Otherwise if you just used week and you have entries over multiple years, it would be possible that you could grab entries that are the same week but from different years.
So also accounting for the year filters by that too.
Categories
- All Categories
- 53 ? Announcements
- 47 ? Releases
- 37 ? Welcome
- 983 ? Help! I'm a Noob
- 125 ? No-Code Front-Ends
- 633 ? Working with APIs
- 439 ? Transforming data
- 126 ? Connect Xano to ...
- 50 ?? Find an Expert
- 348 ❓Other questions
- 35 ? Security
- 22 ✂️ Snippets
- 19 ? Showcase
- 7 ?️ Xano Chatter
- 62 ? Video Tutorials
- 171 ? Request a feature
- 229 ? Report a Bug
- 19 ? Templates & Extensions
- 7 ? Feedback