Skip to main content

Pagination

Pagination is supported on a handful of API endpoints.

The intent is to continue to roll out support for all API endpoints where pagination makes sense. This section will explain how pagination is implemented. The support detailed here will be implemented consistently across all endpoints that support pagination.

AgSync follows many, but not all of the REST API guidelines in the Microsoft REST API Guidelines.

Note the following:

  • Pagination is optional for all endpoints where it is supported.
  • 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 for each endpoint for information on the maximum number of records returned.

Requests

AgSync 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 when 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.

Example

GET https://dispatch.agsync.com/api/blends&top=25&$skip=2

GET https://dispatch.agsync.com/api/blends&top=25&$skip=2&$count=true

Responses

The response will contain raw results, that is, there is no envelope encapsulating the result set.

In the response headers, the Location header will include the URL for the next dataset, which includes the pagination parameters that are part of the original request.

Example

GET https://dispatch.agsync.com/api/blends&top=25&$skip=2

200 OK
Location: GET https://dispatch.agsync.com/api/blends?$top=25&skip=3

[
...
]


GET https://dispatch.agsync.com/api/blends&top=25&$skip=2&$count=true

200 OK
Location: GET https://dispatch.agsync.com/api/blends?$top=25&skip=3&count=true
x-total-count: 100
[
...
]