0

I am building a Laravel rest API that will return a list of posts by categories in chunks with $skip and $take.

i.e. /posts/animals/0/10

The problem here is that the posts are ordered by date desc so the new posts will be first and if a device has already asked for page 2 for example this could lead to the problem of getting the same item in different pages.

I can think of some checks to implement both on api and device side but they are all memory consuming. I thought of having a list of post_ids and checking against those before rendering the feed (device side) or doing the same thing with some cache list on the API side.

Is there a better way to accomplish this? Does someone have an article on best practices for feeds / streams?

Thanks in advance!

Bathan
  • 783
  • 3
  • 9
  • 18
  • I have always find filtering through ID better option to paginate. You can try if it fulfills your requirement. – anwerj Aug 09 '16 at 09:06
  • I found this that can serve as solution for me : http://stackoverflow.com/questions/13872273/api-pagination-best-practices – Bathan Aug 09 '16 at 09:11

0 Answers0