By default, LogicMonitor’s API will return a max of 1000 responses for any query made. For example, if a request is made to get device information, you will only receive the first 1000 devices back with the fields requested as parameters.
Considering the above limitation, how would you retrieve properties for more than 1000 devices? To accomplish this, you’ll need to edit the query parameters of the script, which will apply to any programming language.
To return display name and ID for 2000 devices, the size and offset parameters are necessary, as shown next:
The above edited query will now additionally return the next 1000 devices. The size parameter can be changed as to limit the number of responses that are given at a time. For example, you could return the first 30 results instead of 1000 by setting size=30 in your request.
It is useful to retrieve the value for searchId from the first response and include it as a parameter in subsequent requests. The reason for this is that each time a request is made without specifying a searchId, a new search is performed and the results may appear in a different order each time. Over multiple requests using the offset parameter, this can cause items to appear multiple times, or not at all. By including the value for searchId, as shown next, you’re using the cached search results, ensuring that each offset request is working with the same result set.
$queryParams = "?filter=displayName~work&fields=displayName,id&size=1000&offset=1000&searchId=5bb3777c-aeb3-41cd-aad7-dfdba792c5f8"