场景详情
更新时间:2025-10-16 15:46:36
调用该接口获取场景详情。开发参考见 场景自动化开发指南
| 描述 | 值 |
|---|---|
| 路径 | /platform/scene/detail |
| 版本号 | 1.0.0 |
| 协议 | HTTPS |
| 请求方法 | POST |
请求参数:
公共请求参数见 公共请求参数
| 请求字段 | 类型 | 必选 | 描述 |
|---|---|---|---|
| openId | String | 是 | 三方用户外标id |
| sceneId | Long | 是 | 场景id |
返回参数:
| 返回字段 | 类型 | 描述 |
|---|---|---|
| id | String | 用于识别请求记录,即对应的请求ID。 |
| code | Int | 接口返回码字段,请求成功时返回200;请求失败时返回详细的错误码。 |
| message | String | 调用失败时,返回的出错信息 |
| data | Object | 响应的结果。 |
| sceneId | Long | 场景id |
| enable | Boolean | 是否启用 |
| name | String | 场景名称 |
| mode | String | 模式,any:表示任何一个条件满足就执行动作,all:表示所有条件满足时才执行动作 |
| conditions | List | 条件列表 |
| uri | Long | condition/device/property:属性条件,condition/device/event:事件条件 |
| params | Object | 条件参数 |
| productKey | String | 产品key |
| deviceName | String | deviceName |
| identifier | String | 属性标识 |
| propertyName | String | 属性的名称 |
| compareType | String | 比较类型,如>、<、>=、==、<=、!=、in |
| compareValue | Object | 用于比较的期望的值 |
| actions | List | 场景名称 |
| uri | String | action/device/setProperty:设置属性,action/device/invokeService:调用服务 |
| params | Object | 动作参数 |
| productKey | String | 场景名称 |
| deviceName | String | 场景名称 |
| identifier | String | 属性或事件标识符 |
| args | String | 具体动作所需要参数内容 |
请求示例:
x-ca-key: xxxxxxxx
x-ca-timestamp: 1728634151000
x-ca-nonce: 7b25fc15b9434dd98587a077a92b7e42
x-ca-signature: yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
Content-Type: application/json;charset=UTF-8
{
"id": "49a7be925e******9b08ba0facf7",
"version": "1.0",
"request": {
"apiVer": "1.0.0"
},
"params": {
"openId": "op******1",
"sceneId": 1
}
}
成功返回示例:
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Cache-Control: no-store
Pragma: no-cache
{
"id": "49a7be925e******9b08ba0facf7",
"code": 200,
"message": "success",
"data": {
"sceneId": 1,
"enable": true,
"name": "name1",
"mode": "any",
"conditions": [
{
"uri": "condition/device/event",
"params": {
"productKey": "pk1",
"deviceName": "dn1",
"identifier": "IntelligentAlarm",
"propertyName": "AlarmType",
"compareType": "==",
"compareValue": "2"
}
}
],
"actions": [
{
"uri": "action/device/setProperty",
"params": {
"productKey": "pk2",
"deviceName": "dn2",
"identifier": "powerstate",
"args": "{\"value\": 1}"
}
},
{
"uri": "action/device/invokeService",
"params": {
"productKey": "pk3",
"deviceName": "dn3",
"identifier": "Reboot",
"args": "{}"
}
}
]
}
}