Some requests result in responses that contain many records. For example, the request for the list of all persons can match hundreds or thousands of persons.
To limit the number of records returned, some of the APIs support the limit and offset query parameters. These parameters allow you to get successive sets of records in successive responses. Specifically, use these query parameters to do the following:
-
Limit the number of records returned in the response to a number you choose, using the query parameter limit.
For example, the following request returns the first 50 persons:
https://<Hostname>/AppServer/api/entities/person?&limit=50
-
Specify the index of the first record to return in the response, using the query parameter offset.
The value is zero-based. For example, the following request returns 50 persons, starting with the 101st person:
https://<Hostname>/AppServer/api/entities/person?&limit=50&offset=100
The offset parameter defaults to 0. Therefore, both of the following requests return 50 devices, starting with the first device:
https://<Hostname>/AppServer/api/entities/person?&limit=50&offset=0
https://<Hostname>/AppServer/api/entities/person?&limit=50
Therefore, to get successive sets of records in successive responses, increase the offset value by the limit value in each request. For example:
https://<Hostname>/AppServer/api/entities/person?&limit=50&offset=0
https://<Hostname>/AppServer/api/entities/person?&limit=50&offset=50
https://<Hostname>/AppServer/api/entities/person?&limit=50&offset=100
The following table summarizes the limit and offset query parameters.
Query parameter |
Description |
Default value |
---|---|---|
limit |
Maximum number of records to show in the response. |
0 |
offset |
Zero-based index of first record to show in the response. |
0 |