What is paging?
Paging, or pagination, is used to split large groups of data into smaller response bodies.
For example, if you have 100,000 Contacts for your ‘List Contacts’ method, and you try to list them all in 1 response:
- The API will take a long time to send the data.
- The client will take a long time to receive the data (and could potentially ‘timeout’ or break).
- You might not need all 100,000 contacts, in which case you have wasted data / cost.
With paging you can break the request and response into a series of smaller calls to collect all the data, making it faster and more manageable. This is entirely dependent on what an API recommends, and the size of each object.
For instance, if the API allows paging, you may be able to return 500 contacts per page. So that once you have received the first 500 contacts, you can then make a second call to get ‘Page 2’, the next 500 contacts.
This way, each response body is a reasonable size, has less risk of timeout errors, and it gives you the option to choose how many pages you want to receive.