5.4.2 api switch status

The api/switch/status function returns the current switch statuses.

Service and Privileges Groups

  • Service group is Switch.

  • Privileges group is Switch Control.


Methods

  • GET

  • POST

Request

The request contains parameters in the URL (or in the application/x-www-form-urlencoded format when POST is used).


Table 1. Request Parameters
Parameter NameMandatoryExpected ValuesDefault ValueDescription

switch

No

Integer defining a switch (typically 1 to 4)

Defines which switch status will be returned. api/switch/caps can be used for obtaining the number of switches of a particular device. The status of switches is returned if this parameter is omitted.

holdTimeout

No


Defines the remaining switch hold time. The parameter is not displayed in the response if the timeout is not set or there is no switch hold timeout.


Example of a Request


URL: https://192.168.1.1/api/switch/status?switch=1
Response

The success response is in the application/json format. It contains two JSON keys success and result, which contains the key switches (status information on individual switches are in an Array of one to four elements).


Table 2. Response switches JSON Keys
KeyTypical Returned ValuesDescription

switch

Integer (typically 1 to 4)

Defines to which switch the status is related.

active

true or false

Defines the current state of the switch (true the switch is activated, false the switch is deactivated).

locked

true or false

Defines whether the switch is locked or not (true the switch is locked in deactivated position and cannot be operated, false the switch is unlocked and can be operated normally). Locking has the priority over holding the switch - i.e. when the switch is simultaneously locked and held, it is deactivated and cannot be operated.

held

true or false

Defines whether the switch is held or not (true the switch is held in activated position and cannot be operated, false the switch is released and can be operated normally). Locking has the priority over holding the switch i.e. when the switch is simultaneously locked and held, it is deactivated and cannot be operated.


Example of a Response

{ "success": true, "result": { "switches": [ { "switch": 1, "active": true, "locked": false, "held": true }, { "switch": 2, "active": true, "locked": false, "held": false }, { "switch": 3, "active": false, "locked": true, "held": true }, { "switch": 4, "active": false, "locked": true, "held": false } ] } }

There may occur various errors (e.g. missing mandatory parameter). Errors are returned in .json with a response code 200.