5.4.1 api switch caps
The /api/switch/caps function returns the current switch settings and control options. Define the switch in the optional switch parameter. If the switch parameter is not included, settings of all the switches are returned.
The function is part of the Switch service and the user must be assigned the Switch Monitoring privilege for authentication if required.
The GET or POST method can be used for this function.
Request parameters:
Parameter | Description |
---|---|
switch | Optional switch identifier (typically, 1 to 4) |
The reply is in the application/json format and includes a switch list (switches) including current settings. If the switch parameter is used, the switches field includes just one item.
Parameter | Description |
---|---|
switch | Switch Id (1 to 4) |
enabled | Switch control enabled in the configuration web interface |
mode | Selected switch mode (monostable, bistable) |
switchOnDuration | Switch activation time in seconds (for monostable mode only) |
type | Switch type (normal, security) |
Example:
GET /api/switch/caps { "success" : true, "result" : { "switches" : [ { "switch" : 1, "enabled" : true, "mode" : "monostable", "switchOnDuration" : 5, "type" : "normal" }, { "switch" : 2, "enabled" : true, "mode" : "monostable", "switchOnDuration" : 5, "type" : "normal" }, { "switch" : 3, "enabled" : false }, { "switch" : 4, "enabled" : false } ] } }