Universal switch interface
General switch control is a logical function of the GVP platform, not a specific device. GVP provides query and control interfaces for general switches, and third-party platforms should use the relevant interfaces according to business needs.
1. Obtain single or all universal switch data
*Request interface example *, 192.168.1.108 is the IP address of the computer where the GVP server is located. Please adjust it according to the actual situation
http://192.168.1.108:8008/api/?HDLRequest=GetCommonSwitchStatus
*Request method *: POST
*Interface address *: /app/? HDLRequest=GetCommonSwitchStatus
*Request data type *: application/json
*Response data type *: application/json
*Interface Description *: Retrieve data for a single or all universal switches
*Headers * parameter
| Key | Value | Description |
|---|---|---|
| Authorization | Token Value | The Token value obtained upon successful login. If it expires, please log in again |
Request parameters
| Field | Type | Required | Description |
|---|---|---|---|
| DeviceGuid | String | true | Unique UID controlled by a universal switch. When the value is "all", it retrieves information about all universal switches. Otherwise, it retrieves information about a single universal switch specified by the UID |
*Request example *, but the string must be encrypted using an encryption method before submission
{"DeviceGuid":"all"}
*Response Parameters *:
| Field | Type | Description |
|---|---|---|
| Reply Code | String | Response Code |
| ReplyMessage | String | Response message prompt |
| ReplyDataType | Integer | Response data type, can be ignored |
| ReplyObject | Array< Object> | Response data, detailed information refer to example explanation |
*Response Example *:
{
"ReplyCode": "Success",
Reply Message ":" Successful ",
"ReplyDataType": 0,
"ReplyObject": [
{
"DeviceGuid": "464f6edd-bb72-437f-9b2f-567a60db8f3d", //Unique UID for universal switch information
DeviceName ":" Logic Control 1 ",//Name of the universal switch control
"DeviceType": 25600, //Function type: 25600 universal switch control
"DeviceOnlineState": 1, //Online status: 2 faults, 1 online
"CommonSwitchStatus": 1, //Universal switch status: 0 closed, 1 open
RegionName ":" Hedong Enterprise → Tianhe Office → First Floor → Large Conference Room "//Hierarchical information of the area where the universal switch control is located
},
{
"DeviceGuid": "b4e0fc9e-2754-4b9f-840f-a471eba1d4cc", //Unique UID for universal switch information
DeviceName ":" Logical Control 2 ",//Name of the universal switch control
"DeviceType": 25600, //Function type: 25600 universal switch control
"DeviceOnlineState": 1, //Online status: 2 faults, 1 online
"CommonSwitchStatus": 0, //Universal switch status: 0 closed, 1 open
RegionName ":" Hedong Enterprise → Tianhe Office → First Floor → Large Conference Room "//Hierarchical information of the area where the universal switch control is located
}
],
"TotalRowCount": 0,
"AlarmCount": 0,
"PageCount": 0
}
2. Control the universal switch function
*Request interface example *, 192.168.1.108 is the IP address of the computer where the GVP server is located. Please adjust it according to the actual situation
http://192.168.1.108:8008/api/?HDLRequest=ControlCommonSwitch
*Request method *: POST
*Interface address *: /app/? HDLRequest=ControlCommonSwitch
*Request data type *: application/json
*Response data type *: application/json
*Interface Description *: Interface for controlling universal switch numbers, specifying a single universal switch function point for control
*Headers * parameter
| Key | Value | Description |
|---|---|---|
| Authorization | Token Value | The Token value obtained upon successful login. If it expires, please log in again |
Request parameters
| Field | Type | Required | Description |
|---|---|---|---|
| DeviceGuid | String | true | Universal Switch Number Unique Guid |
| CommonSwitchStatus | int | true | Universal switch action type, 0 closed, 1 open |
*Request example *, but the string must be encrypted using an encryption method before submission
{"DeviceGuid":"","CommonSwitchStatus":0}
*Response Parameters *:
| Field | Type | Description |
|---|---|---|
| Reply Code | String | Response Code |
| ReplyMessage | String | Response message prompt |
| ReplyDataType | Integer | Response data type, can be ignored |
| ReplyObject | Array | Response data, please refer to the example explanation for detailed information |
*Response success example *:
{
"ReplyCode": "Success",
Reply Message ":" Successful ",
"ReplyDataType": 0,
"ReplyObject": {},
"TotalRowCount": 0,
"AlarmCount": 0,
"PageCount": 0
}