Skip to content
English
  • There are no suggestions because the search field is empty.

How do I use the API to add an SNMPv3 device with special characters in the passwords

The over-arching process can be found here:

https://docs.statseeker.com/hdi/run-discovery-via-the-api/

The API call from the documentation uses the example


[{"ipaddress":"10.116.3.4","manual_name":"MyNewDevice","ping_only":false,"version":3,"type":"SNMPv3","community":null,"auth_method":"sha512","auth_user":"SHAUsername","auth_pass":"myAuthPassword","priv_method":"aes256","priv_pass":"myPrivacyPassword","context":"context1"}]

It does not clarify what to do when special characters are used in the SNMPv3 passwords

Lets assume myAuthPassword and myPrivacyPassword

were my&uthP&ssword and myPr!v&cyP&ssword

In the above case, the ampersand will  need to be converted to the URL-encoded format whereas the ! will not

Characters such as

 "   %22
&    %26
/    %2f
=    %3d
?    &3f

are considered "reserved" in a URL with specific functions.
Passing them natively in the password will cause the API to decode them with the reserved function.

In the content of the API call, substitute the special character with its URL encoded format

The example will look like this:

[{"ipaddress":"10.116.3.4","manual_name":"MyNewDevice","ping_only":false,"version":3,"type":"SNMPv3","community":null,"auth_method":"sha512","auth_user":"SHAUsername","auth_pass":"my%26uthP%26ssword","priv_method":"aes256","priv_pass":"myPr!v%26cyP%26ssword","context":"context1"}]