Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to implement "pull down to refresh" on server side

I'm programming the API service, so the iOS app wants to "pull down to refresh" some records (AKA streams), but I'm not sure how to program the "pagination"-like feature.

I was thinking of making a query using offset and limit (start and end in python) but I think this is not the right approach.

Does anyone have an idea how this should be done?

My RESTful API is buit on django.

Thanks in advance.

like image 917
po5i Avatar asked Nov 18 '25 21:11

po5i


1 Answers

If you only want to return the latest records, the app should query your API with a last_updated timestamp.

Based on that you can filter your queryset to match the records that have been added the last time the user has refreshed his timeline.

If no timestamp is set, you return all records (or a part of it ordered by date of creation).

like image 160
Jay Avatar answered Nov 21 '25 13:11

Jay