This guide will be removed on April 29, 2022. Please use our new, easier-to-use Toast technical documentation site. All updated content is on the new site.

How to use a fixed page size paginated response

To use the paginated response of a Toast API endpoint that uses a fixed page size, make a GET request to the endpoint. Inspect the Toast-Total-Result-Count HTTP header field in the response to determine the total number of objects the endpoint will return.

In subsequent requests, use the pageSize and page query parameters to specify the number of objects to return per page and the sequence number of the page to return, respectively.

Toast API endpoints that paginate responses to control the size of response data also return URLs for the first, adjacent, and last sets of objects in the Link HTTP header fields, as described in the proposed Internet Engineering Task Force (IETF) web linking standard. The value of the rel parameter in the Link field indicates the relationship of the URL to the current set of objects.

The following example shows Link header fields in a Toast API response.

Link header fields with pagination information

Link: <https://[toast-api-hostname]/config/v2/menus?pageSize=1>; rel="first"1
Link: <https://[toast-api-hostname]/config/v2/menus?pageSize=1&page=5>; rel="self"2
Link: <https://[toast-api-hostname]/config/v2/menus?pageSize=1&page=4>; rel="prev"3
Link: <https://[toast-api-hostname]/config/v2/menus?pageSize=1&page=6>; rel="next"4
Link: <https://[toast-api-hostname]/config/v2/menus?pageSize=1&page=10>; rel="last"5

1

The URL and query parameters that will return the first set of objects available from the API endpoint.

2

The URL and query parameters that will return the current set of objects from the API endpoint.

3

The URL and query parameters that will return the set of objects immediately preceding the current set from the API endpoint.

4

The URL and query parameters that will return the first set of objects immediately after the current set from the API endpoint.

5

The URL and query parameters that will return the last set of objects available from the API endpoint.