Nodegrid RESTful API's: How to paginate requests

Nodegrid RESTful API's: How to paginate requests

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

Postman - return page 3



Python request - disable pagination

  1. url = 'https://{0}/api/v1/devices/table'.format(ip_addr)
  2.                 try:
  3.                         resp = requests.get(url = url,
  4.                                             headers = headers,
  5.                                             params = { "page": "0" },
  6.                                             verify = False,
  7.                                             timeout = 30)
  8.                 except Exception as e:
  9.                         print('Failed to get devices:', str(e))
  10.                         return None