ThingsKit物联网平台API文档-设备管理(产品)

选项列表(各页面的列表选项)

接口地址:/api/yt/device_profile/me/list{?deviceType}

请求方式:GET

请求数据类型:application/x-www-form-urlencoded

响应数据类型:*/*

请求参数:

参数名称参数说明请求类型是否必须数据类型
deviceType设备类型,可用值:DIRECT_CONNECTION,GATEWAY,SENSORqueryfalsestring
transportType传输协议queryfalsestring
isSceneLinkage是否来自边端(场景联动页面使用)queryfalseboolean

响应参数:

参数名称参数说明类型
name产品(设备配置)名称String
description告警通知配置String
tenantId租户IDString
transportType传输协议String
provisionType设备创建策略String
deviceType产品类型:GATEWAY,DIRECT_CONNECTION,SENSORDeviceTypeEnum
tbProfileIdTB设备配置IDString
defaultRuleChainId关联规则链,默认关联根规则链String
alarmProfile告警通知配置AlarmProfileDTO
defaultQueueName默认消息队列String
image设备配置/产品图片String
isDefault是否默认设备配置boolean
typeTB设备配置类型,默认DEFAULTString
thingsModel物模型ThingsModelDTO
deviceCount产品下的设备数量Integer
categoryId品类idString
categoryName品类名称String
firmwareIdOTA升级固件IDString
softwareIdOTA升级软件IDString
isEdge是否来自边端Integer

响应示例:

[
    {
        "id": "0167de20-5ddb-11ef-b746-1f75222e5f46",
        "name": "default",
        "description": "Default device profile",
        "tenantId": "01482120-5ddb-11ef-b746-1f75222e5f46",
        "transportType": "DEFAULT",
        "provisionType": "DISABLED",
        "deviceType": "SENSOR",
        "tbProfileId": "0167de20-5ddb-11ef-b746-1f75222e5f46",
        "profileData": {
            "configuration": {
                "type": "DEFAULT"
            },
            "transportConfiguration": {
                "type": "DEFAULT"
            },
            "provisionConfiguration": {
                "type": "DISABLED",
                "provisionDeviceSecret": null
            },
            "alarms": null,
            "thingsModel": null
        },
        "type": "DEFAULT",
        "default": true
    }
]

详情(获取产品详情)

接口地址:/api/yt/device_profile/{id}

请求方式:GET

请求数据类型:application/x-www-form-urlencoded

响应数据类型:*/*

请求参数:

参数名称参数说明请求类型是否必须数据类型
ididpathtruestring

响应参数:

参数名称参数说明类型
name产品(设备配置)名称String
description告警通知配置String
tenantId租户IDString
transportType传输协议String
provisionType设备创建策略String
deviceType产品类型:GATEWAY,DIRECT_CONNECTION,SENSORDeviceTypeEnum
tbProfileIdTB设备配置IDString
defaultRuleChainId关联规则链,默认关联根规则链String
alarmProfile告警通知配置AlarmProfileDTO
defaultQueueName默认消息队列String
image设备配置/产品图片String
isDefault是否默认设备配置boolean
typeTB设备配置类型,默认DEFAULTString
thingsModel物模型集合ThingsModelDTO
deviceCount产品下的设备数量Integer
categoryId品类idString
categoryName品类名称String
firmwareIdOTA升级固件IDString
softwareIdOTA升级软件IDString
isEdge是否来自边端Integer

响应示例:

{
    "id": "01944550-5ddb-11ef-b746-1f75222e5f46",
    "name": "默认MQTT直连设备",
    "description": "Default device profile",
    "tenantId": "01482120-5ddb-11ef-b746-1f75222e5f46",
    "transportType": "DEFAULT",
    "provisionType": "DISABLED",
    "deviceType": "DIRECT_CONNECTION",
    "tbProfileId": "01944550-5ddb-11ef-b746-1f75222e5f46",
    "profileData": {
        "configuration": {
            "type": "DEFAULT"
        },
        "transportConfiguration": {
            "type": "DEFAULT"
        },
        "provisionConfiguration": {
            "type": "DISABLED",
            "provisionDeviceSecret": null
        },
        "alarms": null,
        "thingsModel": [
            {
                "functionType": "properties",
                "functionName": "温度",
                "identifier": "CurrentTemperature",
                "callType": null,
                "accessMode": "r",
                "eventType": null,
                "functionJson": {
                    "dataType": {
                        "type": "INT",
                        "specs": {
                            "unit": "°C",
                            "unitName": "摄氏度 / °C",
                            "valueRange": {
                                "max": 32767,
                                "min": -32768
                            }
                        },
                        "specsList": []
                    }
                },
                "extensionDesc": {
                    "bitMask": 7,
                    "scaling": 10,
                    "writeOnly": false,
                    "operationType": "holdingRegister_r_03",
                    "registerAddress": "01",
                    "originalDataType": "INT16_AB"
                },
                "status": 1,
                "deviceProfileId": "01944550-5ddb-11ef-b746-1f75222e5f46",
                "remark": null
            },
            {
                "functionType": "properties",
                "functionName": "湿度",
                "identifier": "CurrentHumidity",
                "callType": null,
                "accessMode": "r",
                "eventType": null,
                "functionJson": {
                    "dataType": {
                        "type": "INT",
                        "specs": {
                            "unit": "%RH",
                            "unitName": "相对湿度 / %RH",
                            "valueRange": {
                                "max": 32767,
                                "min": -32768
                            }
                        },
                        "specsList": []
                    }
                },
                "extensionDesc": {
                    "bitMask": 7,
                    "scaling": 10,
                    "writeOnly": false,
                    "operationType": "holdingRegister_r_03",
                    "registerAddress": "00",
                    "originalDataType": "INT16_AB"
                },
                "status": 1,
                "deviceProfileId": "01944550-5ddb-11ef-b746-1f75222e5f46",
                "remark": null
            }
        ]
    },
    "type": "DEFAULT",
    "deviceCount": 2,
    "default": false
}

产品列表(分页查询)

接口地址:/api/yt/device_profile{?name,orderType,page,pageSize,transportType}

请求方式:GET

请求数据类型:application/x-www-form-urlencoded

响应数据类型:*/*

请求参数:

参数名称参数说明是否必须数据类型
pagepagetrueint
pageSizepageSizetrueint
namenamefalsestring
transportTypetransportTypefalsestring
orderTypeorderType,可用值:ASC,DESCfalsestring

响应参数:

参数名称参数说明类型
name产品(设备配置)名称String
description告警通知配置String
tenantId租户IDString
transportType传输协议String
provisionType设备创建策略String
deviceType产品类型:GATEWAY,DIRECT_CONNECTION,SENSORDeviceTypeEnum
tbProfileIdTB设备配置IDString
defaultRuleChainId关联规则链,默认关联根规则链String
alarmProfile告警通知配置AlarmProfileDTO
defaultQueueName默认消息队列String
image设备配置/产品图片String
isDefault是否默认设备配置boolean
typeTB设备配置类型,默认DEFAULTString
thingsModel物模型ThingsModelDTO
deviceCount产品下的设备数量Integer
categoryId品类idString
categoryName品类名称String
firmwareIdOTA升级固件IDString
softwareIdOTA升级软件IDString
isEdge是否来自边端Integer

响应示例:

{
    "total": 4,//数据总数
    "items": [
        {
            "id": "01944550-5ddb-11ef-b746-1f75222e5f46",//产品id
            "name": "默认MQTT直连设备",//产品名称
            "description": "Default device profile",//秒速
            "tenantId": "01482120-5ddb-11ef-b746-1f75222e5f46",//租户id
            "transportType": "DEFAULT",//传输协议
            "provisionType": "DISABLED",//创建设备策略
            "deviceType": "DIRECT_CONNECTION",//产品类型
            "tbProfileId": "01944550-5ddb-11ef-b746-1f75222e5f46",//tb产品id
            "profileData": {
                "configuration": {
                    "type": "DEFAULT"
                },
                "transportConfiguration": {
                    "type": "DEFAULT"
                },
                "provisionConfiguration": {
                    "type": "DISABLED",
                    "provisionDeviceSecret": null
                },
                "alarms": null,//告警
                "thingsModel": [//物模型集合
                    {
                        "functionType": "properties",
                        "functionName": "温度",
                        "identifier": "CurrentTemperature",
                        "callType": null,
                        "accessMode": "r",
                        "eventType": null,
                        "functionJson": {
                            "dataType": {
                                "type": "INT",
                                "specs": {
                                    "unit": "°C",
                                    "unitName": "摄氏度 / °C",
                                    "valueRange": {
                                        "max": 32767,
                                        "min": -32768
                                    }
                                },
                                "specsList": []
                            }
                        },
                        "extensionDesc": {
                            "bitMask": 7,
                            "scaling": 10,
                            "writeOnly": false,
                            "operationType": "holdingRegister_r_03",
                            "registerAddress": "01",
                            "originalDataType": "INT16_AB"
                        },
                        "status": 1,
                        "deviceProfileId": "01944550-5ddb-11ef-b746-1f75222e5f46",
                        "remark": null
                    },
                    {
                        "functionType": "properties",
                        "functionName": "湿度",
                        "identifier": "CurrentHumidity",
                        "callType": null,
                        "accessMode": "r",
                        "eventType": null,
                        "functionJson": {
                            "dataType": {
                                "type": "INT",
                                "specs": {
                                    "unit": "%RH",
                                    "unitName": "相对湿度 / %RH",
                                    "valueRange": {
                                        "max": 32767,
                                        "min": -32768
                                    }
                                },
                                "specsList": []
                            }
                        },
                        "extensionDesc": {
                            "bitMask": 7,
                            "scaling": 10,
                            "writeOnly": false,
                            "operationType": "holdingRegister_r_03",
                            "registerAddress": "00",
                            "originalDataType": "INT16_AB"
                        },
                        "status": 1,
                        "deviceProfileId": "01944550-5ddb-11ef-b746-1f75222e5f46",
                        "remark": null
                    }
                ]
            },
            "type": "DEFAULT",
            "categoryName": "默认MQTT直连设备",
            "isEdge": 0,
            "default": false
        }
    ]
}

保存物模型(新增物模型)

接口地址:/api/yt/things_model

请求方式:PUT

请求数据类型:application/x-www-form-urlencoded,application/json

响应数据类型:*/*

请求示例:

{
    "functionType": "properties",
    "functionName": "测试",
    "identifier": "test",
    "functionJson": {
        "dataType": {
            "type": "INT",
            "specs": {
                "valueRange": {
                    "min": 0,
                    "max": 10
                },
                "unit": "m㎡",
                "unitName": "平方毫米 / m㎡",
                "step": 1
            }
        }
    },
    "accessMode": "rw",
    "deviceProfileId": "01944550-5ddb-11ef-b746-1f75222e5f46"
}

请求参数:

参数名称参数说明请求类型是否必须数据类型
functionType功能类型bodytrueFunctionTypeEnum
functionName功能名称bodytruestring
identifier功能标识bodytruestring
functionJson功能jsonbodytrueJsonNode
accessMode读写模式:读r 写wbodytruestring
deviceProfileId设备配置IDbodytruestring
extensionDescTCP/UDP属性扩展描述bodyfalseJsonNode
callType调用方式:同步sync 异步asyncbodyfalseCallTypeEnum
eventType事件类型:信息info 告警alert 故障errorbodyfalseDeviceEventTypeEnum

响应参数:

参数名称参数说明数据类型
id主键string
tenantId租户idstring
functionType功能类型FunctionTypeEnum
functionName功能名称string
identifier功能标识string
accessMode读写模式:读r 写wstring
functionJson功能jsonJsonNode
deviceProfileId设备配置IDstring
extensionDescTCP/UDP属性扩展描述JsonNode
callType调用方式:同步sync 异步asyncCallTypeEnum
eventType事件类型:信息info 告警alert 故障errorDeviceEventTypeEnum

响应示例:

{
    "id": "a060bced-039c-4aa0-9547-b6639f31b32f",
    "tenantId": "01482120-5ddb-11ef-b746-1f75222e5f46",
    "functionType": "properties",
    "functionName": "测试",
    "identifier": "test",
    "accessMode": "rw",
    "functionJson": {
        "dataType": {
            "type": "INT",
            "specs": {
                "valueRange": {
                    "min": 0,
                    "max": 10
                },
                "unit": "m㎡",
                "unitName": "平方毫米 / m㎡",
                "step": 1
            }
        }
    },
    "deviceProfileId": "01944550-5ddb-11ef-b746-1f75222e5f46"
}

修改物模型(编辑物模型)

接口地址:/api/yt/things_model

请求方式:PUT

请求数据类型:application/x-www-form-urlencoded,application/json

响应数据类型:*/*

请求示例:

{
    "functionType": "properties",
    "functionName": "测试",
    "identifier": "test",
    "functionJson": {
        "dataType": {
            "type": "INT",
            "specs": {
                "valueRange": {
                    "min": 0,
                    "max": 10
                },
                "unit": "m㎡",
                "unitName": "平方毫米 / m㎡",
                "step": 1
            }
        }
    },
    "accessMode": "rw",
    "deviceProfileId": "01944550-5ddb-11ef-b746-1f75222e5f46",
    "id": "a060bced-039c-4aa0-9547-b6639f31b32f"
}

请求参数:

参数名称参数说明请求类型是否必须数据类型
id主键bodytruestring
functionType功能类型bodytrueFunctionTypeEnum
functionName功能名称bodytruestring
identifier功能标识bodytruestring
accessMode读写模式:读r 写wbodytruestring
functionJson功能jsonbodyfalseJsonNode
deviceProfileId设备配置IDbodyfalsestring
extensionDescTCP/UDP属性扩展描述bodyfalseJsonNode
callType调用方式:同步sync 异步asyncbodyfalseCallTypeEnum
eventType事件类型:信息info 告警alert 故障errorbodyfalseDeviceEventTypeEnum

响应参数:

参数名称参数说明数据类型
id主键string
tenantId租户idstring
functionType功能类型FunctionTypeEnum
functionName功能名称string
identifier功能标识string
accessMode读写模式:读r 写wstring
functionJson功能jsonJsonNode
deviceProfileId设备配置IDstring
extensionDescTCP/UDP属性扩展描述JsonNode
callType调用方式:同步sync 异步asyncCallTypeEnum
eventType事件类型:信息info 告警alert 故障errorDeviceEventTypeEnum

响应示例:

{
    "id": "a060bced-039c-4aa0-9547-b6639f31b32f",
    "enabled": false,
    "tenantId": "01482120-5ddb-11ef-b746-1f75222e5f46",
    "functionType": "properties",
    "functionName": "测试",
    "identifier": "test",`
    "accessMode": "rw",
    "functionJson": {
        "dataType": {
            "type": "INT",
            "specs": {
                "valueRange": {
                    "min": 0,
                    "max": 10
                },
                "unit": "m㎡",
                "unitName": "平方毫米 / m㎡",
                "step": 1
            }
        }
    },
    "deviceProfileId": "01944550-5ddb-11ef-b746-1f75222e5f46"
}

删除

接口地址:/api/yt/things_model

请求方式:DELETE

请求数据类型:application/x-www-form-urlencoded,application/json

响应数据类型:*/*

请求示例:

{
  "ids": [],
  "tenantId": ""
}

请求参数:

参数名称参数说明请求类型是否必须数据类型
ids删除ID列表truearray
tenantId租户IDfalsestring

获取产品服务

接口地址:/api/yt/things_model/get_services/{deviceProfileId}

请求方式:GET

请求数据类型:application/x-www-form-urlencoded

响应数据类型:*/*

请求参数:

参数名称参数说明请求类型是否必须数据类型
deviceProfileIddeviceProfileIdpathtruestring

响应参数:

参数名称参数说明类型
accessMode读写模式:读r 写wstring
callType调用方式:同步sync 异步async,可用值:ASYNC,SYNCstring
createTime创建时间string(date-time)
creator创建用户string
defaultConfig租户默认配置string
description租户描述string
deviceProfileId设备配置IDstring
enabled租户状态:启用/禁用boolean
eventType事件类型:信息info 告警alert 故障error,可用值:ALERT,ERROR,INFOstring
functionJson功能jsonJsonNode
functionName功能名称string
functionType功能类型,可用值:events,properties,servicesstring
icon租户图标string
idIDstring
identifier功能标识string
name租户名称string
remark备注string
roleIds租户角色列表array
status状态:0待发布 1发布integer(int32)
tenantExpireTime租户到期时间string(date-time)
tenantId租户IDstring
tenantProfileId租户配置string
tenantStatus可用值:DISABLED,EXPIRED,NORMALstring
updateTime更新时间string(date-time)
updater更新用户string

响应示例:

[
	{
		"accessMode": "",
		"callType": "",
		"createTime": "",
		"creator": "",
		"defaultConfig": "",
		"description": "",
		"deviceProfileId": "",
		"enabled": false,
		"eventType": "",
		"functionJson": {},
		"functionName": "",
		"functionType": "",
		"icon": "",
		"id": "",
		"identifier": "",
		"name": "",
		"remark": "",
		"roleIds": [],
		"status": 0,
		"tenantExpireTime": "",
		"tenantId": "",
		"tenantProfileId": "",
		"tenantStatus": "",
		"updateTime": "",
		"updater": ""
	}
]

物模型分页(获取物模型)

接口地址:/api/yt/things_model/page{?deviceProfileId,functionType,nameOrIdentifier,orderFiled,orderType,page,pageSize}

请求方式:GET

请求数据类型:application/x-www-form-urlencoded

响应数据类型:*/*

请求参数:

参数名称参数说明请求类型是否必须数据类型
deviceProfileIddeviceProfileIdquerytruestring
pagepagequerytruestring
pageSizepageSizequerytruestring
nameOrIdentifiernameOrIdentifierqueryfalsestring
functionTypefunctionType,可用值:events,properties,servicesqueryfalsestring
orderFiledorderFiledqueryfalsestring
orderTypeorderType,可用值:ASC,DESCqueryfalsestring

响应参数:

参数名称参数说明数据类型
id主键string
tenantId租户idstring
functionType功能类型FunctionTypeEnum
functionName功能名称string
identifier功能标识string
accessMode读写模式:读r 写wstring
functionJson功能jsonJsonNode
deviceProfileId设备配置IDstring
extensionDescTCP/UDP属性扩展描述JsonNode
callType调用方式:同步sync 异步asyncCallTypeEnum
eventType事件类型:信息info 告警alert 故障errorDeviceEventTypeEnum

响应示例:

{
    "total": 2,
    "items": [
        {
            "id": "4d2e7652-f896-454d-8e2e-4f05c16ac67e",
            "creator": "d2dd7aeb-6b97-426e-a3b8-2c8759d0e6be",
            "createTime": "2024-08-19 13:38:49",
            "updater": "d2dd7aeb-6b97-426e-a3b8-2c8759d0e6be",
            "updateTime": "2024-08-21 11:37:27",
            "enabled": false,
            "tenantId": "01482120-5ddb-11ef-b746-1f75222e5f46",
            "functionType": "properties",
            "functionName": "温度",
            "identifier": "CurrentTemperature",
            "extensionDesc": {
                "writeOnly": false,
                "bitMask": 7,
                "operationType": "holdingRegister_r_03",
                "originalDataType": "INT16_AB",
                "registerAddress": "01",
                "scaling": 10
            },
            "accessMode": "r",
            "functionJson": {
                "dataType": {
                    "type": "INT",
                    "specs": {
                        "valueRange": {
                            "min": -32768,
                            "max": 32767
                        },
                        "unit": "°C",
                        "unitName": "摄氏度 / °C"
                    }
                }
            },
            "status": 1,
            "deviceProfileId": "01944550-5ddb-11ef-b746-1f75222e5f46"
        },
        {
            "id": "fbb0d98b-fac7-41ef-a9d0-7660f83ea179",
            "creator": "d2dd7aeb-6b97-426e-a3b8-2c8759d0e6be",
            "createTime": "2024-08-19 13:38:49",
            "updateTime": "2024-08-19 14:03:31",
            "enabled": false,
            "tenantId": "01482120-5ddb-11ef-b746-1f75222e5f46",
            "functionType": "properties",
            "functionName": "湿度",
            "identifier": "CurrentHumidity",
            "extensionDesc": {
                "writeOnly": false,
                "bitMask": 7,
                "operationType": "holdingRegister_r_03",
                "originalDataType": "INT16_AB",
                "registerAddress": "00",
                "scaling": 10
            },
            "accessMode": "r",
            "functionJson": {
                "dataType": {
                    "type": "INT",
                    "specs": {
                        "unit": "%RH",
                        "unitName": "相对湿度 / %RH",
                        "valueRange": {
                            "min": -32768,
                            "max": 32767
                        }
                    },
                    "specsList": []
                }
            },
            "status": 1,
            "deviceProfileId": "01944550-5ddb-11ef-b746-1f75222e5f46"
        }
    ]
}

物模型发布

接口地址:/api/yt/things_model/{deviceProfileId}

请求方式:PUT

请求数据类型:application/x-www-form-urlencoded

响应数据类型:*/*

请求参数:

参数名称参数说明请求类型是否必须数据类型
deviceProfileIddeviceProfileIdpathtruestring

获取物模型TSL(重要)

接口地址:/api/yt/things_model/{functionType}/{deviceProfileId}

请求方式:GET

请求数据类型:application/x-www-form-urlencoded

响应数据类型:*/*

请求参数:

参数名称参数说明请求类型是否必须数据类型
functionTypefunctionType,可用值:events,properties,servicespathtruestring
deviceProfileId产品IDpathtruestring

请求示例:

ThingsKit物联网平台API文档-设备管理(产品)

响应参数:

参数名称参数说明数据类型
functionTypefunctionType,可用值:events(事件),properties(属性),services(服务)string
functionName功能名称string
identifier标识符类型string
accessMode读写模式:rw读写 r只读string

响应示例:

[{
		"functionName": "温度",
		"identifier": "temperature",
		"functionType": "properties",
		"accessMode": "rw",
		"specs": {
			"dataType": {
				"type": "DOUBLE",
				"specs": {
					"unit": {
						"value": "°C",
						"label": "摄氏度 / °C",
						"key": "°C"
					},
					"unitName": "摄氏度 / °C"
				}
			}
		},
		"extensionDesc": null
	},
	{
		"functionName": "湿度",
		"identifier": "humidity",
		"functionType": "properties",
		"accessMode": "rw",
		"specs": {
			"dataType": {
				"type": "DOUBLE",
				"specs": {
					"unit": {
						"value": "%RH",
						"label": "相对湿度 / %RH",
						"key": "%RH"
					},
					"unitName": "相对湿度 / %RH"
				}
			}
		},
		"extensionDesc": null
	}
]