物的模型服务

更新时间:2019-07-29 11:49:51

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

获取物的基本信息

定义描述

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,
}

错误码

请参考公共错误码

设置设备扩展信息

定义描述

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

请求参数

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

返回参数

参数 类型 必有 描述

示例

请求示例

{
    "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 版本 描述 是否需要用户身份的鉴权
/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": [{
      "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":"电源开关"}
  ]
}

错误码

请参考公共错误码

results matching ""

    No results matching ""