Device Control

Last Updated on : 2023-01-12 07:15:51download

Device control APIs

Request method API Description
POST /v1.0/iot-02/building/device/actions/control-dp Control a single device
POST /v1.0/iot-02/building/devices/actions/control-multi-devices Control multiple devices

Control a single device

Functional description

Control a single device.

API endpoint

POST /v1.0/iot-02/building/device/actions/control-dp

Request parameters

Parameter Type Parameter type Description Required
projectId String body The project ID. false
deviceId String body The device ID. false
dpCode String body The code of a data point. false
dpValue String body The value of a data point. false

Return parameters

Parameter Type Description
code Integer The response code. For more information, see the error code section. It is empty if the request is successful.
success Boolean Indicates whether the operation is successful. Valid values:
  • true: succeeded.
  • false: failed.
msg String The message that is returned if the request failed. The response is empty if the request is successful.
t Long The returned 13-digit timestamp.
result Object The returned result.

Description of result

boolean{}

Sample request

{
    "projectId":"1424615984265764***",
    "deviceIds":"vdevo163722119881***",
    "dpCode": "humidity_supply",
    "dpValue": "5000"

}

Sample response

boolean{}

Control multiple devices

Functional description

Control multiple devices in one operation.

API endpoint

POST /v1.0/iot-02/building/devices/actions/control-multi-devices

Request parameters

Parameter Type Parameter type Description Required
projectId String body The project ID. false
dpCode String body The code of a data point. false
dpValue String body The value of a data point. false
deviceIds List《String》 body The list of device IDs. false

Return parameters

Parameter Type Description
code Integer The response code. For more information, see the error code section. It is empty if the request is successful.
success Boolean Indicates whether the operation is successful. Valid values:
  • true: succeeded.
  • false: failed.
msg String The message that is returned if the request failed. The response is empty if the request is successful.
t Long The returned 13-digit timestamp.
result Object The returned result.

Description of result

boolean{}

Sample request

{
    "projectId":"1424615984265764***",
    "deviceIds":[
        "vdevo163722119881***"
    ],
    "dpCode": "humidity_supply",
    "dpValue": "5000"
}

Sample response

boolean{}

Error code

The following table lists common error codes for the API calls. For more error codes, see Global Error Codes.

Error code Description
500 A system error has occurred while processing your request.