创建场景
开发中
本地
http://127.0.0.1:9999
本地
http://127.0.0.1:9999
POST
http://127.0.0.1:9999
请求参数
Header 参数
x-token
string
可选
默认值:
{{x-token}}
Body 参数application/json
name
string
场景名称
description
string
场景描述
actions
array [object {6}]
场景动作列表
action_type
string
必需
10: 单个设备;
11: 单类设备
30 : 触发告警
40: 服务
action_target
string
必需
action_param_type
string
可选
TEL:遥测
ATTR:属性
CMD:命令
action_param
string
必需
action_value
string
可选
remark
string
可选
示例
{
"name": "yanhao",
"description": "haoyan",
"actions": [
{
"action_type": "10",
"action_target": "1",
"action_param_type": "2",
"action_param": "3",
"action_value": "4",
"remark": "5"
},
{
"action_type": "10",
"action_target": "3",
"action_param_type": "11",
"action_param": "44",
"action_value": "55",
"remark": "remark"
}
]
}
示例代码
Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST 'http://127.0.0.1:9999/api/v1/scene' \
--header 'x-token: {{x-token}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "yanhao",
"description": "haoyan",
"actions": [
{
"action_type": "10",
"action_target": "1",
"action_param_type": "2",
"action_param": "3",
"action_value": "4",
"remark": "5"
},
{
"action_type": "10",
"action_target": "3",
"action_param_type": "11",
"action_param": "44",
"action_value": "55",
"remark": "remark"
}
]
}'
返回响应
🟢200成功
application/json
Body
code
integer
必需
message
string
必需
data
object
必需
scene_id
string
必需
示例
{
"code": 200,
"message": "create scene successfully",
"data": {
"scene_id": "e3969cc5-a741-99c2-e442-e3e44da95655"
}
}