Setvar using JSON

Setvar using JSON

To do a
setvar
in SGD you use the format:
! U1 getvar "sgd.name" "value" ! U1 getvar "ip.port" "9200" ! U1 setvar "device.location" "my desk"
To set a variable value using JSON:
{}{"sgd.name":"value"}
sets the variable value to
"value" {}{"ip.port":"1234"}
sets the variable value to
"1234" {}{"device.location":"my desk"}
sets the variable value to
"my desk"
When you set an SGD value, it will return the value that was set, or the old value if the set failed. If:
{}{"sgd.name":"new_value"} fails, the variable value remains "old_value"
To set several values at once:
{}{"device.friendly_name":"XXQLJ120900310", "device.company_contact":"123‐555‐1212", "device.location":"My Desk"}
The response is:
{"device.friendly_name":"XXQLJ120900310", "device.company_contact":"123‐555‐1212", "device.location":"My Desk"}