Paging Result Data
Using the limit and offset parameters
When dealing with a potentially large set of metric data a common requirement of any application is to be able to perform paging. Paging (or pagination) splits the data across a number of pages. Most APMCS REST API operations that return a list of metric objects support paging. To page a long list of returned metric data, you can use the limit and offset query parameters:
Parameter | Description |
---|---|
limit | A positive integer value that specifies the maximum number of items returned. If no value is specified the server may override the value for performance reasons. The maximum value is 1000. |
offset | A non-negative integer value that specifies the index of the first item to be returned. If no offset value is specified then the default value of 0 is used. |
Simple paging can be achieved by specifying both the
limit and
offset query parameters. Note that the result set uses zero-based indexing, thus the
offset (or index) of the first element in the result set is 0. For example, to call the
GET method to get at most 20 server requests, starting from position 61 up to position 80 use the resource path:
/api/v1/requests?offset=60&limit=20
The returned result set will contain at most 20 items.
It is important to use the same since and until time range parameters as you page forward through the result data using the limit and offset parameters. If you change the time range values, even slightly, your retrieved pages may not contain data from consecutive result sets.