docs: add OneNET API reference documentation
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
+119
@@ -0,0 +1,119 @@
|
||||
物模型查询
|
||||
最近更新时间:2024-02-21 16:47:03
|
||||
接口功能
|
||||
根据产品id查询指定产品下的物模型功能点
|
||||
|
||||
备注
|
||||
数据协议为OneJson的产品可查询
|
||||
|
||||
接口地址
|
||||
http(s)://iot-api.heclouds.com/thingmodel/query-thing-model
|
||||
|
||||
API说明
|
||||
请求方式:GET
|
||||
|
||||
http query 请求参数:
|
||||
|
||||
参数 类型 是否必选 描述
|
||||
product_id string 是 产品id
|
||||
返回数据
|
||||
|
||||
参数名称 类型 描述
|
||||
code int 调用失败时,返回的错误码
|
||||
msg string 调用失败时,返回的错误信息
|
||||
request_id string 调用API时生成的请求标识
|
||||
data.properties array 数组对象 属性功能点
|
||||
p.functionMode string 功能点类型,定值'property'
|
||||
p.identifier string 属性唯一标识符(产品下唯一)
|
||||
p.name string 属性名称
|
||||
p.desc string 属性描述
|
||||
p.accessMode string "属性读写类型:只读(r)或读写(rw)
|
||||
p.functionType string 是否是标准功能点,自定义(u)/系统(s)
|
||||
p.dataType object 属性功能点数据
|
||||
p.dataType.type string 属性类型: int32(32位整数)、int64(64位整数)、float(单精度浮点)、double(双精度浮点型)、string(字符串)、date(String类型UTC秒)、bool(true或false)、enum(int类型)、bitMap(位图)、date(int64类型UTC时间戳毫秒)、struct(结构体类型)、array(数组)
|
||||
p.dataType.specs object 属性功能点数据
|
||||
data.events array 数组对象 事件功能点
|
||||
e.functionMode string 功能点类型,定值'event'
|
||||
e.identifier string 事件唯一标识符
|
||||
e.name string 事件名称
|
||||
e.desc string 事件描述
|
||||
e.type string 事件类型(info、alert、error)
|
||||
e.fuctionType string 是否是标准功能点,自定义(u)/标准(s)
|
||||
e.outputData array 参数
|
||||
e.outputData.identifier string 参数唯一标识符
|
||||
e.outputData.name string 参数名称
|
||||
e.outputData.dataType object 参数数据
|
||||
e.outputData.dataType.type string 属性类型: int32(32位整数)、int64(64位整数)、float(单精度浮点)、double(双精度浮点型)、string(字符串)、date(String类型UTC秒)、bool(true或false)、enum(int类型)、bitMap(位图)、date(int64类型UTC时间戳毫秒)、struct(结构体类型)、array(数组)
|
||||
services array 数组对象 服务功能点
|
||||
s.functionMode string 功能点类型,定值'service'
|
||||
s.identifier string 服务唯一标识符(产品下唯一)
|
||||
s.name string 服务名称
|
||||
s.desc string 服务描述
|
||||
s.callType string 调用方式,同步(s)/异步(a)
|
||||
s.fuctionType string 功能点类型,自定义(u)/系统(s)
|
||||
s.input array 输入参数
|
||||
s.input.identifier string 参数唯一标识符
|
||||
s.input.name string 参数名称
|
||||
s.input.dataType object 参数数
|
||||
s.input.dataType.type string 属性类型: int32(32位整数)、int64(64位整数)、float(单精度浮点)、double(双精度浮点型)、string(字符串)、bool(true或false)、enum(int类型)、bitMap(位图)、date(int64类型UTC时间戳毫秒)、struct(结构体类型)、array(数组)
|
||||
s.input.dataType.specs object 参数功能点数据
|
||||
s.output array 输出参数
|
||||
s.output.identifier string 参数唯一标识符
|
||||
s.output.name string 参数名称
|
||||
s.output.dataType object 参数数据
|
||||
s.output.dataType.type string 属性类型: int32(32位整数)、int64(64位整数)、float(单精度浮点)、double(双精度浮点型)、string(字符串)、bool(true或false)、enum(int类型)、bitMap(位图)、date(int64类型UTC时间戳毫秒)、struct(结构体类型)、array(数组)
|
||||
s.output.dataType.specs object 参数功能点数据
|
||||
示例
|
||||
请求示例
|
||||
|
||||
GET http(s)://iot-api.heclouds.com/thingmodel/query-thing-model?product_id=xxx
|
||||
|
||||
响应示例
|
||||
|
||||
{
|
||||
"data": {
|
||||
"properties": [
|
||||
{
|
||||
"name": "模式",
|
||||
"identifier": "model",
|
||||
"functionType": "u",
|
||||
"functionMode": "property",
|
||||
"desc": "",
|
||||
"accessMode": "rw",
|
||||
"dataType": {
|
||||
"type": "enum",
|
||||
"specs": {
|
||||
"1": "模式1",
|
||||
"2": "模式2"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"events": [
|
||||
{
|
||||
"name": "test",
|
||||
"identifier": "test",
|
||||
"functionType": "u",
|
||||
"functionMode": "event",
|
||||
"desc": null,
|
||||
"eventType": "info",
|
||||
"outputData": [
|
||||
{
|
||||
"dataType": {
|
||||
"type": "bool",
|
||||
"specs": {
|
||||
"false": "关",
|
||||
"true": "开"
|
||||
}
|
||||
},
|
||||
"name": "开关",
|
||||
"identifier": "switch"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"request_id": "a25087f46df04b69b29e90ef0acfd115",
|
||||
"msg": "succ",
|
||||
"code": 0
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
获取设备属性详情
|
||||
最近更新时间:2026-01-16 16:47:29
|
||||
接口功能
|
||||
根据产品ID和设备名,下发物模型属性获取命令到设备,设备返回属性值到接口
|
||||
|
||||
备注
|
||||
仅支持OneJson设备,需要设备在线
|
||||
|
||||
接口地址
|
||||
https://iot-api.heclouds.com/thingmodel/query-device-property-detail
|
||||
|
||||
API说明
|
||||
请求方式:POST
|
||||
|
||||
http body 请求参数:
|
||||
|
||||
参数 类型 是否必选 描述
|
||||
product_id string 是 产品ID,平台生成唯一ID
|
||||
device_name string 是 设备名称
|
||||
params array 是 功能点标识数组,expample: ["light","model"]
|
||||
返回数据
|
||||
|
||||
参数名称 类型 描述
|
||||
code int 调用成功或失败时,返回的code码
|
||||
msg string 调用成功或失败时,返回的msg信息
|
||||
request_id string 调用API生成的请求标识
|
||||
data - 调用成功时,返回的业务数据
|
||||
示例
|
||||
请求示例
|
||||
|
||||
POST http(s)://iot-api.heclouds.com/thingmodel/query-device-property-detail
|
||||
Content-type: application/json
|
||||
{
|
||||
"product_id":"B7EEW578EbRg5Y4K",
|
||||
"device_name":"device3",
|
||||
"params":["light","model"]
|
||||
}
|
||||
|
||||
响应示例
|
||||
|
||||
{
|
||||
"request_id": "a25087f46df04b69b29e90ef0acfd115",
|
||||
"msg": "succ",
|
||||
"code": 0,
|
||||
"data":{
|
||||
"light":1,
|
||||
"model":1
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
设备属性最新数据查询
|
||||
最近更新时间:2026-01-16 16:47:29
|
||||
接口功能
|
||||
根据产品id和设备名,查询设备最新属性功能点数据
|
||||
|
||||
备注
|
||||
支持OneJson、自定义透传数据协议,设备能正常下发上报
|
||||
|
||||
接口地址
|
||||
https://iot-api.heclouds.com/thingmodel/query-device-property
|
||||
|
||||
API说明
|
||||
请求方式:GET
|
||||
|
||||
http query 请求参数:
|
||||
|
||||
参数 类型 是否必选 描述
|
||||
product_id string 是 产品ID,平台生成唯一ID
|
||||
device_name string 是 设备名称
|
||||
返回数据
|
||||
|
||||
参数名称 类型 描述
|
||||
code int 调用成功或失败时,返回的code码
|
||||
msg string 调用成功或失败时,返回的msg信息
|
||||
request_id string 调用API生成的请求标识
|
||||
data - 调用成功时,返回的业务数据
|
||||
data.list array 设备属性数据集合
|
||||
data.list字段结构
|
||||
|
||||
[
|
||||
{
|
||||
"identifier": string, # 功能点标识
|
||||
"time": string, # 上报时间,毫秒时间戳
|
||||
"value": string, # 功能点上报值,json字符串
|
||||
"data_type": string, # 数据类型 int32、int64、float、double、enum、bool、string、struct、bitMap
|
||||
"access_mode": string, # 读写类型
|
||||
"expect_value": string, # 期望值, json字符串,属性功能点具有该字段
|
||||
"name": string, # 功能点名称
|
||||
"description": string, # 功能描述
|
||||
}
|
||||
]
|
||||
示例
|
||||
请求示例
|
||||
|
||||
GET http(s)://iot-api.heclouds.com/thingmodel/query-device-property
|
||||
?product_id=9MaNe52pNO&device_name=no001
|
||||
|
||||
响应示例
|
||||
|
||||
{
|
||||
"data":[
|
||||
{
|
||||
"access_mode": "读写",
|
||||
"data_type": "int32",
|
||||
"description": "二氧化碳",
|
||||
"expect_value": "800",
|
||||
"identifier": "CO2",
|
||||
"name": "二氧化碳",
|
||||
"time": "1592797444539",
|
||||
"value": "600"
|
||||
},
|
||||
{
|
||||
"access_mode": "读写",
|
||||
"data_type": "bool",
|
||||
"description": "关",
|
||||
"expect_value": "true",
|
||||
"identifier": "fan",
|
||||
"name": "风扇",
|
||||
"time": "1592797444539",
|
||||
"value": "false"
|
||||
}
|
||||
],
|
||||
"request_id": "a25087f46df04b69b29e90ef0acfd115",
|
||||
"msg": "succ",
|
||||
"code": 0
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
设备属性记录查询
|
||||
最近更新时间:2026-01-16 16:47:29
|
||||
接口功能
|
||||
根据产品id设备名称时间范围等参数,查询设备属性历史功能点数据
|
||||
|
||||
备注
|
||||
支持OneJson、自定义透传数据协议,设备能正常下发上报
|
||||
|
||||
接口地址
|
||||
https://iot-api.heclouds.com/thingmodel/query-device-property-history
|
||||
|
||||
API说明
|
||||
请求方式:GET
|
||||
|
||||
http query 请求参数:
|
||||
|
||||
参数 类型 是否必选 描述
|
||||
product_id string 是 产品ID,平台生成唯一ID
|
||||
device_name string 是 设备名称
|
||||
identifier string 是 属性功能点标识
|
||||
start_time string 是 查询起始时间,毫秒时间戳
|
||||
end_time string 是 查询结束时间,毫秒时间戳
|
||||
sort string 否 排序参数 1-正序 2-倒序 默认倒叙
|
||||
offset string 否 请求起始位置,默认0
|
||||
limit string 否 每次请求记录数,默认10, 范围[1, 100]
|
||||
返回数据
|
||||
|
||||
参数名称 类型 描述
|
||||
code int 调用成功或失败时,返回的code码
|
||||
msg string 调用成功或失败时,返回的msg信息
|
||||
request_id string 调用API生成的请求标识
|
||||
data - 调用成功时,返回的业务数据
|
||||
data.list array 设备属性数据集合
|
||||
data.list字段结构
|
||||
|
||||
[
|
||||
{
|
||||
"value": string, # 属性功能点上报值
|
||||
"time": int, # 属性功能点上报时间
|
||||
}
|
||||
]
|
||||
示例
|
||||
请求示例
|
||||
|
||||
GET http(s)://iot-api.heclouds.com/thingmodel/query-device-property-history
|
||||
?product_id=9MaNe52pNO&device_name=no001&identifier=someDate&start_time=1681713647000&end_time=1681799966562
|
||||
|
||||
响应示例
|
||||
|
||||
{
|
||||
"data": [
|
||||
{
|
||||
"time": "1592810751988",
|
||||
"value": "false"
|
||||
},
|
||||
{
|
||||
"time": "1592810746988",
|
||||
"value": "true"
|
||||
}
|
||||
],
|
||||
"request_id": "a25087f46df04b69b29e90ef0acfd115",
|
||||
"msg": "succ",
|
||||
"code": 0
|
||||
}
|
||||
Reference in New Issue
Block a user