# Pagination
All resources coming in bulk are paginated when using Sender API.
Paginated response contains and object with 4 attributes: data
, links
, meta
and has_more_resources
.
# data
Under data attribute you will find an array of requested resource objects.
# links
Under links attribute you will find an object of links for other requests.
An example of links would look like this:
{
"first": "https://app.sender.net/client-api/api/campaigns?page=1",
"last": "https://app.sender.net/client-api/api/campaigns?page=257",
"prev": null,
"next": "https://app.sender.net/client-api/api/campaigns?page=2"
}
# meta
Under meta attribute you will find more information on available pages.
Example meta attribute:
{
"current_page": 1,
"from": 1,
"last_page": 257,
"path": "https://app.sender.net/client-api/api/campaigns",
"per_page": 5,
"to": 5,
"total": 1282
}
Param | Value |
---|---|
current_page | Requested page |
from | From which item does the page start |
to | At which item does the page end |
last_page | Last page |
path | Request path |
per_page | Items shown per page |
total | Total amount of items |
# has_more_resources
Tells you if next page exists.
# Pagination parameters
You can give your own pagination parameters. Since all listed requests are using GET
HTTP method, we only accept route parameters.
# ?page
Which page would you like to see?
# ?limit
How many items per page would you like in your response?
# ?order
Which order should your data be displayed? Accepted values should be the key values from the resource data.
# ?direction
When using the pagination parameter ?order
you are allowed to specify in which direction should the data be displayed.
Accepted values are asc
or desc
, which stands for ascending or descending. The default value its desc
# Example
You can turn:
https://api.sender.net/v2/campaigns/
Into:
https://api.sender.net/v2/campaigns?page=5&limit=20&order=modified&direction=desc
To see campaigns from 81st to 100th, ordered by their last time modified with direction descending.
Last updated: 2024-11-21