This functionality was first introduced in the Hillary release series. The specific methods described on this page work with Hillary R2 and later releases.
Prior to Hillary R1, the locations/target configuration could be created and edited via the iQSonar user interface, or optionally by uploading a CSV file. The facility to modify (add and remove) target configurations via the RestAPI was initially introduced in Hillary R1 and further refined in Hillary R2. At the time of writing, the facility to modify credentials is still restricted to CSV import or manual editing via the User Interface
Instructions
Target configuration via the RestAPI relies on data stored in the JSON file format, rather than CSV files. The data stored in the file is the same, but the format of the file is quite different. To edit a JSON file and text editor can be used (for example Notepad) but an editor specifically designed for use by Programmers (for example Notepad++) would be preferred.
The file is uploaded to the server using the HTTP PUT method (not a GET method) http://<youriqsonarinstance>/api/v1/targets where the body of the request contains the JSON data.
The response will contain a message containing the status of the request and a request_id to allow the user to monitor the request status - a large set of locations may take some time to be stored in the database.
This response will contain a message indicating the status of request. You can then query http://youriqsonarinstance/api/v1/targets/poststatus/{request_id}/ to see the result of your request.
Error rendering macro 'code': Invalid value specified for parameter 'firstline'{ "message": "Completed", "details": "", "request_id": "1" }
Status Message | Description |
---|---|
Queued | The RestAPI Request is queued |
Processing | The RestAPI Request is being processed |
Completed | The RestAPI Request has been successfully processed |
Error | There was a fatal error processing the RestAPI Request |
Invalid Request ID | The request_id is invalid. |
JSON Data file format
A tutorial on how to create JSON data files is beyond the scope of this article. For a full description of the JSON data format see the wikipedia page or the JSON.org website.
The JSON data file should contain the fields "Name" (the value MUST be "LOCATION TARGET"), "Version" (the value MUST BE "1.3")and "Locations", where the Locations field contains an array of locations.
Each Location should contain the following fields:
Field | Description | Can be empty? | Example or Possible Values |
---|---|---|---|
LocationPath | Name of the location. Sub-locations seperated by the pipe symbol "|" | NO | Sample|Node Sample|Node2|Leaf1 Sample|Node2|Leaf2 |
Target | What category of target is this (Either Application or Device) | NO | Device Application |
Type | What sub-type of target is this (What type of Device, or Which Application) | NO | See the list of valid target types |
The list of valid Device Target types is:
- "Hostname" (contains the hostname of a device),
- "Range" (contains an ip address range defined by a Start IP address and an End IP address)
- "Subnet" (contains an IP Address subnet, defined by a Start IP address and a netmask)
- "Single" (contains a single IP Address)
The list of valid Application Target types is:
- vCenter
- fill in the rest of these
Related articles