Table of Contents

Pagination

When retrieving data, you can apply query options to set criteria for the entity data you want and the entity attributes returned. The available options are Pagination (this page), Projections and Filter Operators.

To get paged response results, use the following query parameters:

  • limit: specifies the page size of the results.
  • offset: specifies the number of results to offset by (i.e. the page position).

The default limit value is 100. The default offset value is 0.

Example

To get the fifth page of results limited to 3 results per page from the Makes endpoint, limit the number of records on a page to 3 (limit=3) and offset by 12 (3 × first four pages). This returns the 13th, 14th, and 15th records from the make list.

curl -H "Authorization: Bearer {access-token}" \
  "https://api.redbookdirect.com/v1/au/car/Makes?limit=2&offset=12"
{
  "limit": 2,
  "offset": 12,
  "currentCount": 2,
  "totalCount": 230,
  "_links": {
    "self": "/v1/au/car/Makes?limit=3&offset=12",
    "first": "/v1/au/car/Makes?limit=3&offset=0",
    "prev": "/v1/au/car/Makes?limit=3&offset=10",
    "next": "/v1/au/car/Makes?limit=3&offset=14",
    "last": "/v1/au/car/Makes?limit=3&offset=228"
  },
  "results": [
    {
      "id": 2000,
      "name": "Amilcar",
      "startyear": 1926,
      "latestyear": 1926,
      "vehiclecount": 1,
      "_links": {
        "self": "/v1/au/car/Makes/2000",
        "families": "/v1/au/car/Families?makeid=2000"
      }
    },
    {
      "id": 6945,
      "name": "Amphicar",
      "startyear": 1966,
      "latestyear": 1966,
      "vehiclecount": 1,
      "_links": {
        "self": "/v1/au/car/Makes/6945",
        "families": "/v1/au/car/Families?makeid=6945"
      }
    }
  ]
}

The _links object provides ready-made first, prev, next and last URLs so you can navigate between pages without constructing the offsets yourself.