Pagination

Size Parameter

By default, list endpoints return a maximum of 20 records per page. You can change the number of records on a per-request basis, by passing a size parameter in the request URL parameters. The supported values for size are: 10, 20, 50, 100 and 200.

https://a.eztexting.com/v1/conversations?size=50

Page Parameter

When the response exceeds the size value, you can paginate through the records by increasing the page parameter with each iteration.

https://a.eztexting.com/v1/conversations?size=50&page=2

The above example will return 50 records, beginning with record 51 (page 2).

Page Response Structure

Each paged response returns content data elements as well as some paging context.

Consider the following example, where we set the page size to 10:

curl "https://a.eztexting.com/v1/conversations?size=10"
{
  "content" : {
  	... data ...
  },
  "pageable":{
    "pageNumber": 0,
    "pageSize": 10,
    "offset": 0,
  },
  "totalPages": 5,
  "totalElements": 50,
  "numberOfElements": 10,
  "last": false,
  "first": true
}

The following example shows what happens when we fetch the next page:

curl "https://a.eztexting.com/v1/conversations?page=1&size=10"
{
  "content" : {
	... data ...
  },
  "pageable":{
    "pageNumber": 1,
    "pageSize": 10,
    "offset": 10,
  },
  "totalPages": 5,
  "totalElements": 50,
  "numberOfElements": 10,
  "last": false,
  "first": false
}

Sort Parameter

To have your results sorted on a particular property, add a sort parameter to the request URL, with the name of the property on which you want to sort the results. You can control the direction of the sort by appending a comma (,) to the the property name plus either asc or desc.

curl -v "https://a.eztexting.com/v1/conversations?sort=campaignId,desc"

What’s Next