提供一组与物(设备)相关的服务接口,客户端应用通过本组服务接口可以实现物信息的查询和控制,查询的内容涉及物的基本信息,物的上报数据信息以及物的TSL定义。

设备状态查询和控制

设备扩展属性

设备定时

APP小组件控制设备

获取物的基本信息

定义描述

path 版本 描述 是否需要用户身份的鉴权
/thing/info/get 1.0.2 获取物的信息,例如设备名称、mac地址、设备激活时间等内容 是,客户端SDK需启用身份的鉴权,进行身份认证

请求参数

参数 类型 必填 描述
iotId String 物的唯一标识符

返回参数

参数 类型 必有 描述
gmtModified Long 设备记录数据修改时间(系统内部使用字段,用户可不需关心)
activeTime Long 设备首次激活时间
gmtCreate Long 设备记录创建时间,对于智能生活平台来讲,就是量产时,生成设备三元组的时间
productKey String 产品key
statusLast Integer 上一次设备状态
mac String mac地址
deviceSecret String 设备secret
iotId String 设备唯一标识符
name String 设备名称
sdkVersion String sdk版本
sn String 设备sn
thingType String 设备类型VIRTUAL:虚拟设备VIRTUAL_SHADOW:虚拟设备DEVICE:真实设备
firmwareVersion String 固件版本号
rbacTenantId String 租户id
status Integer 设备状态0:未激活1:在线3:离线8:禁用
netAddress String ip地址

示例

  • 请求示例
    {
        "id": "1509086454180",
        "version": "1.0",
        "request": {
            "apiVer": "1.0.2",
            "iotToken": "token"
        },
        "params": {
            "iotId": "D95D242941CE821ECCE4F31A2697"
        }
    }
    					
  • 正常返回示例
    {
        "code": 200,
        "data": {
            "gmtModified": 1517918765000,
            "activeTime": null,
            "gmtCreate": 1500017648000,
            "productKey": "kQGJJuTl0qA",
            "statusLast": null,
            "mac": null,
            "netAddress": null,
            "deviceSecret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
            "iotId": "03iGXYVl03e23f667d90269c2ccwgzHG",
            "name": "Kq7rgvE2cNGcwtDexwJh",
            "nickname": null,
            "sdkVersion": null,
            "sn": null,
            "thingType": "DEVICE",
            "firmwareVersion": "1.0.0",
            "rbacTenantId": "ADSBCUYAGDCUDD827918327917",
            "status": 1
        },
        "message": "success",
        "localizedMsg": null
    }
    					

获取物的属性timeline数据

定义描述

path 版本 描述 是否需要用户身份的鉴权
/thing/property/timeline/get 1.0.2 获取物的属性timeline数据,最多可以获取设备一年内的数据 是,客户端SDK需启用身份的鉴权,进行身份认证

请求参数

参数 类型 必填 描述
iotId String 物的唯一标识符
identifier String 属性标识符
start Long timeline起始时间
end Long timeline终止时间
pageSize Int 分页查询条数(最大200)
ordered Boolean 顺序(true)、逆序(false)查询

返回参数

参数 类型 必有 描述
iotid String 设备标识符
data Object 设备timeline数据
modifytime Long 属性更新时间
property String 属性标识符
batchId String 批次id
timestamp Long 属性采集时间戳

示例

  • 请求示例
    {
        "id": "1509086454180",
        "version": "1.0",
        "request": {
            "apiVer": "1.0.2",
            "iotToken": "token"
        },
        "params": {
            "iotId": "D95D242941CE821ECCE4F31A2697",
            "identifier": "xxxx",
            "start": 1517217645000,
            "end": 1517217645000,
            "pageSize": 10,
            "ordered": true
        }
    }
    					
  • 正常返回示例
    {
      "code": 200,
      "message": "success",
      "localizedMsg": null,
      "data": {
        "items": [
          {
            "iotid": "xqxyZjSKzCwaGdlvbv0O0010851c00",
            "data": 1.23,
            "modifytime": 1511812747287,
            "property": "LightVolt",
            "batchId": "2fc766c5e7064554933ed1f3e4b61803",
            "group": null,
            "timestamp": 1511812747245
          },
          {
            "iotid": "xqxyZjSKzCwaGdlvbv0O0010851c00",
            "data": 1.24,
            "modifytime": 1511812747288,
            "property": "LightVolt",
            "batchId": "2fc766c5e7064554933ed1f3e4b61803",
            "group": null,
            "timestamp": 1511812747245
          }
        ],
        "timestamp": 1511812747245
      }
    }
    					

获取物的事件timeline数据

定义描述

path 版本 描述 是否需要用户身份的鉴权
/thing/event/timeline/get 1.0.2 获取物的事件timeline数据,最多可以获取设备一年内的数据 是,客户端SDK需启用身份的鉴权,进行身份认证

请求参数

参数 类型 必填 描述
iotId String 物的唯一标识符
identifier String 属性标识符
eventType String 事件类型
start Long timeline起始时间
end Long timeline终止时间
pageSize Int 分页查询条数
ordered Boolean 顺序(true)、逆序(false)查询

返回参数

参数 类型 必有 描述
eventCode String 事件标识符
iotId String 物的唯一标识符
eventName String 事件名称
eventType String 事件类型
eventBody Object 事件参数
batchId String 批次id
timestamp Long 时间采集时间

示例

  • 请求示例
    {
        "id": "1509086454180",
        "version": "1.0",
        "request": {
            "apiVer": "1.0.2",
            "iotToken": "token"
        },
        "params": {
            "iotId": "D95D242941CE821ECCE4F31A2697",
            "identifier": "xxxx",
            "eventType": "xxxx",
            "start": 1517217645000,
            "end": 1517217645000,
            "pageSize": 10,
            "ordered": true
        }
    }
    
    					
  • 正常返回示例
    {
        "code": 200,
        "message": "success",
        "localizedMsg": "",
        "data": {
            "items": [
                {
                    "eventCode": "Error",
                    "iotId": "YzqEnI5DY03rxLS2pjjo0010840500",
                    "eventName": "故障上报",
                    "eventType": "info",
                    "eventBody": {
                        "ErrorCode": 0
                    },
                    "batchId": "5ebc6a9c7d15459f823edde6d28c8fb3",
                    "timestamp": 1516342985261
                },
                {
                    "eventCode": "Error",
                    "iotId": "YzqEnI5DY03rxLS2pjjo0010840500",
                    "eventName": "故障上报",
                    "eventType": "info",
                    "eventBody": {
                        "ErrorCode": 0
                    },
                    "batchId": "4a0b5a7ac85e470684438d5ff77456f1",
                    "timestamp": 1516342995305
                }
            ],
            "timestamp": 1516343075699
        }
    }
    					

设置物的属性

定义描述

path 版本 描述 是否需要用户身份的鉴权
/thing/properties/set 1.0.2 设置物的属性 是,客户端SDK需启用身份的鉴权,进行身份认证

请求参数

参数 类型 必填 描述
iotId String 物的唯一标识符
items JSON set参数

返回参数

示例

  • 请求示例
    {
        "id": "1509086454180",
        "version": "1.0",
        "request": {
            "apiVer": "1.0.2",
            "iotToken": "token"
        },
        "params": {
            "iotId": "D95D242941CE821ECCE4F31A2697",
            "items": {
                "LightSwitch1": 0,
                "LightSwitch2": 0
            }
        }
    }
    					
  • 正常返回示例
    {
      "code": 200,
      "data": null,
      "message": "success",
      "localizedMsg": ""
    }
    					

获取物的事件

定义描述

path 版本 描述 是否需要用户身份的鉴权
/thing/events/get 1.0.2 获取物的事件 是,客户端SDK需启用身份的鉴权,进行身份认证

请求参数

参数 类型 必填 描述
iotId String 物的唯一标识符

返回参数

参数 类型 必有 描述
identifier String 事件标识符
time Long 时间采集时间
type String 事件类型
value Object 事件出参

示例

  • 请求示例
    {
        "id": "1509086454180",
        "version": "1.0",
        "request": {
            "apiVer": "1.0.2",
            "iotToken": "token"
        },
        "params": {
            "iotId": "D95D242941CE821ECCE4F31A2697"
        }
    }
    					
  • 正常返回示例
    {
        "code": 200,
        "data": [
            {
                "identifier": "Error",
                "time": 1517420842314,
                "type": "info",
                "value": {
                    "Shrink5": 12,
                    "Shrink20": {
                        "testKey2": "val2",
                        "testKey": "val"
                    }
                }
            }
        ],
        "message": "success",
        "localizedMsg": null
    }
    					

根据设备id获取物的模板

定义描述

path 版本 描述 是否需要用户身份的鉴权
/thing/tsl/get 1.0.2 获取物的tsl功能模板(包含属性、事件、服务的定义) 是,客户端SDK需启用身份的鉴权,进行身份认证
=

请求参数

参数 类型 必填 描述
iotId String 物的唯一标识符

返回参数

示例

  • 请求示例
    {
        "id": "1509086454180",
        "version": "1.0",
        "request": {
            "apiVer": "1.0.2",
            "iotToken": "token"
        },
        "params": {
            "iotId": "D95D242941CE821ECCE4F31A2697"
        }
    }
    					
  • 正常返回示例
    {
        "code": 200,
        "data": {
            "schema": "http://aliyun/iot/thing/desc/schema",
            "profile": {
                "productKey": "a1xqv8AGpck",
                "deviceName": "YzqEnI5DY03rxLS2pjjo"
            },
            "link": "/sys/a1xqv8AGpck/YzqEnI5DY03rxLS2pjjo/thing/",
            "services": [
                {
                    "outputData": [
    
                    ],
                    "identifier": "set",
                    "inputData": [
                        {
                            "identifier": "LightSwitch",
                            "dataType": {
                                "specs": {
                                    "0": "关闭",
                                    "1": "开启"
                                },
                                "type": "bool"
                            },
                            "name": "主灯开关"
                        },
                        {
                            "identifier": "ColorTemperature",
                            "dataType": {
                                "specs": {
                                    "unit": "K",
                                    "min": "2700",
                                    "unitName": "开尔文",
                                    "max": "6500"
                                },
                                "type": "int"
                            },
                            "name": "冷暖色温"
                        },
                        {
                            "identifier": "Brightness",
                            "dataType": {
                                "specs": {
                                    "unit": "%",
                                    "min": "0",
                                    "unitName": "百分比",
                                    "max": "100"
                                },
                                "type": "int"
                            },
                            "name": "明暗度"
                        },
                        {
                            "identifier": "HSVColor",
                            "dataType": {
                                "specs": [
                                    {
                                        "identifier": "Hue",
                                        "dataType": {
                                            "specs": {
                                                "unit": "°",
                                                "min": "0",
                                                "unitName": "度",
                                                "max": "360"
                                            },
                                            "type": "int"
                                        },
                                        "name": "色调"
                                    },
                                    {
                                        "identifier": "Saturation",
                                        "dataType": {
                                            "specs": {
                                                "unit": "%",
                                                "min": "0",
                                                "unitName": "百分比",
                                                "max": "100"
                                            },
                                            "type": "int"
                                        },
                                        "name": "饱和度"
                                    },
                                    {
                                        "identifier": "Value",
                                        "dataType": {
                                            "specs": {
                                                "unit": "%",
                                                "min": "0",
                                                "unitName": "百分比",
                                                "max": "100"
                                            },
                                            "type": "int"
                                        },
                                        "name": "明度"
                                    }
                                ],
                                "type": "struct"
                            },
                            "name": "HSV调色"
                        },
                        {
                            "identifier": "HSLColor",
                            "dataType": {
                                "specs": [
                                    {
                                        "identifier": "Hue",
                                        "dataType": {
                                            "specs": {
                                                "unit": "°",
                                                "min": "0",
                                                "unitName": "度",
                                                "max": "360"
                                            },
                                            "type": "int"
                                        },
                                        "name": "色调"
                                    },
                                    {
                                        "identifier": "Saturation",
                                        "dataType": {
                                            "specs": {
                                                "unit": "%",
                                                "min": "0",
                                                "unitName": "百分比",
                                                "max": "100"
                                            },
                                            "type": "int"
                                        },
                                        "name": "饱和度"
                                    },
                                    {
                                        "identifier": "Lightness",
                                        "dataType": {
                                            "specs": {
                                                "unit": "%",
                                                "min": "0",
                                                "unitName": "百分比",
                                                "max": "100"
                                            },
                                            "type": "int"
                                        },
                                        "name": "亮度"
                                    }
                                ],
                                "type": "struct"
                            },
                            "name": "HSL调色"
                        },
                        {
                            "identifier": "RGBColor",
                            "dataType": {
                                "specs": [
                                    {
                                        "identifier": "Red",
                                        "dataType": {
                                            "specs": {
                                                "min": "0",
                                                "unitName": "无",
                                                "max": "255"
                                            },
                                            "type": "int"
                                        },
                                        "name": "红色"
                                    },
                                    {
                                        "identifier": "Green",
                                        "dataType": {
                                            "specs": {
                                                "min": "0",
                                                "unitName": "无",
                                                "max": "255"
                                            },
                                            "type": "int"
                                        },
                                        "name": "绿色"
                                    },
                                    {
                                        "identifier": "Blue",
                                        "dataType": {
                                            "specs": {
                                                "min": "0",
                                                "unitName": "无",
                                                "max": "255"
                                            },
                                            "type": "int"
                                        },
                                        "name": "蓝色"
                                    }
                                ],
                                "type": "struct"
                            },
                            "name": "RGB调色"
                        },
                        {
                            "identifier": "NightLightSwitch",
                            "dataType": {
                                "specs": {
                                    "0": "关闭",
                                    "1": "开启"
                                },
                                "type": "bool"
                            },
                            "name": "夜灯开关"
                        },
                        {
                            "identifier": "WorkMode",
                            "dataType": {
                                "specs": {
                                    "0": "手动",
                                    "1": "阅读",
                                    "2": "影院",
                                    "3": "夜灯",
                                    "4": "生活",
                                    "5": "柔和"
                                },
                                "type": "enum"
                            },
                            "name": "工作模式"
                        }
                    ],
                    "method": "thing.service.property.set",
                    "name": "set",
                    "required": true,
                    "callType": "sync",
                    "desc": "属性设置"
                },
                {
                    "outputData": [
                        {
                            "identifier": "LightSwitch",
                            "dataType": {
                                "specs": {
                                    "0": "关闭",
                                    "1": "开启"
                                },
                                "type": "bool"
                            },
                            "name": "主灯开关"
                        },
                        {
                            "identifier": "ColorTemperature",
                            "dataType": {
                                "specs": {
                                    "unit": "K",
                                    "min": "2700",
                                    "unitName": "开尔文",
                                    "max": "6500"
                                },
                                "type": "int"
                            },
                            "name": "冷暖色温"
                        },
                        {
                            "identifier": "Brightness",
                            "dataType": {
                                "specs": {
                                    "unit": "%",
                                    "min": "0",
                                    "unitName": "百分比",
                                    "max": "100"
                                },
                                "type": "int"
                            },
                            "name": "明暗度"
                        },
                        {
                            "identifier": "HSVColor",
                            "dataType": {
                                "specs": [
                                    {
                                        "identifier": "Hue",
                                        "dataType": {
                                            "specs": {
                                                "unit": "°",
                                                "min": "0",
                                                "unitName": "度",
                                                "max": "360"
                                            },
                                            "type": "int"
                                        },
                                        "name": "色调"
                                    },
                                    {
                                        "identifier": "Saturation",
                                        "dataType": {
                                            "specs": {
                                                "unit": "%",
                                                "min": "0",
                                                "unitName": "百分比",
                                                "max": "100"
                                            },
                                            "type": "int"
                                        },
                                        "name": "饱和度"
                                    },
                                    {
                                        "identifier": "Value",
                                        "dataType": {
                                            "specs": {
                                                "unit": "%",
                                                "min": "0",
                                                "unitName": "百分比",
                                                "max": "100"
                                            },
                                            "type": "int"
                                        },
                                        "name": "明度"
                                    }
                                ],
                                "type": "struct"
                            },
                            "name": "HSV调色"
                        },
                        {
                            "identifier": "HSLColor",
                            "dataType": {
                                "specs": [
                                    {
                                        "identifier": "Hue",
                                        "dataType": {
                                            "specs": {
                                                "unit": "°",
                                                "min": "0",
                                                "unitName": "度",
                                                "max": "360"
                                            },
                                            "type": "int"
                                        },
                                        "name": "色调"
                                    },
                                    {
                                        "identifier": "Saturation",
                                        "dataType": {
                                            "specs": {
                                                "unit": "%",
                                                "min": "0",
                                                "unitName": "百分比",
                                                "max": "100"
                                            },
                                            "type": "int"
                                        },
                                        "name": "饱和度"
                                    },
                                    {
                                        "identifier": "Lightness",
                                        "dataType": {
                                            "specs": {
                                                "unit": "%",
                                                "min": "0",
                                                "unitName": "百分比",
                                                "max": "100"
                                            },
                                            "type": "int"
                                        },
                                        "name": "亮度"
                                    }
                                ],
                                "type": "struct"
                            },
                            "name": "HSL调色"
                        },
                        {
                            "identifier": "RGBColor",
                            "dataType": {
                                "specs": [
                                    {
                                        "identifier": "Red",
                                        "dataType": {
                                            "specs": {
                                                "min": "0",
                                                "unitName": "无",
                                                "max": "255"
                                            },
                                            "type": "int"
                                        },
                                        "name": "红色"
                                    },
                                    {
                                        "identifier": "Green",
                                        "dataType": {
                                            "specs": {
                                                "min": "0",
                                                "unitName": "无",
                                                "max": "255"
                                            },
                                            "type": "int"
                                        },
                                        "name": "绿色"
                                    },
                                    {
                                        "identifier": "Blue",
                                        "dataType": {
                                            "specs": {
                                                "min": "0",
                                                "unitName": "无",
                                                "max": "255"
                                            },
                                            "type": "int"
                                        },
                                        "name": "蓝色"
                                    }
                                ],
                                "type": "struct"
                            },
                            "name": "RGB调色"
                        },
                        {
                            "identifier": "NightLightSwitch",
                            "dataType": {
                                "specs": {
                                    "0": "关闭",
                                    "1": "开启"
                                },
                                "type": "bool"
                            },
                            "name": "夜灯开关"
                        },
                        {
                            "identifier": "WorkMode",
                            "dataType": {
                                "specs": {
                                    "0": "手动",
                                    "1": "阅读",
                                    "2": "影院",
                                    "3": "夜灯",
                                    "4": "生活",
                                    "5": "柔和"
                                },
                                "type": "enum"
                            },
                            "name": "工作模式"
                        }
                    ],
                    "identifier": "get",
                    "inputData": [
                        "LightSwitch",
                        "ColorTemperature",
                        "Brightness",
                        "HSVColor",
                        "HSLColor",
                        "RGBColor",
                        "NightLightSwitch",
                        "WorkMode"
                    ],
                    "method": "thing.service.property.get",
                    "name": "get",
                    "required": true,
                    "callType": "sync",
                    "desc": "属性获取"
                },
                {
                    "outputData": [
    
                    ],
                    "identifier": "ToggleLightSwitch",
                    "inputData": [
    
                    ],
                    "method": "thing.service.ToggleLightSwitch",
                    "name": "翻转主灯开关",
                    "required": false,
                    "callType": "async"
                }
            ],
            "properties": [
                {
                    "identifier": "LightSwitch",
                    "dataType": {
                        "specs": {
                            "0": "关闭",
                            "1": "开启"
                        },
                        "type": "bool"
                    },
                    "name": "主灯开关",
                    "accessMode": "rw",
                    "required": true
                },
                {
                    "identifier": "ColorTemperature",
                    "dataType": {
                        "specs": {
                            "unit": "K",
                            "min": "2700",
                            "unitName": "开尔文",
                            "max": "6500"
                        },
                        "type": "int"
                    },
                    "name": "冷暖色温",
                    "accessMode": "rw",
                    "required": false
                },
                {
                    "identifier": "Brightness",
                    "dataType": {
                        "specs": {
                            "unit": "%",
                            "min": "0",
                            "unitName": "百分比",
                            "max": "100"
                        },
                        "type": "int"
                    },
                    "name": "明暗度",
                    "accessMode": "rw",
                    "required": false
                },
                {
                    "identifier": "HSVColor",
                    "dataType": {
                        "specs": [
                            {
                                "identifier": "Hue",
                                "dataType": {
                                    "specs": {
                                        "unit": "°",
                                        "min": "0",
                                        "unitName": "度",
                                        "max": "360"
                                    },
                                    "type": "int"
                                },
                                "name": "色调"
                            },
                            {
                                "identifier": "Saturation",
                                "dataType": {
                                    "specs": {
                                        "unit": "%",
                                        "min": "0",
                                        "unitName": "百分比",
                                        "max": "100"
                                    },
                                    "type": "int"
                                },
                                "name": "饱和度"
                            },
                            {
                                "identifier": "Value",
                                "dataType": {
                                    "specs": {
                                        "unit": "%",
                                        "min": "0",
                                        "unitName": "百分比",
                                        "max": "100"
                                    },
                                    "type": "int"
                                },
                                "name": "明度"
                            }
                        ],
                        "type": "struct"
                    },
                    "name": "HSV调色",
                    "accessMode": "rw",
                    "required": false
                },
                {
                    "identifier": "HSLColor",
                    "dataType": {
                        "specs": [
                            {
                                "identifier": "Hue",
                                "dataType": {
                                    "specs": {
                                        "unit": "°",
                                        "min": "0",
                                        "unitName": "度",
                                        "max": "360"
                                    },
                                    "type": "int"
                                },
                                "name": "色调"
                            },
                            {
                                "identifier": "Saturation",
                                "dataType": {
                                    "specs": {
                                        "unit": "%",
                                        "min": "0",
                                        "unitName": "百分比",
                                        "max": "100"
                                    },
                                    "type": "int"
                                },
                                "name": "饱和度"
                            },
                            {
                                "identifier": "Lightness",
                                "dataType": {
                                    "specs": {
                                        "unit": "%",
                                        "min": "0",
                                        "unitName": "百分比",
                                        "max": "100"
                                    },
                                    "type": "int"
                                },
                                "name": "亮度"
                            }
                        ],
                        "type": "struct"
                    },
                    "name": "HSL调色",
                    "accessMode": "rw",
                    "required": false
                },
                {
                    "identifier": "RGBColor",
                    "dataType": {
                        "specs": [
                            {
                                "identifier": "Red",
                                "dataType": {
                                    "specs": {
                                        "min": "0",
                                        "unitName": "无",
                                        "max": "255"
                                    },
                                    "type": "int"
                                },
                                "name": "红色"
                            },
                            {
                                "identifier": "Green",
                                "dataType": {
                                    "specs": {
                                        "min": "0",
                                        "unitName": "无",
                                        "max": "255"
                                    },
                                    "type": "int"
                                },
                                "name": "绿色"
                            },
                            {
                                "identifier": "Blue",
                                "dataType": {
                                    "specs": {
                                        "min": "0",
                                        "unitName": "无",
                                        "max": "255"
                                    },
                                    "type": "int"
                                },
                                "name": "蓝色"
                            }
                        ],
                        "type": "struct"
                    },
                    "name": "RGB调色",
                    "accessMode": "rw",
                    "required": false
                },
                {
                    "identifier": "NightLightSwitch",
                    "dataType": {
                        "specs": {
                            "0": "关闭",
                            "1": "开启"
                        },
                        "type": "bool"
                    },
                    "name": "夜灯开关",
                    "accessMode": "rw",
                    "required": false
                },
                {
                    "identifier": "WorkMode",
                    "dataType": {
                        "specs": {
                            "0": "手动",
                            "1": "阅读",
                            "2": "影院",
                            "3": "夜灯",
                            "4": "生活",
                            "5": "柔和"
                        },
                        "type": "enum"
                    },
                    "name": "工作模式",
                    "accessMode": "rw",
                    "required": false
                }
            ],
            "events": [
                {
                    "outputData": [
                        {
                            "identifier": "LightSwitch",
                            "dataType": {
                                "specs": {
                                    "0": "关闭",
                                    "1": "开启"
                                },
                                "type": "bool"
                            },
                            "name": "主灯开关"
                        },
                        {
                            "identifier": "ColorTemperature",
                            "dataType": {
                                "specs": {
                                    "unit": "K",
                                    "min": "2700",
                                    "unitName": "开尔文",
                                    "max": "6500"
                                },
                                "type": "int"
                            },
                            "name": "冷暖色温"
                        },
                        {
                            "identifier": "Brightness",
                            "dataType": {
                                "specs": {
                                    "unit": "%",
                                    "min": "0",
                                    "unitName": "百分比",
                                    "max": "100"
                                },
                                "type": "int"
                            },
                            "name": "明暗度"
                        },
                        {
                            "identifier": "HSVColor",
                            "dataType": {
                                "specs": [
                                    {
                                        "identifier": "Hue",
                                        "dataType": {
                                            "specs": {
                                                "unit": "°",
                                                "min": "0",
                                                "unitName": "度",
                                                "max": "360"
                                            },
                                            "type": "int"
                                        },
                                        "name": "色调"
                                    },
                                    {
                                        "identifier": "Saturation",
                                        "dataType": {
                                            "specs": {
                                                "unit": "%",
                                                "min": "0",
                                                "unitName": "百分比",
                                                "max": "100"
                                            },
                                            "type": "int"
                                        },
                                        "name": "饱和度"
                                    },
                                    {
                                        "identifier": "Value",
                                        "dataType": {
                                            "specs": {
                                                "unit": "%",
                                                "min": "0",
                                                "unitName": "百分比",
                                                "max": "100"
                                            },
                                            "type": "int"
                                        },
                                        "name": "明度"
                                    }
                                ],
                                "type": "struct"
                            },
                            "name": "HSV调色"
                        },
                        {
                            "identifier": "HSLColor",
                            "dataType": {
                                "specs": [
                                    {
                                        "identifier": "Hue",
                                        "dataType": {
                                            "specs": {
                                                "unit": "°",
                                                "min": "0",
                                                "unitName": "度",
                                                "max": "360"
                                            },
                                            "type": "int"
                                        },
                                        "name": "色调"
                                    },
                                    {
                                        "identifier": "Saturation",
                                        "dataType": {
                                            "specs": {
                                                "unit": "%",
                                                "min": "0",
                                                "unitName": "百分比",
                                                "max": "100"
                                            },
                                            "type": "int"
                                        },
                                        "name": "饱和度"
                                    },
                                    {
                                        "identifier": "Lightness",
                                        "dataType": {
                                            "specs": {
                                                "unit": "%",
                                                "min": "0",
                                                "unitName": "百分比",
                                                "max": "100"
                                            },
                                            "type": "int"
                                        },
                                        "name": "亮度"
                                    }
                                ],
                                "type": "struct"
                            },
                            "name": "HSL调色"
                        },
                        {
                            "identifier": "RGBColor",
                            "dataType": {
                                "specs": [
                                    {
                                        "identifier": "Red",
                                        "dataType": {
                                            "specs": {
                                                "min": "0",
                                                "unitName": "无",
                                                "max": "255"
                                            },
                                            "type": "int"
                                        },
                                        "name": "红色"
                                    },
                                    {
                                        "identifier": "Green",
                                        "dataType": {
                                            "specs": {
                                                "min": "0",
                                                "unitName": "无",
                                                "max": "255"
                                            },
                                            "type": "int"
                                        },
                                        "name": "绿色"
                                    },
                                    {
                                        "identifier": "Blue",
                                        "dataType": {
                                            "specs": {
                                                "min": "0",
                                                "unitName": "无",
                                                "max": "255"
                                            },
                                            "type": "int"
                                        },
                                        "name": "蓝色"
                                    }
                                ],
                                "type": "struct"
                            },
                            "name": "RGB调色"
                        },
                        {
                            "identifier": "NightLightSwitch",
                            "dataType": {
                                "specs": {
                                    "0": "关闭",
                                    "1": "开启"
                                },
                                "type": "bool"
                            },
                            "name": "夜灯开关"
                        },
                        {
                            "identifier": "WorkMode",
                            "dataType": {
                                "specs": {
                                    "0": "手动",
                                    "1": "阅读",
                                    "2": "影院",
                                    "3": "夜灯",
                                    "4": "生活",
                                    "5": "柔和"
                                },
                                "type": "enum"
                            },
                            "name": "工作模式"
                        }
                    ],
                    "identifier": "post",
                    "method": "thing.event.property.post",
                    "name": "post",
                    "type": "info",
                    "required": true,
                    "desc": "属性上报"
                },
                {
                    "outputData": [
                        {
                            "identifier": "ErrorCode",
                            "dataType": {
                                "specs": {
                                    "0": "正常"
                                },
                                "type": "enum"
                            },
                            "name": "故障代码"
                        }
                    ],
                    "identifier": "Error",
                    "method": "thing.event.Error.post",
                    "name": "故障上报",
                    "type": "info",
                    "required": true
                }
            ]
        },
        "message": "success",
        "localizedMsg": null,
        "class": "com.aliyun.iotx.common.base.service.IoTxResult"
    }
    					

根据产品key获取物的模板

定义描述

path 版本 描述 是否需要用户身份的鉴权
/thing/tsl/getByProducyKey 1.0.2 获取物的tsl功能模板(包含属性、事件、服务的定义) 是,客户端SDK需启用身份的鉴权,进行身份认证

请求参数

参数 类型 必填 描述
productKey String 产品Key
deviceName String deviceName

返回参数

示例

  • 请求示例
    {
        "id": "1509086454180",
        "version": "1.0",
        "request": {
            "apiVer": "1.0.2",
            "iotToken": "token"
        },
        "params": {
            "ProductKey": "xxxxxxxx",
            "deviceName": "xxxxxxxx"
        }
    }
    					
  • 正常返回示例
    {
        "code": 200,
        "data": {
            "schema": "http://aliyun/iot/thing/desc/schema",
            "profile": {
                "productKey": "a1xqv8AGpck",
                "deviceName": "YzqEnI5DY03rxLS2pjjo"
            },
            "link": "/sys/a1xqv8AGpck/YzqEnI5DY03rxLS2pjjo/thing/",
            "services": [
                {
                    "outputData": [
    
                    ],
                    "identifier": "set",
                    "inputData": [
                        {
                            "identifier": "LightSwitch",
                            "dataType": {
                                "specs": {
                                    "0": "关闭",
                                    "1": "开启"
                                },
                                "type": "bool"
                            },
                            "name": "主灯开关"
                        },
                        {
                            "identifier": "ColorTemperature",
                            "dataType": {
                                "specs": {
                                    "unit": "K",
                                    "min": "2700",
                                    "unitName": "开尔文",
                                    "max": "6500"
                                },
                                "type": "int"
                            },
                            "name": "冷暖色温"
                        },
                        {
                            "identifier": "Brightness",
                            "dataType": {
                                "specs": {
                                    "unit": "%",
                                    "min": "0",
                                    "unitName": "百分比",
                                    "max": "100"
                                },
                                "type": "int"
                            },
                            "name": "明暗度"
                        },
                        {
                            "identifier": "HSVColor",
                            "dataType": {
                                "specs": [
                                    {
                                        "identifier": "Hue",
                                        "dataType": {
                                            "specs": {
                                                "unit": "°",
                                                "min": "0",
                                                "unitName": "度",
                                                "max": "360"
                                            },
                                            "type": "int"
                                        },
                                        "name": "色调"
                                    },
                                    {
                                        "identifier": "Saturation",
                                        "dataType": {
                                            "specs": {
                                                "unit": "%",
                                                "min": "0",
                                                "unitName": "百分比",
                                                "max": "100"
                                            },
                                            "type": "int"
                                        },
                                        "name": "饱和度"
                                    },
                                    {
                                        "identifier": "Value",
                                        "dataType": {
                                            "specs": {
                                                "unit": "%",
                                                "min": "0",
                                                "unitName": "百分比",
                                                "max": "100"
                                            },
                                            "type": "int"
                                        },
                                        "name": "明度"
                                    }
                                ],
                                "type": "struct"
                            },
                            "name": "HSV调色"
                        },
                        {
                            "identifier": "HSLColor",
                            "dataType": {
                                "specs": [
                                    {
                                        "identifier": "Hue",
                                        "dataType": {
                                            "specs": {
                                                "unit": "°",
                                                "min": "0",
                                                "unitName": "度",
                                                "max": "360"
                                            },
                                            "type": "int"
                                        },
                                        "name": "色调"
                                    },
                                    {
                                        "identifier": "Saturation",
                                        "dataType": {
                                            "specs": {
                                                "unit": "%",
                                                "min": "0",
                                                "unitName": "百分比",
                                                "max": "100"
                                            },
                                            "type": "int"
                                        },
                                        "name": "饱和度"
                                    },
                                    {
                                        "identifier": "Lightness",
                                        "dataType": {
                                            "specs": {
                                                "unit": "%",
                                                "min": "0",
                                                "unitName": "百分比",
                                                "max": "100"
                                            },
                                            "type": "int"
                                        },
                                        "name": "亮度"
                                    }
                                ],
                                "type": "struct"
                            },
                            "name": "HSL调色"
                        },
                        {
                            "identifier": "RGBColor",
                            "dataType": {
                                "specs": [
                                    {
                                        "identifier": "Red",
                                        "dataType": {
                                            "specs": {
                                                "min": "0",
                                                "unitName": "无",
                                                "max": "255"
                                            },
                                            "type": "int"
                                        },
                                        "name": "红色"
                                    },
                                    {
                                        "identifier": "Green",
                                        "dataType": {
                                            "specs": {
                                                "min": "0",
                                                "unitName": "无",
                                                "max": "255"
                                            },
                                            "type": "int"
                                        },
                                        "name": "绿色"
                                    },
                                    {
                                        "identifier": "Blue",
                                        "dataType": {
                                            "specs": {
                                                "min": "0",
                                                "unitName": "无",
                                                "max": "255"
                                            },
                                            "type": "int"
                                        },
                                        "name": "蓝色"
                                    }
                                ],
                                "type": "struct"
                            },
                            "name": "RGB调色"
                        },
                        {
                            "identifier": "NightLightSwitch",
                            "dataType": {
                                "specs": {
                                    "0": "关闭",
                                    "1": "开启"
                                },
                                "type": "bool"
                            },
                            "name": "夜灯开关"
                        },
                        {
                            "identifier": "WorkMode",
                            "dataType": {
                                "specs": {
                                    "0": "手动",
                                    "1": "阅读",
                                    "2": "影院",
                                    "3": "夜灯",
                                    "4": "生活",
                                    "5": "柔和"
                                },
                                "type": "enum"
                            },
                            "name": "工作模式"
                        }
                    ],
                    "method": "thing.service.property.set",
                    "name": "set",
                    "required": true,
                    "callType": "sync",
                    "desc": "属性设置"
                },
                {
                    "outputData": [
                        {
                            "identifier": "LightSwitch",
                            "dataType": {
                                "specs": {
                                    "0": "关闭",
                                    "1": "开启"
                                },
                                "type": "bool"
                            },
                            "name": "主灯开关"
                        },
                        {
                            "identifier": "ColorTemperature",
                            "dataType": {
                                "specs": {
                                    "unit": "K",
                                    "min": "2700",
                                    "unitName": "开尔文",
                                    "max": "6500"
                                },
                                "type": "int"
                            },
                            "name": "冷暖色温"
                        },
                        {
                            "identifier": "Brightness",
                            "dataType": {
                                "specs": {
                                    "unit": "%",
                                    "min": "0",
                                    "unitName": "百分比",
                                    "max": "100"
                                },
                                "type": "int"
                            },
                            "name": "明暗度"
                        },
                        {
                            "identifier": "HSVColor",
                            "dataType": {
                                "specs": [
                                    {
                                        "identifier": "Hue",
                                        "dataType": {
                                            "specs": {
                                                "unit": "°",
                                                "min": "0",
                                                "unitName": "度",
                                                "max": "360"
                                            },
                                            "type": "int"
                                        },
                                        "name": "色调"
                                    },
                                    {
                                        "identifier": "Saturation",
                                        "dataType": {
                                            "specs": {
                                                "unit": "%",
                                                "min": "0",
                                                "unitName": "百分比",
                                                "max": "100"
                                            },
                                            "type": "int"
                                        },
                                        "name": "饱和度"
                                    },
                                    {
                                        "identifier": "Value",
                                        "dataType": {
                                            "specs": {
                                                "unit": "%",
                                                "min": "0",
                                                "unitName": "百分比",
                                                "max": "100"
                                            },
                                            "type": "int"
                                        },
                                        "name": "明度"
                                    }
                                ],
                                "type": "struct"
                            },
                            "name": "HSV调色"
                        },
                        {
                            "identifier": "HSLColor",
                            "dataType": {
                                "specs": [
                                    {
                                        "identifier": "Hue",
                                        "dataType": {
                                            "specs": {
                                                "unit": "°",
                                                "min": "0",
                                                "unitName": "度",
                                                "max": "360"
                                            },
                                            "type": "int"
                                        },
                                        "name": "色调"
                                    },
                                    {
                                        "identifier": "Saturation",
                                        "dataType": {
                                            "specs": {
                                                "unit": "%",
                                                "min": "0",
                                                "unitName": "百分比",
                                                "max": "100"
                                            },
                                            "type": "int"
                                        },
                                        "name": "饱和度"
                                    },
                                    {
                                        "identifier": "Lightness",
                                        "dataType": {
                                            "specs": {
                                                "unit": "%",
                                                "min": "0",
                                                "unitName": "百分比",
                                                "max": "100"
                                            },
                                            "type": "int"
                                        },
                                        "name": "亮度"
                                    }
                                ],
                                "type": "struct"
                            },
                            "name": "HSL调色"
                        },
                        {
                            "identifier": "RGBColor",
                            "dataType": {
                                "specs": [
                                    {
                                        "identifier": "Red",
                                        "dataType": {
                                            "specs": {
                                                "min": "0",
                                                "unitName": "无",
                                                "max": "255"
                                            },
                                            "type": "int"
                                        },
                                        "name": "红色"
                                    },
                                    {
                                        "identifier": "Green",
                                        "dataType": {
                                            "specs": {
                                                "min": "0",
                                                "unitName": "无",
                                                "max": "255"
                                            },
                                            "type": "int"
                                        },
                                        "name": "绿色"
                                    },
                                    {
                                        "identifier": "Blue",
                                        "dataType": {
                                            "specs": {
                                                "min": "0",
                                                "unitName": "无",
                                                "max": "255"
                                            },
                                            "type": "int"
                                        },
                                        "name": "蓝色"
                                    }
                                ],
                                "type": "struct"
                            },
                            "name": "RGB调色"
                        },
                        {
                            "identifier": "NightLightSwitch",
                            "dataType": {
                                "specs": {
                                    "0": "关闭",
                                    "1": "开启"
                                },
                                "type": "bool"
                            },
                            "name": "夜灯开关"
                        },
                        {
                            "identifier": "WorkMode",
                            "dataType": {
                                "specs": {
                                    "0": "手动",
                                    "1": "阅读",
                                    "2": "影院",
                                    "3": "夜灯",
                                    "4": "生活",
                                    "5": "柔和"
                                },
                                "type": "enum"
                            },
                            "name": "工作模式"
                        }
                    ],
                    "identifier": "get",
                    "inputData": [
                        "LightSwitch",
                        "ColorTemperature",
                        "Brightness",
                        "HSVColor",
                        "HSLColor",
                        "RGBColor",
                        "NightLightSwitch",
                        "WorkMode"
                    ],
                    "method": "thing.service.property.get",
                    "name": "get",
                    "required": true,
                    "callType": "sync",
                    "desc": "属性获取"
                },
                {
                    "outputData": [
    
                    ],
                    "identifier": "ToggleLightSwitch",
                    "inputData": [
    
                    ],
                    "method": "thing.service.ToggleLightSwitch",
                    "name": "翻转主灯开关",
                    "required": false,
                    "callType": "async"
                }
            ],
            "properties": [
                {
                    "identifier": "LightSwitch",
                    "dataType": {
                        "specs": {
                            "0": "关闭",
                            "1": "开启"
                        },
                        "type": "bool"
                    },
                    "name": "主灯开关",
                    "accessMode": "rw",
                    "required": true
                },
                {
                    "identifier": "ColorTemperature",
                    "dataType": {
                        "specs": {
                            "unit": "K",
                            "min": "2700",
                            "unitName": "开尔文",
                            "max": "6500"
                        },
                        "type": "int"
                    },
                    "name": "冷暖色温",
                    "accessMode": "rw",
                    "required": false
                },
                {
                    "identifier": "Brightness",
                    "dataType": {
                        "specs": {
                            "unit": "%",
                            "min": "0",
                            "unitName": "百分比",
                            "max": "100"
                        },
                        "type": "int"
                    },
                    "name": "明暗度",
                    "accessMode": "rw",
                    "required": false
                },
                {
                    "identifier": "HSVColor",
                    "dataType": {
                        "specs": [
                            {
                                "identifier": "Hue",
                                "dataType": {
                                    "specs": {
                                        "unit": "°",
                                        "min": "0",
                                        "unitName": "度",
                                        "max": "360"
                                    },
                                    "type": "int"
                                },
                                "name": "色调"
                            },
                            {
                                "identifier": "Saturation",
                                "dataType": {
                                    "specs": {
                                        "unit": "%",
                                        "min": "0",
                                        "unitName": "百分比",
                                        "max": "100"
                                    },
                                    "type": "int"
                                },
                                "name": "饱和度"
                            },
                            {
                                "identifier": "Value",
                                "dataType": {
                                    "specs": {
                                        "unit": "%",
                                        "min": "0",
                                        "unitName": "百分比",
                                        "max": "100"
                                    },
                                    "type": "int"
                                },
                                "name": "明度"
                            }
                        ],
                        "type": "struct"
                    },
                    "name": "HSV调色",
                    "accessMode": "rw",
                    "required": false
                },
                {
                    "identifier": "HSLColor",
                    "dataType": {
                        "specs": [
                            {
                                "identifier": "Hue",
                                "dataType": {
                                    "specs": {
                                        "unit": "°",
                                        "min": "0",
                                        "unitName": "度",
                                        "max": "360"
                                    },
                                    "type": "int"
                                },
                                "name": "色调"
                            },
                            {
                                "identifier": "Saturation",
                                "dataType": {
                                    "specs": {
                                        "unit": "%",
                                        "min": "0",
                                        "unitName": "百分比",
                                        "max": "100"
                                    },
                                    "type": "int"
                                },
                                "name": "饱和度"
                            },
                            {
                                "identifier": "Lightness",
                                "dataType": {
                                    "specs": {
                                        "unit": "%",
                                        "min": "0",
                                        "unitName": "百分比",
                                        "max": "100"
                                    },
                                    "type": "int"
                                },
                                "name": "亮度"
                            }
                        ],
                        "type": "struct"
                    },
                    "name": "HSL调色",
                    "accessMode": "rw",
                    "required": false
                },
                {
                    "identifier": "RGBColor",
                    "dataType": {
                        "specs": [
                            {
                                "identifier": "Red",
                                "dataType": {
                                    "specs": {
                                        "min": "0",
                                        "unitName": "无",
                                        "max": "255"
                                    },
                                    "type": "int"
                                },
                                "name": "红色"
                            },
                            {
                                "identifier": "Green",
                                "dataType": {
                                    "specs": {
                                        "min": "0",
                                        "unitName": "无",
                                        "max": "255"
                                    },
                                    "type": "int"
                                },
                                "name": "绿色"
                            },
                            {
                                "identifier": "Blue",
                                "dataType": {
                                    "specs": {
                                        "min": "0",
                                        "unitName": "无",
                                        "max": "255"
                                    },
                                    "type": "int"
                                },
                                "name": "蓝色"
                            }
                        ],
                        "type": "struct"
                    },
                    "name": "RGB调色",
                    "accessMode": "rw",
                    "required": false
                },
                {
                    "identifier": "NightLightSwitch",
                    "dataType": {
                        "specs": {
                            "0": "关闭",
                            "1": "开启"
                        },
                        "type": "bool"
                    },
                    "name": "夜灯开关",
                    "accessMode": "rw",
                    "required": false
                },
                {
                    "identifier": "WorkMode",
                    "dataType": {
                        "specs": {
                            "0": "手动",
                            "1": "阅读",
                            "2": "影院",
                            "3": "夜灯",
                            "4": "生活",
                            "5": "柔和"
                        },
                        "type": "enum"
                    },
                    "name": "工作模式",
                    "accessMode": "rw",
                    "required": false
                }
            ],
            "events": [
                {
                    "outputData": [
                        {
                            "identifier": "LightSwitch",
                            "dataType": {
                                "specs": {
                                    "0": "关闭",
                                    "1": "开启"
                                },
                                "type": "bool"
                            },
                            "name": "主灯开关"
                        },
                        {
                            "identifier": "ColorTemperature",
                            "dataType": {
                                "specs": {
                                    "unit": "K",
                                    "min": "2700",
                                    "unitName": "开尔文",
                                    "max": "6500"
                                },
                                "type": "int"
                            },
                            "name": "冷暖色温"
                        },
                        {
                            "identifier": "Brightness",
                            "dataType": {
                                "specs": {
                                    "unit": "%",
                                    "min": "0",
                                    "unitName": "百分比",
                                    "max": "100"
                                },
                                "type": "int"
                            },
                            "name": "明暗度"
                        },
                        {
                            "identifier": "HSVColor",
                            "dataType": {
                                "specs": [
                                    {
                                        "identifier": "Hue",
                                        "dataType": {
                                            "specs": {
                                                "unit": "°",
                                                "min": "0",
                                                "unitName": "度",
                                                "max": "360"
                                            },
                                            "type": "int"
                                        },
                                        "name": "色调"
                                    },
                                    {
                                        "identifier": "Saturation",
                                        "dataType": {
                                            "specs": {
                                                "unit": "%",
                                                "min": "0",
                                                "unitName": "百分比",
                                                "max": "100"
                                            },
                                            "type": "int"
                                        },
                                        "name": "饱和度"
                                    },
                                    {
                                        "identifier": "Value",
                                        "dataType": {
                                            "specs": {
                                                "unit": "%",
                                                "min": "0",
                                                "unitName": "百分比",
                                                "max": "100"
                                            },
                                            "type": "int"
                                        },
                                        "name": "明度"
                                    }
                                ],
                                "type": "struct"
                            },
                            "name": "HSV调色"
                        },
                        {
                            "identifier": "HSLColor",
                            "dataType": {
                                "specs": [
                                    {
                                        "identifier": "Hue",
                                        "dataType": {
                                            "specs": {
                                                "unit": "°",
                                                "min": "0",
                                                "unitName": "度",
                                                "max": "360"
                                            },
                                            "type": "int"
                                        },
                                        "name": "色调"
                                    },
                                    {
                                        "identifier": "Saturation",
                                        "dataType": {
                                            "specs": {
                                                "unit": "%",
                                                "min": "0",
                                                "unitName": "百分比",
                                                "max": "100"
                                            },
                                            "type": "int"
                                        },
                                        "name": "饱和度"
                                    },
                                    {
                                        "identifier": "Lightness",
                                        "dataType": {
                                            "specs": {
                                                "unit": "%",
                                                "min": "0",
                                                "unitName": "百分比",
                                                "max": "100"
                                            },
                                            "type": "int"
                                        },
                                        "name": "亮度"
                                    }
                                ],
                                "type": "struct"
                            },
                            "name": "HSL调色"
                        },
                        {
                            "identifier": "RGBColor",
                            "dataType": {
                                "specs": [
                                    {
                                        "identifier": "Red",
                                        "dataType": {
                                            "specs": {
                                                "min": "0",
                                                "unitName": "无",
                                                "max": "255"
                                            },
                                            "type": "int"
                                        },
                                        "name": "红色"
                                    },
                                    {
                                        "identifier": "Green",
                                        "dataType": {
                                            "specs": {
                                                "min": "0",
                                                "unitName": "无",
                                                "max": "255"
                                            },
                                            "type": "int"
                                        },
                                        "name": "绿色"
                                    },
                                    {
                                        "identifier": "Blue",
                                        "dataType": {
                                            "specs": {
                                                "min": "0",
                                                "unitName": "无",
                                                "max": "255"
                                            },
                                            "type": "int"
                                        },
                                        "name": "蓝色"
                                    }
                                ],
                                "type": "struct"
                            },
                            "name": "RGB调色"
                        },
                        {
                            "identifier": "NightLightSwitch",
                            "dataType": {
                                "specs": {
                                    "0": "关闭",
                                    "1": "开启"
                                },
                                "type": "bool"
                            },
                            "name": "夜灯开关"
                        },
                        {
                            "identifier": "WorkMode",
                            "dataType": {
                                "specs": {
                                    "0": "手动",
                                    "1": "阅读",
                                    "2": "影院",
                                    "3": "夜灯",
                                    "4": "生活",
                                    "5": "柔和"
                                },
                                "type": "enum"
                            },
                            "name": "工作模式"
                        }
                    ],
                    "identifier": "post",
                    "method": "thing.event.property.post",
                    "name": "post",
                    "type": "info",
                    "required": true,
                    "desc": "属性上报"
                },
                {
                    "outputData": [
                        {
                            "identifier": "ErrorCode",
                            "dataType": {
                                "specs": {
                                    "0": "正常"
                                },
                                "type": "enum"
                            },
                            "name": "故障代码"
                        }
                    ],
                    "identifier": "Error",
                    "method": "thing.event.Error.post",
                    "name": "故障上报",
                    "type": "info",
                    "required": true
                }
            ]
        },
        "message": "success",
        "localizedMsg": null,
        "class": "com.aliyun.iotx.common.base.service.IoTxResult"
    }
    					

获取物的属性

定义描述

path 版本 描述 是否需要用户身份的鉴权
/thing/properties/get 1.0.2 获取物的所有属性快照数据 是,客户端SDK需启用身份的鉴权,进行身份认证

请求参数

参数 类型 必填 描述
iotId String 物的标识符

返回参数

参数 类型 必有 描述
value Object 属性对应的数据
time Long 属性采集时间

示例

  • 请求示例
    {
        "id": "1509086454180",
        "version": "1.0",
        "request": {
            "apiVer": "1.0.2",
            "iotToken": "token"
        },
        "params": {
            "iotId": "D95D242941CE821ECCE4F31A2697"
        }
    }
    					
  • 正常返回示例
    {
      "code": 200,
      "data": {
        "_sys_device_mid": {
          "time": 1516356290173,
          "value": "example.demo.module-id"
        },
        "WorkMode": {
          "time": 1516347450295,
          "value": 0
        },
        "_sys_device_pid": {
          "time": 1516356290173,
          "value": "example.demo.partner-id"
        }
      },
      "message": "success",
      "localizedMsg": null
    }
    					

触发物的服务

定义描述

path 版本 描述 是否需要用户身份的鉴权
/thing/service/invoke 1.0.2 触发物的服务 是,客户端SDK需启用身份的鉴权,进行身份认证

请求参数

参数 类型 必填 描述
iotId String 物的标识符
identifier String 服务标识符
args JSON 服务入参

返回参数

参数 类型 必有 描述
data Object 该返回值类型及值取决于设备端实现逻辑

示例

  • 请求示例
    {
        "id": "1509086454180",
        "version": "1.0",
        "request": {
            "apiVer": "1.0.2",
            "iotToken": "token"
        },
        "params": {
            "iotId": "D95D242941CE821ECCE4F31A2697",
            "identifier": "xxxx",
            "args": {}
        }
    }
    					
  • 正常返回示例
    {
      "code": 200,
      "data": null,
      "message": "success",
      "localizedMsg": ""
    }
    					

获取物的连接状态

定义描述

path 版本 描述 是否需要用户身份的鉴权
/thing/status/get 1.0.2 获取物的连接状态 是,客户端SDK需启用身份的鉴权,进行身份认证

请求参数

参数 类型 必填 描述
iotId String 物的唯一标识符

返回参数

参数 类型 必有 描述
status Integer 设备状态 0 - 未激活,1-在线, 3 - 离线, 8 - 禁用
time Long 状态变更时间

示例

  • 请求示例
    {
        "id": "1509086454180",
        "version": "1.0",
        "request": {
            "apiVer": "1.0.2",
            "iotToken": "token"
        },
        "params": {
            "iotId": "D95D242941CE821ECCE4F31A2697"
        }
    }
    					
  • 正常返回示例
    {
      "code": 200,
      "data": {
        "time": 1517923297000,
        "status": 3
      },
      "message": "success",
      "localizedMsg": null,
    }
    					

设置设备扩展信息

单个设备的标签不能超过10个。

定义描述

path 版本 描述 是否需要用户身份的鉴权
/thing/extended/property/set 1.0.2 设置物的扩展属性数据 是,客户端SDK需启用身份的鉴权,进行身份认证

请求参数

参数 类型 必填 描述
iotId String 物的唯一标识符
dataKey String 扩展属性标识符(小于64个字符)
dataValue String 扩展属性的值(小于128个字符)

返回参数

示例

  • 请求示例
    {
        "id": "1509086454180",
        "version": "1.0",
        "request": {
            "apiVer": "1.0.2",
            "iotToken": "token"
        },
        "params": {
            "iotId": "D95D242941CE821ECCE4F31A2697",
            "dataKey": "xxxx",
            "dataValue": "xxxx"
        }
    }
    					
  • 正常返回示例
    {
      "code": 200,
      "message": "success",
      "localizedMsg": null,
      "data": null
    }
    					

获取设备扩展信息

定义描述

path 版本 描述 是否需要用户身份的鉴权
/thing/extended/property/get 1.0.2 获取物的扩展属性的数据 是,客户端SDK需启用身份的鉴权,进行身份认证

请求参数

参数 类型 必填 描述
iotId String 物的唯一标识符
dataKey String 扩展属性标识符

返回参数

参数 类型 必有 描述
data String 扩展属性的值

示例

  • 请求示例
    {
        "id": "1509086454180",
        "version": "1.0",
        "request": {
            "apiVer": "1.0.2",
            "iotToken": "token"
        },
        "params": {
            "iotId": "D95D242941CE821ECCE4F31A2697",
            "dataKey": "xxxx"
        }
    }
    					
  • 正常返回示例
    {
      "code": 200,
      "message": "success",
      "localizedMsg": null,
      "data": "xxxx"
    }
    					

创建预约定时场景

定义描述

path 版本 描述 是否需要用户身份的鉴权
/scene/timing/create 1.0.2 创建设备的预约定时场景 是,客户端SDK需启用身份的鉴权,进行身份认证
说明 预约定时场景与设备相关联,因此不能使用 /scene/update, /living/scene/switch 等接口来更新、启停。如有这方面需要,请使用 /scene/timing/update 接口。同时不支持手机消息推送 action。

请求参数

参数 类型 必填 描述
iotId String 设备ID
enable Boolean true打开 false关闭
name String 用户给场景起的名称
icon String 场景图标
description String 对场景的描述
triggers Object trigger对象
conditions Object condition对象
actions Array action对象

action不能为空,trigger可以空,condition可以空。

返回参数

参数 类型 描述
sceneId String 新建的场景Id

示例

  • 请求示例
    {
      "id": "1509086454180",
      "version": "1.0",
      "request": {
        "apiVer": "1.0.2",
        "iotToken": "token"
      },
      "params": {
        "actions": [{
          "params": {
            "compareValue": 1,
            "iotId": "zjoOvFZWenq1xdxRyvcI0010c4dc00",
            "compareType": ">",
            "propertyName": "Qu0wChfloat",
            "propertyValue": 1
          },
          "uri": "action/device/setProperty"
        }],
            "iotId":"zjoOvFZWenq1xdxRyvcI0010c4dc00",
        "enable": true,
        "icon": "https://g.aliplus.com/scene_icons/default.png",
        "name": "一样",
        "triggers": {
          "params": {},
          "items": [{
            "params": {
              "cron": "1 1 * * *",
              "cronType": "linux",
              "timezoneID": "Asia/Shanghai"
            },
            "uri": "trigger/timer"
          }],
          "uri": "logical/or"
        }
      }
    }
  • 正常返回示例
    {
      "code": 200,
      "data": "0c96536b09404a50ac6645c5306a6657",
      "message": "success"
    }

更新预约定时场景

定义描述

path 版本 描述 是否需要用户身份的鉴权
/scene/timing/update 1.0.2 更新设备的预约定时场景 是,客户端SDK需启用身份的鉴权,进行身份认证

请求参数

参数 类型 必填 描述
iotId String 设备ID
sceneId String 场景ID
enable Boolean true打开 false关闭
name String 用户给场景起的名称
icon String 场景图标
description String 对场景的描述
triggers Object trigger对象
conditions Object condition对象
actions Array action对象

action不能为空,trigger可以空,condition可以空。

返回参数

参数 类型 描述
sceneId String 场景Id

示例

  • 请求示例
    {
      "id": "1509086454180",
      "version": "1.0",
      "request": {
        "apiVer": "1.0.2",
        "iotToken": "token"
      },
      "params": {
        "actions": [{
          "params": {
            "compareValue": 0,
            "iotId": "gaI0CRK2GV7KmDVc8gk300109b3700",
            "compareType": {
              "i18nKey": "scene.common.compareType.equal",
              "type": "=="
            },
            "propertyName": "NightLightSwitch",
            "propertyValue": 0
          },
          "uri": "action/device/setProperty",
          "status": 1
        }],
        "conditions": {
          "params": {},
          "items": [{
            "params": {
              "compareValue": 0,
              "iotId": "gaI0CRK2GV7KmDVc8gk300109b3700",
              "compareType": "==",
              "propertyName": "LightSwitch",
              "propertyValue": 0
            },
            "uri": "condition/device/property",
            "status": 1
          }],
          "uri": "logical/and"
        },
        "enable": true,
        "icon": "https://g.aliplus.com/scene_icons/default.png",
        "name": "",
        "sceneId": "bdc60beb0e6a4a24a8e03b417d617697",
            "iotId": "gaI0CRK2GV7KmDVc8gk300109b3700",
        "triggers": {
          "params": {},
          "items": [{
            "params": {
              "cron": "0 0 * * *",
              "cronType": "linux",
              "timezoneID": "Asia/Shanghai"
            },
            "uri": "trigger/timer",
            "status": 1
          }],
          "uri": "logical/or"
        }
      }
    }
  • 正常返回示例
    {
      "code": 200,
      "data": "0c96536b09404a50ac6645c5306a6657",
      "message": "success"
    }

删除预约定时场景

定义描述

path 版本 描述 是否需要用户身份的鉴权
/scene/timing/delete 1.0.2 删除定时场景 是,客户端SDK需启用身份的鉴权,进行身份认证

请求参数

参数 类型 必填 描述
iotId String 设备Id
sceneId String 场景Id

返回参数

参数 类型 描述
sceneId String 删除的场景Id

示例

  • 请求示例
    {
      "id": "1509086454180",
      "version": "1.0",
      "request": {
        "apiVer": "1.0.2",
        "iotToken": "token"
      },
      "params": {
        "sceneId": "0c96536b09404a50ac6645c5306a6657",
            "iotId": "gaI0CRK2GV7KmDVc8gk300109b3700"
      }
    }
  • 正常返回示例
    {
      "code": 200,
      "data": "0c96536b09404a50ac6645c5306a6657",
      "message": "success"
    }

获取预约定时场景详情

定义描述

path 版本 描述 是否需要用户身份的鉴权
/scene/timing/info/get 1.0.2 获取定时场景的详情 是,客户端SDK需启用身份的鉴权,进行身份认证

请求参数

参数 类型 必填 描述
iotId String 设备Id
sceneId String 待查询的场景Id

返回参数

参数 类型 约束与枚举 描述
sceneId String 场景id
enable Boolean true 打开false 关闭 场景开关
status Integer 1 运行2 失效 场景运行时状态
name String 用户给场景起的名称
icon String 场景图标
triggers Object triggers对象的String。trigger对象定义在下面
conditions Object conditions对象的String
actions Array actions对象的String

示例

  • 请求示例
    {
      "id": "1509086454180",
      "version": "1.0",
      "request": {
        "apiVer": "1.0.2",
        "iotToken": "token"
      },
      "params": {
        "sceneId": "260de82dd0cc484a80415a104691be22",
            "iotId": "gaI0CRK2GV7KmDVc8gk300109b3700"
      }
    }
  • 正常返回示例
    {
      "code": 200,
      "data": {
        "actions": [{
          "params": {
            "compareValue": -127,
            "localizedProductName": "电热毯-hy",
            "iotId": "SY7a6IDsvT0m2tTdzm0z00103d0c00",
            "compareType": "==",
            "propertyName": "WiFI_SNR",
            "localizedPropertyName": "信噪比",
            "deviceNickName": "电热毯-hy",
            "propertyValue": -127,
            "localizedCompareValueName": "-127",
            "productKey": "b1DQZAMjUql",
            "propertyItems": {
              "WiFI_SNR": -127
            },
            "deviceName": "hyhyhy4"
          },
          "uri": "action/device/setProperty",
          "status": 0
        }],
        "enable": true,
        "icon": "https://g.aliplus.com/scene_icons/default.png",
        "name": "电热毯",
        "sceneId": "260de82dd0cc484a80415a104691be22",
        "status": 2
      },
      "message": "success"
    }

查询预约定时场景列表

定义描述

path 版本 描述 是否需要用户身份的鉴权
/scene/timing/list/get 1.0.2 查询定时场景列表 是,客户端SDK需启用身份的鉴权,进行身份认证

请求参数

参数 类型 必填 约束 描述
iotId String 设备ID
pageNo Integer 不小于1 页序号
pageSize Integer 不小于1,一般不大于50 每页数量

返回参数

参数 类型 枚举 描述
total Integer 总条目数
pageNo Integer 从1开始的页序号
pageSize Integer 每页数量
scenes Array 返回当前页条目
scenes.id String 场景id
scene.status Integer 1 场景上线2 场景下线 场景运行时状态
scene.enable Boolean true 场景置为打开false场景置为关闭 场景开关(App上的开关)
scene.icon String 场景图标连接
scene.name String 场景名称
scene.description String 场景描述

示例

  • 请求示例
    {
      "id": "1509086454180",
      "version": "1.0",
      "request": {
        "apiVer": "1.0.2",
        "iotToken": "token"
      },
      "params": {
        "pageSize": 20,
        "pageNo": 1,
        "iotId": "zjoOvFZWenq1xdxRyvcI0010c4dc00"
      }
    }
  • 正常返回示例
    {
      "code": 200,
      "data": {
        "pageNo": 1,
        "pageSize": 20,
        "scenes": [{
          "description": "电热毯-hy-信噪比--127 ",
          "enable": true,
          "icon": "https://g.aliplus.com/scene_icons/default.png",
          "id": "260de82dd0cc484a80415a104691be22",
          "name": "电热毯",
          "status": 2
        }, {
          "description": "light-hy-LightSwitch-1, shuijin-hy-WiFI_SNR--127 ",
          "enable": true,
          "icon": "https://g.aliplus.com/scene_icons/default.png",
          "id": "45dc6fc753d345b69b01d29f6974e5f7",
          "name": "凉宫",
          "status": 1
        }],
        "total": 2
      },
      "message": "success"
    }

查询用户的小组件设备列表

定义描述

path 版本 描述 是否需要用户身份的鉴权
/iotx/ilop/queryComponentProduct 1.0.0 查询用户的小组件设备列表 是,客户端SDK需启用身份的鉴权,进行身份认证

请求参数

返回参数

参数 类型 必有 描述
data 数组 小组件设备列表

小组件设备详情

参数 类型 必有 描述
productKey string 产品pk
deviceName string 设备名称
iotId string 设备id
properties 数据 属性列表
nickName string 别名
productName string 产品名称
iconUrl string 图片地址
deviceStatus int 设备状态

属性列表详情

参数 类型 必有 描述
propertyIdentifier string 属性id
propertyName string 属性名称
propertyValue string 属性取值
propertyDataType string 属性取值类型

示例

  • 请求示例
    {
        "id": "1509086454180",
        "version": "1.0",
        "request": {
            "apiVer": "1.0.0",
            "iotToken": "token"
        },
        "params": {
        }
    }
    					
  • 正常返回示例
    {
      "code": 200,
      "message": "success",
      "localizedMsg": null,
      "data": [{
        "deviceName":"xxx",
        "deviceStatus":1,
        "iconUrl":"http://iotx-paas-admin.oss-cn-shanghai.aliyuncs.com/publish/image/xxxxxx.png",
        "iotId":"xxxxxx",
        "productKey":"xxx",
        "productName":"a",
        "properties":[{
          "propertyDataType":"bool",
          "propertyIdentifier":"PowerSwitch",
          "propertyName":"电源开关",
          "propertyValue":"1"}]
          },{
        "deviceName":"xxxx",
        "deviceStatus":1,
        "iconUrl":"http://iotx-paas-admin.oss-cn-shanghai.aliyuncs.com/publish/image/xxxxx.png",
        "iotId":"xxxx",
        "productKey":"xxx",
        "productName":"xxx",
        "properties":[{
          "propertyDataType":"bool",
          "propertyIdentifier":"LightSwitch",
          "propertyName":"主灯开关",
          "propertyValue":"0"
        }]
      }]
    }
    
    					

更新用户的小组件设备列表

定义描述

path 版本 描述 是否需要用户身份的鉴权
/iotx/ilop/updateComponentProduct 1.0.0 更新用户的小组件设备列表 是,客户端SDK需启用身份的鉴权,进行身份认证

请求参数

参数 类型 必填 描述
data 数组 小组件设备列表

小组件设备详情

参数 类型 必有 描述
productKey string 产品pk
deviceName string 设备名称
iotId string 设备id
properties 数据 属性列表
nickName string 别名
productName string 产品名称
iconUrl string 图片地址
deviceStatus int 设备状态
属性列表详情
参数 类型 必有 描述
propertyIdentifier string 属性id
propertyName string 属性名称
propertyValue string 属性取值
propertyDataType string 属性取值类型

返回参数

示例

  • 请求示例
    {
        "id": "1509086454180",
        "version": "1.0",
        "request": {
            "apiVer": "1.0.0",
            "iotToken": "token"
        },
        "params": {
          "componentProductList": [{
            "iotId":"xxxxxx",
            "productKey":"xxx"
          },{
            "iotId":"xxxxxx",
            "productKey":"xxx"
          }]
       }
    }
  • 正常返回示例
    {
      "code": 200,
      "message": "success",
      "localizedMsg": null,
      "data": null
    }
    					

查询用户小组件设备的属性列表

定义描述

path 版本 描述 是否需要用户身份的鉴权
/iotx/ilop/queryComponentProperty 1.0.0 查询用户小组件设备的属性列表 是,客户端SDK需启用身份的鉴权,进行身份认证

请求参数

参数 类型 必填 描述
productKey string 产品key
iotId string 设备id
query struct 查询条件

查询条件详情

参数 类型 必填 描述
dataType string 属性数据类型
I18Language string 多语言
languageList array 多语言列表
allLanguage bool 是否取全部多语言
replaceOrigin bool 是否替换默认语言

返回参数

参数 类型 必有 描述
propertyIdentifier string 属性id
propertyName string 属性名称
propertyValue string 属性取值
propertyDataType string 属性取值类型
added_component bool 是否添加至小组件中

示例

  • 请求示例
    {
        "id": "1509086454180",
        "version": "1.0",
        "request": {
            "apiVer": "1.0.0",
            "iotToken": "token"
        },
        "params": {
          "iotId":"xxxxxx",
          "productKey":"xxx",
          "query":{
            "dataType":"BOOL"
          }
        }
    }
    					
  • 正常返回示例
    {
      "code": 200,
      "message": "success",
      "localizedMsg": null,
      "data": [
        {"added_component":false,
         "dataType":"BOOL",
         "i18nDTO":{
           "i18nData":{"name":{"zh-CN":"电源开关"}}
         },
         "productKey":"xxxx",
         "propertyIdentifier":"PowerSwitch",
         "propertyName":"电源开关"}
      ]
    }