By default, ServiceNOW may cap returned data at 10,000 records. If so, it will paginate by returning a URI-encoded "Link" header containing a "first", "prev", "next", and "last" link, along with a total record count. Prev and next will be omitted if they are not applicable, and the Link header will be omitted completely if there is only one page.
If the Link header is present and contains the "next" link, that link should be traversed and added to the current inventory, until no next link is left. Otherwise, if your record count exceeds 10,000 one day, you will be in for a surprise.
I plan to try to address this and submit a PR.
Example (sorry about the long line):
HTTP/1.1 200 OK
Link: <https://xxxxxx.service-now.com/api/now/table/cmdb_ci_server?sysparm_exclude_reference_link=true&sysparm_query=sys_class_nameINcmdb_ci_linux_server%2Ccmdb_ci_win_server&sysparm_display_value=true&sysparm_fields=sys_class_name,name,os,fqdn,os_version,host_name,ip_address,manufacturer&sysparm_offset=0&sysparm_limit=10000>;rel="first",<https://xxxxxx.service-now.com/api/now/table/cmdb_ci_server?sysparm_exclude_reference_link=true&sysparm_query=sys_class_nameINcmdb_ci_linux_server%2Ccmdb_ci_win_server&sysparm_display_value=true&sysparm_fields=sys_class_name,name,os,fqdn,os_version,host_name,ip_address,manufacturer&sysparm_offset=10000&sysparm_limit=10000>;rel="next",<https://xxxxxx.service-now.com/api/now/table/cmdb_ci_server?sysparm_exclude_reference_link=true&sysparm_query=sys_class_nameINcmdb_ci_linux_server%2Ccmdb_ci_win_server&sysparm_display_value=true&sysparm_fields=sys_class_name,name,os,fqdn,os_version,host_name,ip_address,manufacturer&sysparm_offset=20000&sysparm_limit=10000>;rel="last"
X-Total-Count: 28124
By default, ServiceNOW may cap returned data at 10,000 records. If so, it will paginate by returning a URI-encoded "Link" header containing a "first", "prev", "next", and "last" link, along with a total record count. Prev and next will be omitted if they are not applicable, and the Link header will be omitted completely if there is only one page.
If the Link header is present and contains the "next" link, that link should be traversed and added to the current inventory, until no next link is left. Otherwise, if your record count exceeds 10,000 one day, you will be in for a surprise.
I plan to try to address this and submit a PR.
Example (sorry about the long line):