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, or
- fieldbus address in case of fieldbus devices
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, e.g.:
"LID1-4"
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"
}
}
Setting protocol parameters for devices
You can also change protocol configuration per device:
- SNMP
- WINRM
- WMI
- SSH
- MODBUS
- EIP
- PROFINET
- ROC
- BACNET
- MELSEC
- TCADS
- HTTP
- TELNET
- FTP
Protocols can be "enabled", "disabled", or set to use the settings defined on "network" level. If you want to disabled FTP on device 192.168.10.7 you would need to send a PUT request to the following URL
https://localhost:44462/networks/AB233237-986B-4A6E-99AC-9B5D21AF4817/devices/192.168.10.7/FTP/enabled
You can then pass the value "disabled" as the body of the PUT
request, using JSON format, e.g.:
"disabled"
"enabled" and "network" work accordingly.
The following protocols have credentials that can be set via REST API:
- SNMP
- WINRM
- WMI
- SSH
- MODBUS
- BACNET
- ROC
You can enable credentials to be set on device level for device 192.168.10.7 via URL:
s://localhost:44462/networks/AB233237-986B-4A6E-99AC-9B5D21AF4817/devices/192.168.10.7/WMI/credentials
You can then pass the value "device" as the body of the PUT
request, using JSON format, e.g.:
"device"
This will allow you to set the device-specific credentials for WMI. You can also use "global" to use the global credentials or "network" to use the network's credentials.
For below credentials you can set username and password via REST API:
- WINRM
- WMI
- SSH
Again, you simply send a PUT request to an URL with the username or password in the request's body, e.g.:
s://localhost:44462/networks/AB233237-986B-4A6E-99AC-9B5D21AF4817/devices/192.168.10.7/SSH/username
You can then pass the new username as the body of the PUT
request, using JSON format, e.g.:
"my-account"
Setting the password work accordingly.
In general, all parameters visible in the Probing section in the Discovery Client for a given device, can be configured via REST API as shown above. The parameter name in the REST API follow a specific naming scheme, i.e., all parameters are camel-cased, while the first char remains in lower case.
- Enabled => enabled
- CertValidation => certValidation
- SSL => ssl
The only exception is "CheckCRC" from the ROC protocol which is translated to "checkCRC" in the REST API.
Comments
0 comments
Please sign in to leave a comment.