API Query Variables & Options
Our goal is to make it as easy as possible for you to integrate Asset Manager with other applications in your security stack. Toward this end, we've made the Asset Manager Zone Data API and Asset Manager WADL available here on this Support site. Using these resources and the guidelines on this page, you should be able to write API calls that return the precise network data you require. We understand, however, that at times it can be difficult to write a perfect API call. Should you have trouble, contact your solutions architect for assistance. If at all possible, provide a precise description of the data you want to access (or post).
About Asset Manager APIs
- API queries to Asset Manager are not language-specific; you can use them with Perl, Java, Ruby or any other programming language.
- Asset Manager API calls currently support both JSON and XML return formats. Examples in this section were written in Java.
- API calls to Asset Manager must be received by Asset Manager over the standard, secure HTTPS port 443.
Query Variables
Every query has the following intrinsic variables:
- query.pagesize - The number of records to return in each request
- query.offset - Record at which to start
- query.page - Calculates
query.offset
by setting it toquery.page * query.pagesize
- fmt - Can be used instead of the Accept HTTP Header to specify the desired return type of the query. Add a semicolon and the word "pretty" after the format, to produce indented results.
Query Options
The rules for building queries are as follows:
- To add a filter to the query, a URL parameter of "
filter.<filter name>
" can be added to the request. - To add a detail return to the query, a URL parameter of "
detail.<detail name>
" can be added to the request. - To add a sort option, a URL parameter of "
sort.<sort name>
" can be added to the request.
Basic Curl
The basic syntax of curl is as follows:
curl -s -k -u username:password https://<server>/api/rest/
curl -s -k "https://<username>:<password>@<server>/api/rest"
For example, to run fetch device profiles
in JSON format for all devices with a device type of Router, you would need to call ZoneData.getDevices with the zone.id
filter set to 2, and the profile.deviceType
filter set to Router
and the format set to json
.
To make that call from the Unix command line using curl, enter this at the command prompt:
curl -s -k -u <username>:<password> "https://<server>/api/rest/zonedata/devices?fmt=json.pretty&filter.zone.id=2&detial.Protocol&query.pagesize=20&filter.profile.deviceType=Router"
To find out which SNMP strings worked in a discovery scenario, enter this at the Unix command prompt:
curl -s -k -u <username>:<password> "https://<server>/api/rest/zonedata/devices?fmt=json;pretty&detail.SnmpAlias&filter.zone.name=Asset ManagerInside"
To get certificate data out of the Asset Manager API, enter this at the Unix command-line prompt:
curl -s -k -u <username>:<password> "https://kenesi/api/res/zonedata/devices?fmt=json;pretty&detail.Certificate&filter.address.ip=172.18.1.242"