Pagination
Pagination is supported on a handful of API endpoints. The intent is to continue to roll out paging for all API endpoints where paging makes sense. This section will explain how paging is implemented in Raven APIs. Pagination support detailed will eventually be implemented consistently across all endpoints that support pagination.
Dispatch Pro follows many but not all of the REST API guidelines in the Microsoft REST API Guidelines.
Note, pagination is OPTIONAL for all endpoints.
There may be server-side limits to the number of records returned in a call. Each endpoint may have a different limit, for example an orders
endpoint may limit the result set to 20 orders whereas a fields
endpoint may return 100 fields. Refer to the endpoint Swagger documentation of each endpoint for information on the maximum number of records returned.
Requests
Dispatch Pro supports client-driven paging using $top
and $skip
query parameters.
The $top
parameter specifies the number of results to return and the $skip
parameter specifies the offset (page).
Optionally, a $count
parameter may be included to indicate the client requests the total count of records in the entire result set. The total count of records will be returned in the x-total-count
response header.
An example request is shown below.
GET https://dispatch.ravenslingshot.com/api/batches/active&top=25&$skip=2
GET https://dispatch.ravenslingshot.com/api/batches/active&top=25&$skip=2&$count=true
Responses
The response will contain the raw results, there is no envelope encapsulating the result set. In response headers, the Location
header will include the URL for the 'next' dataset, including the pagination parameters included in the original request.
An example of a request and response is shown below.
GET https://dispatch.ravenslingshot.com/api/batches/active&top=25&$skip=2
200 OK
Location: GET https://dispatch.ravenslingshot.com/api/batches/active&top=25&$skip=3
[
. . .
]
GET https://dispatch.ravenslingshot.com/api/batches/active&top=25&$skip=2&$count=true
200 OK
Location: GET https://dispatch.ravenslingshot.com/api/batches/active&top=25&$skip=3&$count=true
x-total-count: 100
[
. . .
]