APIs Related to Automation Management

Last Updated on : 2025-05-30 01:56:03download

Intelligent scene automation, by the user to set the conditions, when the conditions triggered automatically perform the set action. Doodle Cloud supports users to set device conditions according to real life scenarios. When the conditions are met, one or more devices will perform corresponding tasks.

API List

Request method API description
GET /v1.0/osaas/rooms/{room_id}/automations API for Querying the Automation List.
GET /v1.0/osaas/rooms/{room_id}/automations/{automation_id} API for Querying Automation Details.
GET /v1.0/osaas/rooms/{room_id}/automation/devices API for Querying the Support automation Device List.
GET /v1.0/osaas/linkage/rooms/{room_id}/devices/specifications API for Querying the Support Linkage Device Specification List.
GET /v1.0/osaas/linkage/devices/{device_id}/specifications API for Querying the Support Linkage Device Specification List.
POST /v1.0/osaas/rooms/{room_id}/automation API for Adding a Automation.
PUT /v1.0/osaas/rooms/{room_id}/automations/{automation_id} API for Modifying Automation.
DELETE /v1.0/osaas/rooms/{room_id}/automations/{automation_id} API for Deleting a Automation.
PUT /v1.0/osaas/rooms/{room_id}/automations/{automation_id}/enable API for Enabling a Automation.
PUT /v1.0/osaas/rooms/{room_id}/automations/{automation_id}/disable API for Disabling a Automation.

You can use this API to query the automation list

API Description

You can use this API to query the automation list.

API Address

GET /v1.0/osaas/rooms/{room_id}/automations

Request Parameters

Parameter Type Position Description Mandatory
room_id String URI Unique ID of a room. Yes

Response Parameters

Parameter Type Description
code Integer Response code.Null indicates success.
success Boolean Request result.
true: success
false: failure
msg String Exception message.It is null when the request result is success.
t Long Response time, which is a 13-digit timestamp.
result Array List of automation.

Parameters in result

Parameter Type Description
automation_id String Unique ID of a automation.
automation_name String Automation name.
enabled Boolean Enabled.
true: enabled
false: disable
conditions Array List of conditions.
preconditions Array List of preconditions.
actions Array List of actions.
condition_rule String Custom condition rules. When the match type is match_type=3, this parameter is required. The custom condition rules follow the AND/OR formula. Each automation condition uses its order_num as the identification code.
match_type Integer Match types:
1: Trigger when any condition is met.
2: Trigger when all conditions are met.
3: Trigger by the custom condition.
The logic operation parameter condition_rule must be set.

Parameters in result.conditions

Parameter Type Description
entity_type Integer Condition type. Currently, the following types are available: Device status condition: entity_type=1.
entity_id String Unique ID of a device.
display Object Display of conditions.
order_num Integer Conditional sorting, starting from 1.

Parameters in result.conditions.display

Parameter Type Description
code String The status code of the device.
operator String Operators. See Code data type and operator mapping description.
value Object Code value.

Parameters in result.preconditions

Predefined restrictions. Currently, it supports restrictions by time frame.

Parameter Type Description
cond_type String Currently, it only supports restrictions by time frame, which is fixed as timeCheck.
display Object Display of conditions.

Parameters in result.preconditions.display

Parameter Type Description
start String The start time in 24-hour clock. The default value is a certain time of the day. For example, 10:00.
end String The end time in 24-hour clock. For example, 22:00
loops String A 7-digit number consisting of 0 and 1. 0 means not to execute, and 1 means to execute. The first digit represents Sunday, and the following digits represent Monday to Saturday in turn. For example, 0011000 means to execute every Tuesday and Wednesday.
timezone_id String The ID of the time zone, for example, Asia/Shanghai

Parameters in result.actions

Parameter Type Description
entity_id String Unique ID of a device.
executor_property Object Action parameters.
action_executor String Action type,Currently only supports: dpIssue

Request Example

GET {url}/v1.0/osaas/rooms/12223333******/automations

Success Response Example

{ "result": [ { "actions": [ { "action_executor": "delay", "executor_property": { "hours": "0", "minutes": "0", "seconds": "5" } }, { "action_executor": "dpIssue", "entity_id": "vdevo15725982******", "executor_property": { "switch_1": true } }, { "action_executor": "externalAction" } ], "automation_id": "p2aWOkEOe******", "conditions": [ { "display": { "code": "switch_1", "operator": "==", "value": true }, "entity_id": "vdevo157259******", "entity_type": 1, "order_num": 1 } ], "enabled": true, "match_type": 1, "automation_name": "Test automatio" } ], "success": true, "t": 1572936751228 }

Failure Response Example

{ "code": 500, "msg": "system error,please contact the admin", "success": false, "t": 1561378856383 }

API for Querying Automation Details

API Description

You can use this API to query automation details.

API Address

GET /v1.0/osaas/rooms/{room_id}/automations/{automation_id}

Request Parameters

Parameter Type Position Description Mandatory
room_id String URI Unique ID of a room. Yes
automation_id String URI Unique ID of a automation. Yes

Response Parameters

Parameter Type Description
code Integer Response code.Null indicates success.
success Boolean Request result.
true: success
false: failure
msg String Exception message.It is null when the request result is success.
t Long Response time, which is a 13-digit timestamp.
result Object Result object.

Parameters in result

Parameter Type Description
automation_id String Unique ID of a automation.
automation_name String Automation name.
enabled Boolean Enabled.
true: enabled
false: disable
conditions Array List of conditions.
preconditions Array List of preconditions.
actions Array List of actions.
condition_rule String Custom condition rules. When the match type is match_type=3, this parameter is required. The custom condition rules follow the AND/OR formula. Each automation condition uses its order_num as the identification code.
match_type Integer Match types:
1: Trigger when any condition is met.
2: Trigger when all conditions are met.
3: Trigger by the custom condition.
The logic operation parameter condition_rule must be set.

Parameters in result.conditions

Parameter Type Description
entity_type Integer Condition type. Currently, the following types are available: Device status condition: entity_type=1.
entity_id String Unique ID of a device.
display Object Display of conditions.
order_num Integer Conditional sorting, starting from 1.

Parameters in result.conditions.display

Parameter Type Description
code String The status code of the device.
operator String Operators. See Code data type and operator mapping description.
value Object Code value.

Parameters in result.preconditions

Predefined restrictions. Currently, it supports restrictions by time frame.

Parameter Type Description
cond_type String Currently, it only supports restrictions by time frame, which is fixed as timeCheck.
display Object Display of conditions.

Parameters in result.preconditions.display

Parameter Type Description
start String The start time in 24-hour clock. The default value is a certain time of the day. For example, 10:00.
end String The end time in 24-hour clock. For example, 22:00
loops String A 7-digit number consisting of 0 and 1. 0 means not to execute, and 1 means to execute. The first digit represents Sunday, and the following digits represent Monday to Saturday in turn. For example, 0011000 means to execute every Tuesday and Wednesday.
timezone_id String The ID of the time zone, for example, Asia/Shanghai

Parameters in result.actions

Parameter Type Description
entity_id String Unique ID of a device.
executor_property Object Action parameters.
action_executor String Action type,Currently only supports: dpIssue.

Request Example

GET {url}/v1.0/osaas/rooms/122233******/automations/53IYSXI3g******

Success Response Example

{ "result": { "actions": [ { "action_executor": "delay", "executor_property": { "hours": "0", "minutes": "0", "seconds": "5" } }, { "action_executor": "dpIssue", "entity_id": "vdevo15725982******", "executor_property": { "switch_1": true } } ], "automation_id": "p2aWOkEOe******", "conditions": [ { "display": { "code": "switch_1", "operator": "==", "value": true }, "entity_id": "vdevo15725982******", "entity_type": 1, "order_num": 1 } ], "enabled": true, "match_type": 1, "automation_name": "Test automation" }, "success": true, "t": 1572936751228 }

Failure Response Example

{ "code": 500, "msg": "system error,please contact the admin", "success": false, "t": 1561378856383 }

API for Querying the Support automation Device List

API Description

You can use this API to query the list of devices that support automation.

API Address

GET /v1.0/osaas/rooms/{room_id}/automation/devices

Request Parameters

Parameter Type Position Description Mandatory
room_id String URI Unique ID of a room Yes
page_no Integer URL Page number. The default value is 1. No
page_size Integer URL Number of records on a page, which is greater than 0 and less than 100. If this parameter is not set, the number is 20 by default. No
type string URL Supported types: condition: condition type action: action type No

Response Parameters

Parameter Type Description
code Integer Response code.Null indicates success.
success Boolean Request result.
true: success
false: failure
msg String Exception message.It is null when the request result is success.
t Long Response time, which is a 13-digit timestamp.
result Object Result object.

Parameters in result

Parameter Type Description
total int Total number of records.
page_no int Page number.
page_size int Number of records on a page.
devices Array List of devices.

Parameters in result.devices

Parameter Type Description
device_id String Unique ID of a device.
device_name String Device name.
product_id String Unique ID of a product.

Request Example

GET {url}/v1.0/osaas/rooms/122233331******/automation/devices?page_no=1&page_size=20

Success Response Example

{ "result": { "total": 1, "page_no": 1, "page_size": 20, "devices": [ { "device_id": "vedo123******", "device_name": "Test Device", "product_id": "r456754******" } ] }, "success": true, "t": 1572936751228 }

Failure Response Example

{ "code": 500, "msg": "system error,please contact the admin", "success": false, "t": 1561378856383 }

API for Querying the Support Linkage Device Specification List

API Description

You can use this API to query the list of device specifications that support linkage based on the unique ID of the room.

API Address

GET /v1.0/osaas/linkage/rooms/{room_id}/devices/specifications

Request Parameters

Parameter Type Position Description Mandatory
room_id String URI Unique ID of a room Yes
page_no Integer URL Page number. The default value is 1. No
page_size Integer URL Number of records on a page, which is greater than 0 and less than 100. If this parameter is not set, the number is 20 by default. No

Response Parameters

Parameter Type Description
code Integer Response code.Null indicates success.
success Boolean Request result.
true: success
false: failure
msg String Exception message.It is null when the request result is success.
t Long Response time, which is a 13-digit timestamp.
result Object Result object.

Parameters in result

Parameter Type Description
device_id String Unique ID of a device.
functions Array List of functions, operation performed.
status Array List of status, the condition triggering operation.

Parameters in result.devices.functions

Parameter Type Description
code String Code of standard instructions sent.
type String Types of the sent data. Currently, the following three types are available: Boolean Integer Enum.
values Object value range.

Parameters in result.devices.status

Parameter Type Description
code String Code of standard statuses reported.
name String Status name.
type String Types of the reported data. Currently, the following three types are available: Boolean Integer Enum.
values Object value range.

Request Example

GET {url}/v1.0/osaas/linkage/rooms/12223******/devices/specifications?page_no=1&page_size=20

Success Response Example

{ "result": { "total": 1, "page_no": 1, "page_size": 20, "devices": [ { "device_id": "0120090568c******", "functions": [ { "name": "Brightness", "code": "bright_value", "type": "Integer", "values": { "max": 255, "min": 25, "scale": 0, "step": 1, "type": "value", "unit": "" } }, { "name": "Switch", "code": "switch_led", "type": "Boolean" } ], "status": [ { "name": "Mode", "code": "work_mode", "type": "Enum", "values": { "range": [ "white", "colour", "scene" ] } } ] } ] }, "success": true, "t": 1572936751228 }

Failure Response Example

{ "code": 500, "msg": "system error,please contact the admin", "success": false, "t": 1561378856383 }

API for Querying the Support Linkage Device Specification List

API Description

You can use this API to query the list of device specifications that support linkage based on the unique ID of the device.

API Address

GET /v1.0/osaas/linkage/devices/{device_id}/specifications

Request Parameters

Parameter Type Position Description Mandatory
device_id String URI Unique ID of a device. Yes

Response Parameters

Parameter Type Description
code Integer Response code.Null indicates success.
success Boolean Request result.
true: success
false: failure
msg String Exception message.It is null when the request result is success.
t Long Response time, which is a 13-digit timestamp.
result Object result object

Parameters in result

Parameter Type Description
functions Arrays List of functions, operation performed.
status Arrays List of status, the condition triggering operation

Parameters in result.functions

Parameter Type Description
code String Code of standard instructions sent.
name String functions name.
type String Types of the sent data. Currently, the following three types are available: Boolean Integer Enum.
values Object value range.

Parameters in result.status

Parameter Type Description
code String Code of standard statuses reported.
name String Status name.
type String Types of the reported data. Currently, the following three types are available: Boolean Integer Enum
values Object value range.

Request Example

GET {url}/v1.0/osaas/linkage/devices/12223******/specifications

Success Response Example

{ "result": [ { "device_id": "0120090568c63a89cb34", "functions": [ { "name": "Brightness", "code": "bright_value", "type": "Integer", "values": { "max": 255, "min": 25, "scale": 0, "step": 1, "type": "value", "unit": "" } }, { "name": "开关", "code": "switch_led", "type": "Boolean" } } ], "status": [ { "name": "模式", "code": "work_mode", "type": "Enum", "values": { "range": [ "white", "colour" ], "type": "Enum" } ] } ], "success": true, "t": 1572936751228 }

Failure Response Example

{ "code": 500, "msg": "system error,please contact the admin", "success": false, "t": 1561378856383 }

API for Adding a Automation

API Description

You can use this API to add a automation.

API Address

POST /v1.0/osaas/rooms/{room_id}/automation

Request Parameters

Parameter Type Position Description Mandatory
room_id String URI Unique ID of a room. Yes
automation_name String BODY Automation name. Yes
conditions Arrays BODY List of conditions. Yes
preconditions Arrays BODY List of preconditions. No
actions Arrays BODY List of actions. Yes
match_type Integer BODY Match types:
1: Trigger when any condition is met.
2: Trigger when all conditions are met.
3: Trigger by the custom condition.
The logic operation parameter condition_rule must be set.
Yes
condition_rule String BODY Custom condition rules. When the match type is match_type=3, this parameter is required. The custom condition rules follow the AND/OR formula. Each automation condition uses its order_num as the identification code No

Parameters in conditions

Parameter Type Position Description Mandatory
entity_type Integer BODY Condition type. Currently, the following types are available: Device status condition: entity_type=1 Yes
entity_id String BODY Unique ID of a device. Yes
display Object BODY Display of conditions Yes
order_num Integer BODY Conditional sorting, starting from 1. Yes

Parameters in conditions.display(Reference device supports linkage specifications status)

Parameter Type Position Description Mandatory
code String BODY The status code of the device. Yes
operator String BODY Operators. See Code data type and operator mapping description Yes
value Object BODY Code value Yes

Parameters in conditions.display.operator

type opertaor
String “==”
String “>”,“==”,“<”
String “==”

Parameters in preconditions

Predefined restrictions. Currently, it supports restrictions by time frame.

Parameter Type Description
cond_type String Currently, it only supports restrictions by time frame, which is fixed as timeCheck.
display Object Display of conditions.

Parameters in preconditions.display

Parameter Type Description
start String The start time in 24-hour clock. The default value is a certain time of the day. For example, 10:00.
end String The end time in 24-hour clock. For example, 22:00.
loops String A 7-digit number consisting of 0 and 1. 0 means not to execute, and 1 means to execute. The first digit represents Sunday, and the following digits represent Monday to Saturday in turn. For example, 0011000 means to execute every Tuesday and Wednesday.
timezone_id String The ID of the time zone, for example, Asia/Shanghai.

Parameters in actions

Parameter Type Description
entity_id String Unique ID of a device.
executor_property Object Action parameters
action_executor String Action type , Currently only supports: dpIssue

Parameters in actions.executor_property(Reference equipment supports linkage specifications functions)

key value
Function code Function value.

Response Parameters

Parameter Type Description
code Integer Response code.Null indicates success.
success Boolean Request result.
true: success
false: failure
msg String Exception message.It is null when the request result is success.
t Long Response time, which is a 13-digit timestamp.
result String Unique ID of a automation

Request Example

POST {url}/v1.0/osaas/rooms/12223******/automation
{ "conditions": [ { "display": { "code": "switch_1", "operator": "==", "value": true }, "entity_id": "vdevo15725982******", "entity_type": 1, "order_num": 1 } ], "actions": [ { "action_executor": "delay", "executor_property": { "hours": "0", "minutes": "0", "seconds": "5" } }, { "action_executor": "dpIssue", "entity_id": "vdevo15725982******", "executor_property": { "switch_1": true } } ], "match_type": 1, "automation_name": "Test automation" }

Example of preconditions

{ "preconditions": [ { "display": { "start": "10:00", "end": "12:00", "loops": "0010000", "timezone_id": "Asia/Shanghai" }, "cond_type": "timeCheck" } ] }

Example of device status conditions

{ "conditions": [ { "display": { "code": "switch_1", "operator": "==", "value": true }, "entity_id": "vdevo15725982******", "entity_type": 1, "order_num": 1 } ] }

Success Response Example

{ "success": true, "result": "1112382396505******", "t": 1566053034624 }

Failure Response Example

{ "code": 500, "msg": "system error,please contact the admin", "success": false, "t": 1561378856383 }

API for Modifying Automation

API Description

You can use this API to modify automation.

API Address

PUT /v1.0/osaas/rooms/{room_id}/automations/{automation_id}

Request Parameters

Parameter Type Position Description Mandatory
room_id String URI Unique ID of a room. Yes
automation_id String URI Unique ID of a automation. Yes
automation_name String BODY Automation name. Yes
conditions Arrays BODY List of conditions. Yes
preconditions Arrays BODY List of preconditions. Yes
actions Arrays BODY List of actions. Yes
match_type Integer BODY Match types:
1: Trigger when any condition is met.
2: Trigger when all conditions are met.
3: Trigger by the custom condition.
The logic operation parameter condition_rule must be set.
Yes
condition_rule String BODY Custom condition rules. When the match type is match_type=3, this parameter is required. The custom condition rules follow the AND/OR formula. Each automation condition uses its order_num as the identification code. No

Parameters in conditions

Parameter Type Position Description Mandatory
entity_type Integer BODY Condition type. Currently, the following types are available: Device status condition: entity_type=1 Yes
entity_id String BODY Unique ID of a device Yes
display Object BODY Display of conditions Yes
order_num Integer BODY Conditional sorting, starting from 1. Yes

Parameters in conditions.display
(Reference device supports linkage specifications status)

Parameter Type Position Description Mandatory
code String BODY The status code of the device Yes
operator String BODY Operators. See Code data type and operator mapping description. Yes
value Object BODY Code value Yes

Parameters in conditions.display.operator

type opertaor
String “==”
String “>”,“==”,“<”
String “==”

Parameters in preconditions

Predefined restrictions. Currently, it supports restrictions by time frame.

Parameter Type Description
cond_type String Currently, it only supports restrictions by time frame,which is fixed as timeCheck.
display Object Display of conditions.

Parameters in preconditions.display

Parameter Type Description
start String The start time in 24-hour clock. The default value is a certain time of the day. For example, 10:00.
end String The end time in 24-hour clock. For example, 22:00.
loops String A 7-digit number consisting of 0 and 1. 0 means not to execute, and 1 means to execute. The first digit represents Sunday, and the following digits represent Monday to Saturday in turn. For example, 0011000 means to execute every Tuesday and Wednesday.
timezone_id String The ID of the time zone, for example, Asia/Shanghai.

Parameters in actions

Parameter Type Description
entity_id String Unique ID of a device.
executor_property Object Action parameters.
action_executor String Action type , Currently only supports: dpIssue.

Parameters in actions.executor_property
(Reference equipment supports linkage specifications functions)

key value
Function code Function value.

Response Parameters

Parameter Type Description
code Integer Response code.Null indicates success.
success Boolean Request result.
true: success
false: failure
msg String Exception message.It is null when the request result is success.
t Long Response time, which is a 13-digit timestamp.
result Boolean Operation result.

Request Example

PUT {url}/v1.0/osaas/rooms/122233******/automations/53IYSXI3******
{ "conditions": [ { "display": { "code": "switch_1", "operator": "==", "value": true }, "entity_id": "vdevo15725982******", "entity_type": 1, "order_num": 1 } ], "actions": [ { "action_executor": "delay", "executor_property": { "hours": "0", "minutes": "0", "seconds": "5" } }, { "action_executor": "dpIssue", "entity_id": "vdevo15725982******", "executor_property": { "switch_1": true } } ], "match_type": 1, "automation_name": "Test automation" }

Example of preconditions

{ "preconditions": [ { "display": { "start": "10:00", "end": "12:00", "loops": "0010000", "timezone_id": "Asia/Shanghai" }, "cond_type": "timeCheck" } ] }

Example of device status conditions

{ "conditions": [ { "display": { "code": "switch_1", "operator": "==", "value": true }, "entity_id": "vdevo15725982******", "entity_type": 1, "order_num": 1 } ] }

Success Response Example

{ "success": true, "result": true, "t": 1566053034624 }

Failure Response Example

{ "code": 500, "msg": "system error,please contact the admin", "success": false, "t": 1561378856383 }

API for Deleting a Automation

API Description

You can use this API to delete a automation.

API Address

DELETE /v1.0/osaas/rooms/{room_id}/automations/{automation_id}

Request Parameters

Parameter Type Position Description Mandatory
room_id String URI Unique ID of a room Yes
automation_id String URI Unique ID of a automation. Yes

Response Parameters

Parameter Type Description
code Integer Response code.Null indicates success.
success Boolean Request result.
true: success
false: failure
msg String Exception message.It is null when the request result is success.
t Long Response time, which is a 13-digit timestamp.
result Boolean Operation result.

Request Example

DELETE {url}/v1.0/osaas/rooms/12223******/automations/53IY3g******

Success Response Example

{ "success": true, "result": true, "t": 1566053034624 }

Failure Response Example

{ "code": 500, "msg": "system error,please contact the admin", "success": false, "t": 1561378856383 }

API for Enabling a Automation

API Description

You can use this API to enable a automation.

API Address

PUT /v1.0/osaas/rooms/{room_id}/automations/{automation_id}/enable

Request Parameters

Parameter Type Position Description Mandatory
room_id String URI Unique ID of a room. Yes
automation_id String URI Unique ID of a automation. Yes

Response Parameters

Parameter Type Description
code Integer Response code.Null indicates success.
success Boolean Request result.
true: success
false: failure
msg String Exception message.It is null when the request result is success.
t Long Response time, which is a 13-digit timestamp.
result Boolean Operation result.

Request Example

PUT {url}/v1.0/osaas/rooms/12223******/automations/53IY3******/enable

Success Response Example

{ "success": true, "result": true, "t": 1566053034624 }

Failure Response Example

{ "code": 500, "msg": "system error,please contact the admin", "success": false, "t": 1561378856383 }

API for Disabling a Automation

API Description

You can use this API to disable a automation.

API Address

PUT /v1.0/osaas/rooms/{room_id}/automations/{automation_id}/disable

Request Parameters

Parameter Type Position Description Mandatory
room_id String URI Unique ID of a room. Yes
automation_id String URI Unique ID of a automation. Yes

Response Parameters

Parameter Type Description
code Integer Response code.Null indicates success.
success Boolean Request result.
true: success
false: failure
msg String Exception message.It is null when the request result is success.
t Long Response time, which is a 13-digit timestamp.
result Boolean Operation result.

Request Example

PUT {url}/v1.0/osaas/rooms/1222******/automations/53IY3******/disable

Success Response Example

{ "success": true, "result": true, "t": 1566053034624 }

Failure Response Example

{ "code": 500, "msg": "system error,please contact the admin", "success": false, "t": 1561378856383 }

Error Code

The following are common business exceptions for this interface. For more exception errors, see Global Error Codes.

error code explain
500 system error