O'Reilly logo

RESTful Java Patterns and Best Practices by Bhakti Mehta

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Response pagination

REST APIs are consumed by other systems from web to mobile clients and hence, responses that return multiple items should be paged with a certain number of items per page. This is known as Response pagination. Along with the response, it is always good to add some additional metadata about the total count of objects, the total number of pages, and the links that refer to the next set of results. The consumers can specify a page index to query for results and the number of results per page.

Implementing and documenting default settings for the number of results per page is a recommended practice in case the client does not specify the number of results per page. For example, GitHub's REST API sets the default page size to 30 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required