I am attempting to create an element via the API and am getting the following response:
{
"Message": "Invalid port configuration: expected SNMPV2/SNMPV3-Serial but received SNMPV2.",
"StackTrace": "",
"ExceptionType": "Skyline.DataMiner.Web.Common.WebApiException"
}
This is the POST request, which matches the syntax outlined here https://docs.dataminer.services/develop/webservices/WS_v1/WS_About_v1/WS_v1_examples.html#createelement-request-1
POST https://dataminer-agent1/API/v1/Json.asmx/CreateElement
Content-Type: application/json
{
"connection": "xxxxxxxxxxxxxxxxxx",
"dmaID": 127911,
"viewIDs": [72],
"configuration": {
"Name": "test device",
"ProtocolName": "Linux Platform",
"ProtocolVersion": "Production",
"Ports": [
{ "__type": "Skyline.DataMiner.Web.Common.v1.DMAElementSNMPPortInfo", "IPAddress": "xxx.xx.xxx.xxx", "GetCommunity": "public", "SetCommunity": "private", "PortNumber": 161 }
]
}
}
Hi Oscar,
Can you try the following request:
{
"connection": "YourConnectionId",
"dmaID": 127911,
"viewIDs": [
72
],
"configuration": {
"Name": "TEST_ELEMENT",
"ProtocolName": "Linux Platform",
"ProtocolVersion": "Production",
"Ports": [
{
"__type": "Skyline.DataMiner.Web.Common.v1.DMAElementSNMPPortInfo",
"SNMPVersion": 2,
"DeviceAddress": "",
"GetCommunity": "public",
"IPAddress": "127.0.0.1",
"Network": "0",
"PortNumber": 161,
"SetCommunity": "private",
"ElementTimeoutTime": 30000,
"TimeoutTime": 1500,
"Retries": 3
},
{
"__type": "Skyline.DataMiner.Web.Common.v1.DMAElementSerialPortInfo",
"Baudrate": 0,
"BusAddress": "",
"Databits": 0,
"FlowControl": "No",
"IPAddress": "127.0.0.1",
"IPPort": 22,
"LocalIPPort": 0,
"Network": "0",
"Parity": "No",
"SerialPort": "0",
"Stopbits": 0,
"Type": "TCP",
"ElementTimeoutTime": 30000,
"TimeoutTime": 1500,
"Retries": 3
}
] }
}
Don't forget to change the IP addresses, port and the community strings.
Hope it helps.
Hi Oscar,
Looking further into this, the port configuration you've created doesn't match the port configuration of the "Linux Platform protocol".
You need to have at least:
- 1 port config for SNMPV2/SNMPV3
- 1 port config for SSH
Ok, how are either of those specified, the docs only give the following port options: DMASerialPortInfo, DMAElementSNMPPortInfo,
DMAElementSNMPV3PortInfo. Which apply here? I can use all three but that gives
{
“Message”: “Invalid port configuration: expected SNMPV2/SNMPV3-Serial but received SNMPV2-SNMPV3-Serial.”,
“StackTrace”: “”,
“ExceptionType”: “Skyline.DataMiner.Web.Common.WebApiException”
}
Hi Oscar,
I'm not sure if this is related but in the example, they use "ElementName" instead of "Name"
If I use ElementName it gives the following error
{
“Message”: “Invalid element name: Name can not be null or empty.”,
“StackTrace”: “”,
“ExceptionType”: “Skyline.DataMiner.Web.Common.WebApiException”
}
Using both and Element Name and Name gives the original error I posted
Thanks Miguel, can confirm that this works.