Fortinet black logo

Pagination

Pagination

These are a series of pagination GET APIs that help with retrieving a large amount of data by paginating the results if you find that the regular GET APIs run too slowly. For instance:

api/v2/user?limit=200&page=MDAwMzZjMjctNjIxMi00YmUxLWIwMDgtOTMyNzNjZTcwMDdl

Where ‘limit’ specifies the number of entries per page (FTC supports 20, 100, 200, 500, and 1000 entries per page), and ‘page’ is the cursor for the next page. If ‘limit’ is not provided, FTC will default it to 500 per page; if ‘page’ is not provided, FTC will retrieve the very first page.

To maintain the current API response body format, we include all pagination information in the HTTP headers of the response as below:

link: <https://ftc.fortinet.com:8686/api/v2/user?limit=20&page=LWIwMD>; rel="next", < https://ftc.fortinet.com:8686/api/v2/user?limit=20&page=zZjMjctNjIx>; rel="previous

The following is an example of how you can retrieve the HTTP header in Python:

import requests
headers = {
   ‘Authorization’: ‘Bearer eyJ0ex*******Q6to’,
   ‘Content-Type’: ‘application/json’
} 
payload = {} 
resp = requests.request('get', 'https://ftc.fortinet.com:9696/api/v2/user?limit=200', headers=headers, json=payload, verify=False)
link_header = resp.headers.get('Link')

You can then use the contents of ‘link_header’ to retrieve the next or the preceding cursor.

Pagination

These are a series of pagination GET APIs that help with retrieving a large amount of data by paginating the results if you find that the regular GET APIs run too slowly. For instance:

api/v2/user?limit=200&page=MDAwMzZjMjctNjIxMi00YmUxLWIwMDgtOTMyNzNjZTcwMDdl

Where ‘limit’ specifies the number of entries per page (FTC supports 20, 100, 200, 500, and 1000 entries per page), and ‘page’ is the cursor for the next page. If ‘limit’ is not provided, FTC will default it to 500 per page; if ‘page’ is not provided, FTC will retrieve the very first page.

To maintain the current API response body format, we include all pagination information in the HTTP headers of the response as below:

link: <https://ftc.fortinet.com:8686/api/v2/user?limit=20&page=LWIwMD>; rel="next", < https://ftc.fortinet.com:8686/api/v2/user?limit=20&page=zZjMjctNjIx>; rel="previous

The following is an example of how you can retrieve the HTTP header in Python:

import requests
headers = {
   ‘Authorization’: ‘Bearer eyJ0ex*******Q6to’,
   ‘Content-Type’: ‘application/json’
} 
payload = {} 
resp = requests.request('get', 'https://ftc.fortinet.com:9696/api/v2/user?limit=200', headers=headers, json=payload, verify=False)
link_header = resp.headers.get('Link')

You can then use the contents of ‘link_header’ to retrieve the next or the preceding cursor.