跳到主要内容

场景详情

更新时间:2025-10-16 15:46:36

调用该接口获取场景详情。开发参考见 场景自动化开发指南


描述
路径/platform/scene/detail
版本号1.0.0
协议HTTPS
请求方法POST

请求参数:

公共请求参数见 公共请求参数

请求字段类型必选描述
openIdString三方用户外标id
sceneIdLong场景id

返回参数:

返回字段类型描述
idString用于识别请求记录,即对应的请求ID。
codeInt接口返回码字段,请求成功时返回200;请求失败时返回详细的错误码。
messageString调用失败时,返回的出错信息
dataObject响应的结果。
sceneIdLong场景id
enableBoolean是否启用
nameString场景名称
modeString模式,any:表示任何一个条件满足就执行动作,all:表示所有条件满足时才执行动作
conditionsList条件列表
uriLongcondition/device/property:属性条件,condition/device/event:事件条件
paramsObject条件参数
productKeyString产品key
deviceNameStringdeviceName
identifierString属性标识
propertyNameString属性的名称
compareTypeString比较类型,如>、<、>=、==、<=、!=、in
compareValueObject用于比较的期望的值
actionsList场景名称
uriStringaction/device/setProperty:设置属性,action/device/invokeService:调用服务
paramsObject动作参数
productKeyString场景名称
deviceNameString场景名称
identifierString属性或事件标识符
argsString具体动作所需要参数内容

请求示例:

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": "{}"
}
}
]
}
}