Pagination
Some endpoints may return large amount of results that generate excessive amount of internet traffic and server load. In order to reduce the amount of
results, these endpoints use paging mechanism, allowing them to return the results in pages. The size of the page is defined by the limit
query string
parameter. If this parameter is not explicitly set, the endpoint will return default amount of results that is specified for the limit
query string parameter
in the API reference.
For example, if there are 100 results and the limit
query string parameter is set to 50 results, the API will split the results on two pages and return
the first page with 50 results and with a paging cursor that leads to the second page of the remaining 50 results. An example of such request
performed via cURL will look as follows:
curl -isX GET -G https://eu2-cloud.acronis.com/api/policy_management/v4/policies \ --data "limit=50" \ -H "Authorization: Bearer <your token>"
When the next page with the results is available, the response will contain the after
page token and look as follows:
HTTP/1.1 200 OK Server: nginx Content-Type: application/json <other headers...> {"items":[...],"paging":{"cursors":{"after":"0A8AAAAAAAAAAA=="}}, ...}
In order to navigate to the next page, the endpoints may accept the after
query string parameter that must be used together with the limit
query string parameter. Note that the after
page token must be URL encoded:
curl -isX GET -G https://eu2-cloud.acronis.com/api/policy_management/v4/policies \ --data "limit=50" \ --data-urlencode "after=0A8AAAAAAAAAAA==" \ -H "Authorization: Bearer <your token>"
When you navigate to the next page of the results, the response will also contain the before
page token that allows you to return to the previous page
and look as follows:
HTTP/1.1 200 OK Server: nginx Content-Type: application/json <other headers...> {"items":[...],"paging":{"cursors":{"before":"AAAAAAAAAAAAAA=="}}, ...}
In order to navigate to the previous page, the endpoints may accept the before
query string parameter that must be used together with the limit
query string parameter. Note that the before
page token must be URL encoded:
curl -isX GET -G https://eu2-cloud.acronis.com/api/policy_management/v4/policies \ --data "limit=50" \ --data-urlencode "before=AAAAAAAAAAAAAA==" \ -H "Authorization: Bearer <your token>"