Nodegrid's RESTful API's: How to paginate requests
Nodegrid's RESTful API's support pagination. Pagination is used to break down larger datasets into smaller pages. Each page is then requested separately. This helps to improve the system performance.
Pagination is enabled by default for all API requests, this means only the first page is returned by default. This behaviour can be changed using the Query Parameters and setting the page value.
page value
| result
|
0
| disable pagination
|
1
| return the first page (default)
|
2-n
| return page 2 to n
|
Examples
- url = 'https://{0}/api/v1/devices/table'.format(ip_addr)
-
try:
-
resp = requests.get(url = url,
-
headers = headers,
-
params = { "page": "0" },
-
verify = False,
-
timeout = 30)
-
except Exception as e:
-
print('Failed to get devices:', str(e))
-
return None