物的管理服务类API

更新时间:2018-08-18 18:49:55

创建设备

定义描述

path 版本 描述
/thing/device/create 1.1.2 注册单个设备

请求参数

名称 类型 必要 描述 示例
productKey String 产品唯一标识符 testProductKey
deviceName String 设备名称 testDeviceName

正常返回示例

{
    "code": 200,
    "data": {
        "gmtModified": 1517918765000,
        "activeTime": null,
        "deviceKey": "testDeviceKey",
        "gmtCreate": 1500017648000,
        "productKey": "testProductKey",
        "statusLast": null,
        "mac": null,
        "netAddress": null,
        "deviceSecret": "testDeviceSecret",
        "iotId": "testIotId",
        "name": "testDevice",
        "tenantId": 1,
        "nickname": null,
        "sdkVersion": null,
        "sn": null,
        "thingType": "DEVICE",
        "region": "ch-shanghai",
        "firmwareVersion": "1.0.0",
        "rbacTenantId": "testTenantId",
        "ownerDomain": "testOwnerDomain",
        "status": 1
    },
    "message": "success",
    "localizedMsg": null
}

获取物的详情

定义描述

path 版本 描述
/thing/device/detail/list/get 1.1.2 获取物的详情列表

请求参数

名称 类型 必要 描述 示例
productKey String 产品唯一标识符 testProductKey
onlineStatus Int 设备在线/离线(null - 忽略在线状态,0 - 离线, 1 - 在线) 1
activeStatus Int 设备接入/激活(null - 忽略激活状态,0 - 接入,1 - 激活) 1
currentPage Int 查询的页数 1
pageSize Int 查询分页大小 10

正常返回示例

{
    "code": 200,
    "data": [
        {
            "latestOnlineTime": 1506308791000,
            "activeStatus": 1,
            "devAddress": null,
            "clientIp": null,
            "activeTime": null,
            "onlineStatus": 0,
            "productInfoDTO": {
                "image": null,
                "gmtModified": 1507701726000,
                "productModel": null,
                "netType": "NET_LORA",
                "dataFormat": null,
                "description": "测试灯光产品",
                "gmtCreate": 1507701726000,
                "productKey": "a15z5wt0K3k",
                "scriptId": null,
                "name": "testLightProduct",
                "region": "cn-shanghai",
                "rbacTenantId": null,
                "categoryId": 3,
                "classType": null,
                "status": null
            },
            "deviceDTO": {
                "gmtModified": 1502179810000,
                "activeTime": null,
                "deviceKey": "testDeviceKey",
                "gmtCreate": 1492141440000,
                "productKey": "a15z5wt0K3k",
                "mac": "23:4E:12:34:11",
                "netAddress": null,
                "iotId": "testIotId",
                "deviceSecret": "testDeviceSecret",
                "name": "testLight",
                "tenantId": 6,
                "nickname": null,
                "sdkVersion": "1.1",
                "sn": "3223233",
                "region": "daily",
                "firmwareVersion": "1.2",
                "ownerDomain": "testOwnerDomain",
                "rbacTenantId": "testTenantId",
                "status": 1
            },
            "attributes": {
                "sdkVersion": "1.1",
                "sn": "3223233",
                "time": 1502697429000,
                "firmwareVersion": "1.2",
                "mac": "23:4E:12:34:11",
                "iot": "test"
            },
            "appEui": null
        }
    ],
    "message": "success"
}

设置物的属性

定义描述

path 版本 描述
/thing/device/properties/set 1.1.2 设置物的属性

请求参数

名称 类型 必要 描述 示例
productKey String 产品唯一标识符 testProductKey
deviceName String 设备名称 testDeviceName
properties JSON 属性参数 {"lightStatus":"on", "brightness":"10"}

正常返回示例

{
    "code": 200,
    "data": null,
    "message": "success",
    "localizedMsg": ""
}

获取物的数量

定义描述

path 版本 描述
/thing/device/count 1.1.2 获取物的数量

请求参数

名称 类型 必要 描述 示例
productKey String 产品唯一标识符 testProductKey
activeStatus Int 物的激活状态(null - 忽略激活状态,0 - 未激活,1 - 激活) 1
onlineStatus Int 物的在线状态(null - 忽略在线状态,0 - 离线,1 - 在线) 1

正常返回示例

{
    "code": 200,
    "data": 20,
    "message": "success",
    "localizedMsg": null
}

物的服务调用

定义描述

path 版本 描述
/thing/device/service/invoke 1.1.2 物的服务调用

请求参数

名称 类型 必要 描述 示例
productKey String 产品唯一标识符 testProductKey
deviceName String 设备名称 testDeviceName
inputParams JSON 服务入参 {"lightStatus":"on", "brightness":"10"}
method String 服务方法名称 LIGHT_ON_OFF

正常返回示例

{
    "code": 200,
    "data": null,
    "message": "success",
    "localizedMsg": ""
}

获取物的拓扑关系

定义描述

path 版本 描述
/thing/device/topo/get 1.1.2 获取物的拓扑关系

请求参数

名称 类型 必要 描述 示例
productKey String 产品唯一标识符 testProductKey
deviceName String 设备名称 testDeviceName
currentPage Int 当前页 1
pageSize Int 分页大小 10

正常返回示例

{
    "code": 200,
    "data": {
        "totalNum": 1,
        "items": [
            {
                "gmtModified": 1517913999000,
                "iotId": "testIotId",
                "subDeviceName": "testSubDevice",
                "subProductKey": "a17Nl887dIx",
                "id": 908608,
                "gmtCreate": 1515740847000,
                "productKey": "a15z5wt0K3k",
                "deviceName": "testLight",
                "subIotId": "testSubIotId",
                "status": "0"
            }
        ]
    },
    "message": "success",
    "localizedMsg": null
}

获取物的服务调用记录

定义描述

path 版本 描述
/thing/device/service/timeline/get 1.1.2 获取物的服务调用记录

请求参数

名称 类型 必要 描述 示例
productKey String 产品唯一标识符 testProductKey
deviceName String 设备名称 testDeviceName
serviceIdentifier String 服务标识符 lightOn
start Long 查询起始时间(时间戳) 1516543867348
end Long 查询终止时间 1516543872125
pageSize Int 查询分页大小 10
ordered Bool 查询顺序(true - 顺序,false - 倒序) true

正常返回示例

{
    "code": 200,
    "data": {
        "items": [
            {
                "argsValues": {
                    "LightSpray1": 5
                },
                "iotId": "0300MSKL03667c544f69342a74Sv4Za4",
                "serviceCode": "DeviceLightService",
                "resultValues": {
                    "LightSprays2": 10
                },
                "serviceName": "测试服务",
                "batchId": "455c45580c9246eead6a913e3faf8266",
                "timestamp": 1512370238829
            }
        ],
        "timestamp": 1512370238838
    },
    "message": "success",
    "localizedMsg": ""
}

获取物的属性上报数据

定义描述

path 版本 描述
/thing/device/property/timeline/get 1.1.2 获取物的属性上报数据

请求参数

名称 类型 必要 描述 示例
productKey String 产品唯一标识符 testProductKey
deviceName String 设备名称 testDeviceName
propertyIdentifier String 属性标识符 lightStatus
start Long 查询起始时间(时间戳) 1516543867348
end Long 查询终止时间(时间戳) 1516543872125
pageSize Int 查询分页大小 10
ordered Bool 查询顺序(true - 顺序,false - 倒序) 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
    }
}

获取物的指定属性快照数据

定义描述

path 版本 描述
/thing/device/property/query 1.1.2 获取物的指定属性快照数据

请求参数

名称 类型 必要 描述 示例
productKey String 产品唯一标识符 testProductKey
deviceName String 设备名称 testDeviceName
propertyIdentifier String 属性标识符 lightStatus

正常返回示例

{
    "code": 200,
    "message": "success",
    "data": [
        {
            "iotId;": "testIotId",
            "batchId": null,
            "attribute;": "lightStatus",
            "group;": null,
            "value": "on",
            "gmtModified": 1237891329
        }
    ]
}

获取物的全量属性快照数据

定义描述

path 版本 描述
/thing/device/properties/query 1.1.2 获取物的全量属性快照数据

请求参数

名称 类型 必要 描述 示例
productKey String 产品唯一标识符 testProductKey
deviceName String 设备名称 testDeviceName

正常返回示例

{
    "code": 200,
    "message": "success",
    "data": [
        {
            "iotId;": "testIotId",
            "batchId": "s3dl2w11s",
            "attribute;": "brightness",
            "value": "12",
            "gmtModified": 1237891329
        }
    ]
}

获取物的基本信息

定义描述

path 版本 描述
/thing/device/info/get 1.1.2 获取物的基本信息

请求参数

名称 类型 必要 描述 示例
productKey String 产品唯一标识符 testProductKey
deviceName String 设备名称 testDeviceName

正常返回示例

{
    "code": 200,
    "data": {
        "gmtModified": 1517918765000,
        "activeTime": null,
        "deviceKey": "Kq7rgvE2cNGcwtDexwJh",
        "gmtCreate": 1500017648000,
        "productKey": "kQGJJuTl0qA",
        "statusLast": null,
        "mac": null,
        "netAddress": null,
        "deviceSecret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        "iotId": "03iGXYVl03e23f667d90269c2ccwgzHG",
        "name": "Kq7rgvE2cNGcwtDexwJh",
        "tenantId": 7,
        "nickname": null,
        "sdkVersion": null,
        "sn": null,
        "thingType": "DEVICE",
        "region": "daily",
        "firmwareVersion": "1.0.0",
        "rbacTenantId": "ADSBCUYAGDCUDD827918327917",
        "ownerDomain": "kQGJJuTl0qA",
        "status": 1
    },
    "message": "success",
    "localizedMsg": null
}

获取物的扩展信息

定义描述

path 版本 描述
/thing/device/extendinfo/get 1.1.2 获取物的扩展信息

请求参数

名称 类型 必要 描述 示例
productKey String 产品唯一标识符 testProductKey
deviceName String 设备名称 testDeviceName

正常返回示例

{
    "code": 200,
    "data": {
        "attributes": {
            "lightStatus": "on"
        },
        "batchId": "testBatchId",
        "iotId": "testIotId"
    },
    "message": "success"
}

获取物的事件上报数据

定义描述

path 版本 描述
/thing/device/event/timeline/get 1.1.2 获取物的事件上报数据

请求参数

名称
类型
必要
描述
示例
productKey
String
产品唯一标识符
testProductKey
deviceName
String
设备名称
testDeviceName
eventIdentifier
String
事件标识符
turnOffLight
eventType
String
事件类型
Error
start
Long
查询起始时间(毫秒)
1526900000000
end
Long
查询终止时间(毫秒)
1526900000001
pageSize
Int
查询分页大小
10
ordered
Bool
查询顺序(true - 顺序,false - 倒序)
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/device/event/get 1.1.2 获取物的事件快照数据

请求参数

名称
类型
必要
描述
示例
productKey
String
产品唯一标识符
testProductKey
deviceName
String
设备名称
testDeviceName
eventIdentifier
String
事件标识符
alarmEvent

正常返回示例

{
    "code": 200,
    "message": "success",
    "localizedMsg": "",
    "data": {
        "items": {
            "eventCode": "Error",
            "iotId": "testIotId",
            "eventName": "故障上报",
            "eventType": "info",
            "eventBody": {
                "ErrorCode": 0
            },
            "batchId": "5ebc6a9c7d15459f823edde6d28c8fb3",
            "timestamp": 1516342985261
        },
        "timestamp": 1516343075699
    }
}

获取物的详情

定义描述

path 版本 描述
/thing/device/detail/get 1.1.2 获取物的详情

请求参数

名称 类型 必要 描述 示例
productKey String 产品唯一标识符 testProductKey
deviceName String 设备名称 testDeviceName

正常返回示例

{
    "code": 200,
    "data": {
        "latestOnlineTime": 1506308791000,
        "activeStatus": 1,
        "devAddress": null,
        "clientIp": null,
        "activeTime": null,
        "onlineStatus": 0,
        "productInfoDTO": {
            "image": null,
            "gmtModified": 1507701726000,
            "productModel": null,
            "netType": "NET_LORA",
            "dataFormat": null,
            "description": "测试灯光产品",
            "gmtCreate": 1507701726000,
            "productKey": "a15z5wt0K3k",
            "scriptId": null,
            "name": "testLightProduct",
            "region": "cn-shanghai",
            "rbacTenantId": null,
            "categoryId": 3,
            "classType": null,
            "status": null
        },
        "deviceDTO": {
            "gmtModified": 1502179810000,
            "activeTime": null,
            "deviceKey": "testDeviceKey",
            "gmtCreate": 1492141440000,
            "productKey": "a15z5wt0K3k",
            "mac": "23:4E:12:34:11",
            "netAddress": null,
            "iotId": "testIotId",
            "deviceSecret": "testDeviceSecret",
            "name": "testLight",
            "tenantId": 6,
            "nickname": null,
            "sdkVersion": "1.1",
            "sn": "3223233",
            "region": "daily",
            "firmwareVersion": "1.2",
            "ownerDomain": "testOwnerDomain",
            "rbacTenantId": "testTenantId",
            "status": 1
        },
        "attributes": {
            "sdkVersion": "1.1",
            "sn": "3223233",
            "time": 1502697429000,
            "firmwareVersion": "1.2",
            "mac": "23:4E:12:34:11",
            "iot": "test"
        },
        "appEui": null
    },
    "message": "success"
}

results matching ""

    No results matching ""