You can change the configuration settings for individual devices using the REST API. This capability is most useful for fine-tuning location IDs, as these can only be set in OTbase Asset Discovery, not in Asset Center.
In order to use this capability you must reference the network that the device is in using its network GUID that you can obtain using a GET
request.
Devices can be referenced by either
- their IP address,
- their host name, or
- their MAC address
The following parameters can be changed:
- locationId
- hwType
- hwVendor
- hwModel
- hwDescription
Note: that all parameters other than location ID are better set in OTbase Asset Center.
Setting parameters for one device only
If you intend to change only one device in a network, the simplest way to do so is to use a URL that is composed from the following components:
- Initial part with protocol, IP address or hostname of the Asset Discovery node, plus the port number used by the REST API (if using a port other than 443). Example:
https://192.168.0.20:44462
- the network GUID, preceded by the selector for the networks endpoint. Example:
/networks/AB233237-986B-4A6E-99AC-9B5D21AF4817
- the device reference (IP address, MAC address or host name), preceded by the selector for the devices endpoint. Example:
/devices/192.168.10.7
- name of the parameter that you want to change. Example:
locationId
.
A full URL will then look like this:
https://localhost:44462/networks/AB233237-986B-4A6E-99AC-9B5D21AF4817/devices/192.168.10.7/locationId
You can then pass the new value of the location identifier as the body of the PUT
call, using JSON format.
Setting parameters for multiple devices in a network
For setting parameters for multiple devices in a network, the following syntax is more convenient and allows you to do multiple settings in a single API call.
Instead of referencing a single device in your URL, you only reference the devices endpoint in your PUT
request. Example:
https://localhost:44462/networks/AB233237-986B-4A6E-99AC-9B5D21AF4817/devices
The device references and parameter settings are now all done in the body of the PUT
call, like this:
{
"192.168.10.7": {
"locationId": "LID1-4"
},
"192.168.10.8": {
"hwVendor": "My vendor who no longer is in business",
"hwType": "PLC",
"hwModel": "My obsolete hardware model name"
},
"192.168.10.9": {
"hwDescription": "My obsolete device",
"locationId": "LID2"
}
}
Comments
0 comments
Please sign in to leave a comment.