Pagination
Some endpoints that return a list of items use pagination to ensure fast response times for all API clients. Below is an example of how pagination is used when listing all people in the access control system.
Request
Paginated requests can be customized using the page
and per_page
query string parameters.
GET https://panel-{{panel_id}}.pdk.io/api/persons?page=3&per_page=10 HTTP/1.1
Authorization: Bearer {{panel_token}}
Parameter | Location | Type | Required | Description |
---|---|---|---|---|
panel_id | Path | String | Yes | The cloud node serial number. |
page | Query | Integer | No | The zero-based page number. The default value is 0. |
per_page | Query | Integer | No | The number of items per page. The default value is 10 and the maximum value is 100. |
panel_token | Header | String | Yes | A valid panel token. |
Response
Paginated responses will include the Link
and X-Total-Count
headers.
HTTP/1.1 200 OK
Content-Type: application/json
Link: <https://panel-{{panel_id}}.pdk.io:443/api/persons?per_page=20>; rel="first", <https://panel-{{panel_id}}.pdk.io:443/api/persons?page=2&per_page=20>; rel="prev", <https://panel-{{panel_id}}.pdk.io:443/api/persons?page=4&per_page=20>; rel="next", <https://panel-{{panel_id}}.pdk.io:443/api/persons?page=10&per_page=20>; rel="last"
X-Total-Count: 123
...
Header | Description |
---|---|
Link | A comma-delimited list of first , prev , next , and last links. |
X-Total-Count | The total number of items. |