Skip to content

6.3. Paginating the response

Dane Rossenrode edited this page May 2, 2016 · 4 revisions

@todo Finish...

Pagination

Use the keyword page, and set it equal to the page number (as an integer). Example:

api/[resource-name]?page=2

Offsets (result numbers)

Use the keyword offset, and set it equal to the result number (as an integer) that you'd like the result set to start with. Example:

api/[resource-name]?offset=50

Range

Using the 'range' key, you can control the number of elements per page you want to show. This variable defaults to 50. Example:

api/[resource-name]?range=10

By default, RESTful will only return up to 50 items, even if the range parameter is higher. To increase this 'maximum range size', the resource plugin annotation will have to be ammended. Example

/**
 * ...
 *
 * @Resource(
 *   dataProvider = {
 *     "range" = 1000,
 *   },
 * )
 */
Clone this wiki locally