Using the API
Pagination
We basically expose the pagination information all via header attributes, as follows:
key | eg. value | description |
---|---|---|
X-Total-Count | 123 | Information about the total records the query will return in total (all pages) |
Link | <https://api.bspk.com/api/extraction/v1/emails.json?page=2>; rel=‘next’, <https://api.bspk.com/api/extraction/v1/emails.json?page=18>; rel=‘last’ | Links for the last and next pages |
For example, let’s make a curl request to the messages API, to find out how many message we have for the client CLI1
:
The -I
parameter indicates that we only care about the headers, not the actual content. In examining the result, you’ll notice some information in the Link header that looks like this:
Since by default, all paginated queries start at page 1
, rel="last"
provides more information stating that the last page of results is on page 30
. Thus, we have 29
more pages of information about messages from client CLI1
that we can consume.
Important: Always rely on these link relations provided to you. Don’t try to guess or construct your own URL.