Pagination
Delay APIs adopt a pagination strategy similar to GitHub to ensure that API responses are manageable for both servers and clients. For instance, when you make a GET request to /workspaces/delay/members
, the API will return a specific subset of results, even if the actual dataset is much larger. This guide explains how to work with paginated responses, how to request additional pages, how to alter the number of items returned per page, and how to script the retrieval of multiple pages of results.
Inspiration Acknowledgment: The design of our API pagination is heavily inspired by GitHub's REST API. We hold immense respect for their contribution to the developer community.
Using link headers
Delay API responses include a link header when paginated. This header will not be present if the specific API endpoint doesn't support pagination or if all results fit into one page. You can inspect the link header either by using curl or by following the respective library's documentation if you are using one. Here's how to do it with curl:
A typical paginated response will have a link header similar to this:
The link header provides URLs for navigating through the dataset:
The URL for the previous page is marked with rel="prev".
The URL for the next page is marked with rel="next".
The URL for the last page is marked with rel="last".
The URL for the first page is marked with rel="first".
You can use these URLs to request additional pages of data:
Changing the number of items per page
You can adjust the number of items returned per page by using the per_page query parameter:
The per_page parameter will be included automatically in the link header, like so: