Hello, we have a requirement to be able to push Nodes into the system via REST API. We are running 12.2.
I'm running a POST command against this URL: https://<myserver>:17778/SolarWinds/InformationService/v3/Json/Create/Orion.Nodes
Here is the Body:
{
"ObjectSubType": "SNMP",
"IPAddress": "XXX.XXX.XXX.XXX",
"IPAddressType": "IPv4",
"DynamicIP": false,
"NodeDescription": "",
"Description": "Cisco Catalyst 38xx stack",
"SysName": "<sysname>",
"IOSImage": "",
"IOSVersion": "",
"Vendor": "Cisco",
"Icon": "9.gif ",
"Location": <location>"",
"Contact": "<contact>",
"CMTS": "N",
"SNMPVersion": 3,
"EngineID": 1,
"Status": 1,
"NodeName": "<nodename>",
"Allow64BitCounters": true,
"Community": "",
"EntityType": "Orion.Nodes",
"UnManaged": false,
"SNMPV3Username": "<user>",
"SNMPV3AuthMethod": "SHA1",
"SNMPV3PrivKey": "<privkey>",
"SNMPV3AuthKey": "<authkey>",
"SNMPV3PrivMethod": "AES128",
"RWSNMPV3Username": "<user>",
"RWSNMPV3PrivMethod": "AES128",
"RWSNMPV3PrivKey": <privkey>"",
"RWSNMPV3AuthMethod": "SHA1",
"RWSNMPV3AuthKey": ""authkey>",
"SNMPv3PrivKeyIsPwd": "true",
"SNMPv3AuthKeyIsPwd": "true",
"RWSNMPV3PrivKeyIsPwd": "true",
"RWSNMPV3AuthKeyIsPwd": "true"
}
When we try to run that we get the following response.
{
"Message": "Specified cast is not valid.",
"ExceptionType": "System.InvalidCastException",
"FullException": "System.InvalidCastException: Specified cast is not valid.\r\n
at SolarWinds.Data.Providers.Orion.Helpers.SnmpV3CredentialsHelper.UpdateNodesSnmpV3Credentials(Int32[] nodeIds, IDictionary`2 columnsToUpdate)\r\n
at SolarWinds.Data.Providers.Orion.CrudHandlers.NodeCrudHandler.Create(IEnumerable`1 infos, Func`2 baseCall)\r\n
at SolarWinds.InformationService.Addons.DataProvider.d__62.MoveNext()\r\n
at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection)\r\n
at SolarWinds.InformationService.Core.CrudProcessor.d__21.MoveNext()\r\n
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)\r\n
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)\r\n
at SolarWinds.InformationService.Core.CrudProcessor.d__18.MoveNext()\r\n
at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)\r\n
at SolarWinds.InformationService.Core.CrudProcessor.Create(String entityType, IDictionary`2 properties, IQueryExecutionContext context)\r\n
at SolarWinds.InformationService.Core.InformationService.Create(String entityType, IDictionary`2 properties)"
}
If we take out the "SNMPv3PrivKeyIsPwd": "true", "SNMPv3AuthKeyIsPwd": "true", "RWSNMPV3PrivKeyIsPwd": "true", & "RWSNMPV3AuthKeyIsPwd": "true" the node will create successfully but all the Key fields are checked by default and we do not want that.
If we try to run an update action to SNMPv3Credentials form using a post action to this URL: https://<myserver>:17778/SolarWinds/InformationService/v3/Json/swis://<myserver>/Orion/Orion.Nodes/NodeID=154/SNMPv3Credentials
With this Body:
{
"AuthenticationKeyIsPassword": "true",
"PrivacyKeyIsPassword": "true",
"RWAuthenticationKeyIsPassword": "true",
"RWPrivacyKeyIsPassword": "true"
}
Then we get this error:
{
"Message": "Specified cast is not valid.",
"ExceptionType": "System.InvalidCastException",
"FullException": "System.InvalidCastException: Specified cast is not valid.\r\n
at SolarWinds.Data.Providers.Orion.Helpers.SnmpV3CredentialsHelper.UpdateNodesSnmpV3Credentials(Int32[] nodeIds, IDictionary`2 columnsToUpdate)\r\n
at SolarWinds.Data.Providers.Orion.OrionDataProvider.Update(IStorageElement storage, IDictionary`2[] keyColumnsList, IDictionary`2 columnsToUpdate)\r\n
at SolarWinds.InformationService.Core.CrudProcessor.UpdateInternal(Boolean bulkMode, SwisUriResolver uriResolver, IDictionary`2 propertiesToUpdate, IQueryExecutionContext context)\r\n
at SolarWinds.InformationService.Core.CrudProcessor.Update(SwisUri uri, IDictionary`2 propertiesToUpdate, IQueryExecutionContext context)\r\n
at SolarWinds.InformationService.Core.InformationService.Update(String uri, IDictionary`2 propertiesToUpdate)"
}
If I try to modify different fields on that SNMPv3Credentials form, like PrivacyMethod or RWPrivacyMethod on their own then those will change fine.
I assume I'm missing something simple somewhere but maybe I'm totally wrong. Any ideas?