Retrofit 2 — Pagination Using Link Header and Dynamic Urls (Like GitHub)

Pagination is an important aspect when developing clients against an API. In some cases, API endpoints return only subsets of a given resource set due to the amount of data that needs to be transferred to the client. Loading large data sets can (and should) be split into little chunks that can be requested on demand.

Within this second guide, you’ll learn how to implement client side pagination to request multiple data sets until you’ve all the desired information. We’ll use HTTP response header information generated by the server and dynamic urls to download desired parts to complete the data set on client-side.

Before moving on, you should scan through the available Retrofit posts to catch posts of interest.

Retrofit Series Overview

  1. Callbacks (Coming soon)
  2. Annotations (Coming soon)
  3. Fluent Interface with Builders (Coming soon)


Continue reading

University Enrollment Required

Future Students benefit from value packed videos and tutorials.

Enroll to receive exclusive content or sign in if you’re already a Future Student.

Enroll me for $12/mo

Explore the Library

Find interesting tutorials and solutions for your problems.

Miscellaneous