Pagination in API
Maciej Rząsa (@mjrzasa)
PGS Software (Rzeszów)
Slide 2
Slide 2 text
Big JSON in API (~10MB)
●
Synchronizing data for offline use
●
“Send me everything newer than I have”
●
Timeouts on heroku
●
Memory issues on the android client
●
Solution: pagination
Slide 3
Slide 3 text
Regular pagination
GET /items?page=1×tamp=t0
Deleting first two items
t0
t0
Slide 4
Slide 4 text
Regular pagination
GET /items?page=2×tamp=t0
t0
t0
Slide 5
Slide 5 text
Since-to pagination
GET /items?since=t0&to=t1
t0 t1
5 items
Slide 6
Slide 6 text
Since-to pagination
GET /items?since=t1&to=t2
t1 t2
10 items
Slide 7
Slide 7 text
Timestamp with page size
GET /items?timestamp=t0&page_size=5
t0 t1
GET /items?timestamp=t1&page_size=5
Slide 8
Slide 8 text
Timestamp with page size
GET /items?timestamp=t0&page_size=5
GET /items?timestamp=t1&page_size=5