Note: You should update any bookmarks to point to https://kb.filewave.com We will be working on links from FW Central/Anywhere that still come to this Atlassian site over the next couple of releases and then phasing out this site entirely in Jan 2024.
Using the RESTful API to limit, sort, and offset values returned
PROBLEM
When utilizing FileWave's RESTful API to extract inventory information, you may find the need to limit the values returned, sort the data, or return results that are offset by a certain number of values.
ENVIRONMENT
FileWave RESTful API
RESOLUTION
Limit Values
Syntax required to limit the number of values returned in a query to a value of 25:
curl -s -k -H "Authorization: not_the_real_key_here" https://<your_server_fqdn>:20443/inv/api/v1/query_result/<queryID>?limit=25 | python -mjson.tool
Of course, you can modify the number of values returned to any number that you like.
Sort Values
You can also sort the results of data returned based on the <column_name> value. For example, to sort the results returned by "device name", ascending:
curl -s -k -H "Authorization: not_the_real_key_here" https://<your_server_fqdn>:20443/inv/api/v1/query_result/<queryID>?sort=device_name | python -mjson.tool
To do the same sort, but in descending order (note the "-" in front of the column name):
curl -s -k -H "Authorization: not_the_real_key_here" https://<your_server_fqdn>:20443/inv/api/v1/query_result/<queryID>?sort=-device_name | python -mjson.tool
Offset Values
In order to return only a subset of results, offset by some initial number of values returned, you can apply the below syntax:
curl -s -k -H "Authorization: not_the_real_key_here" https://<your_server_fqdn>:20443/inv/api/v1/query_result/<queryID>?offset=300 | python -mjson.tool
The above example will return all values, starting from the 300th value.