设备字典Api
# 列表查询
接口说明
根据查询条件查询设备字典列表。
接口版本
v1接口地址
/api-web-v1/hardwareWords
请求方法
GET
请求参数
参数类型 | 参数名称 | 数据类型 | 是否必须 | 参数描述 | 默认 | 示例 |
---|---|---|---|---|---|---|
query | label | string | false | 模糊查询字段 | name | |
query | search | string | false | 模糊查询值 | 三菱空调 | |
query | time | string | false | 时间范围查询字段,必须是设备字段中的时间或时间戳字段名,例如createdAt,updatedAt | createdAt | |
query | range | string[] or string | false | 时间范围,开始时间到结束时间,可以是string[]或者以逗号分割的开始时间到结束时间或时间戳 | 2019-10-22T00:00:00.000Z,2022-01-22T00:00:00.000Z | |
query | page | number | false | 分页第几页 | 1 | |
query | limit | number | false | 单页几条数据 | 10 | |
query | sort | string | false | 根据哪个字段排序 | _id | -createdAt |
query | select | string | false | 只查询部分字段,字段名之间用过空格分隔,去掉某个字段的查询字段名前面加- | ||
query | autopopulate | boolean | false | 自动关联数据,部分字段自动关联关系表查询,设置这个值可开关自动联表查询 | true | false |
query | hardwareWord | string | false | 指定设备字典_id | 5ebe578fb64352001b1f3876 | |
query | depart | string | false | 层级 | _id | |
query | query['tags'] | string | false | 标签 | {$all:['空调']} |
请求参数举例
注意
GET请求所有参数类型都会变成string拼接在url上面,文档为了表述清晰,将示例结构以json格式编写
{
"page":"1",
"limit":"2",
"sort":"-createdAt",
"autopopulate":"false"
}
返回参数
参数名称 | 数据类型 | 是否必须 | 参数描述 |
---|---|---|---|
code | number | True | 是否成功 |
data | json | True | 返回数据 |
-total | number | False | 设备总条数 |
-rows | array | False | 当前返回的设备字典对象列表 |
返回参数举例
{
"code": 0,
"data": {
"total": 1007,
"rows": [
{
"status": 0,
"line_status": 0,
"uiModelPropsItemNum": 0,
"uiModelProps": [],
"_id": "6040a256071022001b2ede1d",
"attribute": [],
"serialData": {
"_id": "6040a256071022001b2ede1e",
"comName": null,
"baud": 9600,
"verification": "none",
"stopBit": 1,
"dataBit": 8,
"state": false,
"address": null
},
"name": "温湿度变送器XY-MD02",
"type": 0,
"code": "XY-MD02",
"agreement": {
"state": 0,
"_id": "6040882ecd0c5f001b248e40",
"type": 1,
"name": "XY-MD02",
"notes": "XY-MD02温湿度变送器",
"edition": "V1.0",
"hanShu": "agreement/XY-MD02/index.source.js",
"minJs": "agreement/XY-MD02/index.js",
"minNode": "agreement/XY-MD02/index.node.js",
"createdAt": "2021-03-04T07:11:42.528Z",
"updatedAt": "2021-03-04T07:11:42.528Z",
"__v": 0
},
"defaultOperate": [],
"defaultCheck": [
{
"_id": "6040a256071022001b2ede1f",
"name": "湿度",
"sort": 2,
"company": "%",
"icon": "icon-kongqishidu",
"analysis": "function analyze(data){ data=parseInt(data,16); return data/10 }",
"interval": null,
"rosterName": null,
"address": "2",
"precision": 0.5,
"numericalValue": null,
"exAnalysis": null,
"canRead": null,
"boardConfigStr": "{}"
},
{
"_id": "6040a256071022001b2ede20",
"name": "温度",
"sort": 1,
"company": "℃",
"icon": "icon-wenshidu",
"analysis": "function analyze(wendu){ \n var func = wendu.substr(0,2);\n if(func==\"FF\"||func==\"ff\"){\n wendu=(parseInt(wendu,16)-65536)/10\n }else{\n wendu = parseInt(wendu,16)/10;\n } \n return wendu;\n }",
"interval": null,
"rosterName": null,
"address": "1",
"precision": 1,
"numericalValue": null,
"exAnalysis": null,
"canRead": false,
"boardConfigStr": "{}"
}
],
"rosterModel": [],
"defaultClean": [],
"createdAt": "2021-03-04T09:03:18.698Z",
"updatedAt": "2021-05-26T09:05:37.039Z",
"__v": 1,
"image": "https://res.25soft.com/api/uploads/60ae0f4bf4e9cf0006487ee0/温湿度变送器.png"
}
]
}
}
# 查询设备字典ID
接口说明
根据设备字典ID查询设备字典
接口版本
v1接口地址
/api-web-v1/hardwareWords/:id
请求方法
GET
请求参数
参数类型 | 参数名称 | 数据类型 | 是否必须 | 参数描述 |
---|---|---|---|---|
params | id | string | True | 设备字典ID |
请求参数举例
注意
GET请求所有参数类型都会拼接在url上面,文档为了表述清晰,将示例结构以json格式编写
{
"_id": "6040a256071022001b2ede1d"
}
返回参数
参数名称 | 数据类型 | 是否必须 | 参数描述 |
---|---|---|---|
code | number | True | 是否成功 |
data | json | false | 返回设备字典信息 |
返回参数举例
{
"code": 0,
"data": {
"status": 0,
"line_status": 0,
"uiModelPropsItemNum": 0,
"uiModelProps": [],
"_id": "6040a256071022001b2ede1d",
"attribute": [],
"serialData": {
"_id": "6040a256071022001b2ede1e",
"comName": null,
"baud": 9600,
"verification": "none",
"stopBit": 1,
"dataBit": 8,
"state": false,
"address": null
},
"name": "温湿度变送器XY-MD02",
"type": 0,
"code": "XY-MD02",
"agreement": {
"state": 0,
"_id": "6040882ecd0c5f001b248e40",
"type": 1,
"name": "XY-MD02",
"notes": "XY-MD02温湿度变送器",
"edition": "V1.0",
"hanShu": "agreement/XY-MD02/index.source.js",
"minJs": "agreement/XY-MD02/index.js",
"minNode": "agreement/XY-MD02/index.node.js",
"createdAt": "2021-03-04T07:11:42.528Z",
"updatedAt": "2021-03-04T07:11:42.528Z",
"__v": 0
},
"defaultOperate": [],
"defaultCheck": [
{
"_id": "6040a256071022001b2ede1f",
"name": "湿度",
"sort": 2,
"company": "%",
"icon": "icon-kongqishidu",
"analysis": "function analyze(data){ data=parseInt(data,16); return data/10 }",
"interval": null,
"rosterName": null,
"address": "2",
"precision": 0.5,
"numericalValue": null,
"exAnalysis": null,
"canRead": null,
"boardConfigStr": "{}"
},
{
"_id": "6040a256071022001b2ede20",
"name": "温度",
"sort": 1,
"company": "℃",
"icon": "icon-wenshidu",
"analysis": "function analyze(wendu){ \n var func = wendu.substr(0,2);\n if(func==\"FF\"||func==\"ff\"){\n wendu=(parseInt(wendu,16)-65536)/10\n }else{\n wendu = parseInt(wendu,16)/10;\n } \n return wendu;\n }",
"interval": null,
"rosterName": null,
"address": "1",
"precision": 1,
"numericalValue": null,
"exAnalysis": null,
"canRead": false,
"boardConfigStr": "{}"
}
],
"rosterModel": [],
"defaultClean": [],
"createdAt": "2021-03-04T09:03:18.698Z",
"updatedAt": "2021-05-26T09:05:37.039Z",
"__v": 1,
"image": "https://res.25soft.com/api/uploads/60ae0f4bf4e9cf0006487ee0/温湿度变送器.png"
}
}
# 新建
接口说明
新建一个设备字典设置。
接口版本
v1接口地址
/api-v1/hardwareWords
请求方法
POST
请求参数
参数类型 | 参数名称 | 数据类型 | 是否必须 | 参数描述 |
---|---|---|---|---|
body | - | Object | True | 设备字典对象字段说明 |
请求参数举例
{
"status": 0,
"line_status": 0,
"uiModelPropsItemNum": 0,
"uiModelProps": [],
"attribute": [],
"serialData": {
"_id": "6040a256071022001b2ede1e",
"comName": null,
"baud": 9600,
"verification": "none",
"stopBit": 1,
"dataBit": 8,
"state": false,
"address": null
},
"name": "温湿度变送器XY-MD02",
"type": 0,
"code": "XY-MD02",
"agreement": "6040882ecd0c5f001b248e40",
"defaultOperate": [],
"defaultCheck": [
{
"name": "湿度",
"sort": 2,
"company": "%",
"icon": "icon-kongqishidu",
"analysis": "function analyze(data){ data=parseInt(data,16); return data/10 }",
"interval": null,
"rosterName": null,
"address": "2",
"precision": 0.5,
"numericalValue": null,
"exAnalysis": null,
"canRead": null,
"boardConfigStr": "{}"
},
{
"name": "温度",
"sort": 1,
"company": "℃",
"icon": "icon-wenshidu",
"analysis": "function analyze(wendu){ \n var func = wendu.substr(0,2);\n if(func==\"FF\"||func==\"ff\"){\n wendu=(parseInt(wendu,16)-65536)/10\n }else{\n wendu = parseInt(wendu,16)/10;\n } \n return wendu;\n }",
"interval": null,
"rosterName": null,
"address": "1",
"precision": 1,
"numericalValue": null,
"exAnalysis": null,
"canRead": false,
"boardConfigStr": "{}"
}
],
"rosterModel": [],
"defaultClean": [],
"image": "https://res.25soft.com/api/uploads/60ae0f4bf4e9cf0006487ee0/温湿度变送器.png"
}
// Make sure to add code blocks to your code group
返回参数
参数名称 | 数据类型 | 是否必须 | 参数描述 |
---|---|---|---|
code | number | True | 是否成功 |
data | json | True | 返回创建的对象 |
返回参数举例
{
"status": 0,
"line_status": 0,
"uiModelPropsItemNum": 0,
"uiModelProps": [],
"_id": "6040a256071022001b2ede1d",
"attribute": [],
"serialData": {
"_id": "6040a256071022001b2ede1e",
"comName": null,
"baud": 9600,
"verification": "none",
"stopBit": 1,
"dataBit": 8,
"state": false,
"address": null
},
"name": "温湿度变送器XY-MD02",
"type": 0,
"code": "XY-MD02",
"agreement": {
"state": 0,
"_id": "6040882ecd0c5f001b248e40",
"type": 1,
"name": "XY-MD02",
"notes": "XY-MD02温湿度变送器",
"edition": "V1.0",
"hanShu": "agreement/XY-MD02/index.source.js",
"minJs": "agreement/XY-MD02/index.js",
"minNode": "agreement/XY-MD02/index.node.js",
"createdAt": "2021-03-04T07:11:42.528Z",
"updatedAt": "2021-03-04T07:11:42.528Z",
"__v": 0
},
"defaultOperate": [],
"defaultCheck": [
{
"_id": "6040a256071022001b2ede1f",
"name": "湿度",
"sort": 2,
"company": "%",
"icon": "icon-kongqishidu",
"analysis": "function analyze(data){ data=parseInt(data,16); return data/10 }",
"interval": null,
"rosterName": null,
"address": "2",
"precision": 0.5,
"numericalValue": null,
"exAnalysis": null,
"canRead": null,
"boardConfigStr": "{}"
},
{
"_id": "6040a256071022001b2ede20",
"name": "温度",
"sort": 1,
"company": "℃",
"icon": "icon-wenshidu",
"analysis": "function analyze(wendu){ \n var func = wendu.substr(0,2);\n if(func==\"FF\"||func==\"ff\"){\n wendu=(parseInt(wendu,16)-65536)/10\n }else{\n wendu = parseInt(wendu,16)/10;\n } \n return wendu;\n }",
"interval": null,
"rosterName": null,
"address": "1",
"precision": 1,
"numericalValue": null,
"exAnalysis": null,
"canRead": false,
"boardConfigStr": "{}"
}
],
"rosterModel": [],
"defaultClean": [],
"createdAt": "2021-03-04T09:03:18.698Z",
"updatedAt": "2021-05-26T09:05:37.039Z",
"__v": 1,
"image": "https://res.25soft.com/api/uploads/60ae0f4bf4e9cf0006487ee0/温湿度变送器.png"
}
# 编辑
接口说明
修改设备。第三方不建议直接调用设备字典修改接口,此接口使用需实际设备。
接口版本
v1接口地址
/api-v1/hardwareWords/:id
请求方法
PUT
请求参数
参数类型 | 参数名称 | 数据类型 | 是否必须 | 参数描述 |
---|---|---|---|---|
params | id | string | True | 修改的检测器ID |
body | - | Object | True | 设备对象 |
请求参数举例
{
"name": "温湿度变送器XY-MD02"
}
// Make sure to add code blocks to your code group
返回参数
参数名称 | 数据类型 | 是否必须 | 参数描述 |
---|---|---|---|
code | number | True | 是否成功 |
data | json | True | 返回创建的对象 |
返回参数举例
{
"code": 0,
"data": {
"status": 0,
"line_status": 0,
"uiModelPropsItemNum": 0,
"uiModelProps": [],
"_id": "6040a256071022001b2ede1d",
"attribute": [],
"serialData": {
"_id": "6040a256071022001b2ede1e",
"comName": null,
"baud": 9600,
"verification": "none",
"stopBit": 1,
"dataBit": 8,
"state": false,
"address": null
},
"name": "温湿度变送器XY-MD02",
"type": 0,
"code": "XY-MD02",
"agreement": {
"state": 0,
"_id": "6040882ecd0c5f001b248e40",
"type": 1,
"name": "XY-MD02",
"notes": "XY-MD02温湿度变送器",
"edition": "V1.0",
"hanShu": "agreement/XY-MD02/index.source.js",
"minJs": "agreement/XY-MD02/index.js",
"minNode": "agreement/XY-MD02/index.node.js",
"createdAt": "2021-03-04T07:11:42.528Z",
"updatedAt": "2021-03-04T07:11:42.528Z",
"__v": 0
},
"defaultOperate": [],
"defaultCheck": [
{
"_id": "6040a256071022001b2ede1f",
"name": "湿度",
"sort": 2,
"company": "%",
"icon": "icon-kongqishidu",
"analysis": "function analyze(data){ data=parseInt(data,16); return data/10 }",
"interval": null,
"rosterName": null,
"address": "2",
"precision": 0.5,
"numericalValue": null,
"exAnalysis": null,
"canRead": null,
"boardConfigStr": "{}"
},
{
"_id": "6040a256071022001b2ede20",
"name": "温度",
"sort": 1,
"company": "℃",
"icon": "icon-wenshidu",
"analysis": "function analyze(wendu){ \n var func = wendu.substr(0,2);\n if(func==\"FF\"||func==\"ff\"){\n wendu=(parseInt(wendu,16)-65536)/10\n }else{\n wendu = parseInt(wendu,16)/10;\n } \n return wendu;\n }",
"interval": null,
"rosterName": null,
"address": "1",
"precision": 1,
"numericalValue": null,
"exAnalysis": null,
"canRead": false,
"boardConfigStr": "{}"
}
],
"rosterModel": [],
"defaultClean": [],
"createdAt": "2021-03-04T09:03:18.698Z",
"updatedAt": "2021-05-26T09:05:37.039Z",
"__v": 1,
"image": "https://res.25soft.com/api/uploads/60ae0f4bf4e9cf0006487ee0/温湿度变送器.png"
}
}
# 删除
接口说明
删除一个设备字典。第三方不建议直接调用设备字典删除接口,此接口需实际设备下的设备字典。
接口版本
v1接口地址
/api-v1/hardwareWords/:id
请求方法
DELETE
请求参数
参数类型 | 参数名称 | 数据类型 | 是否必须 | 参数描述 |
---|---|---|---|---|
params | id | string | True | 删除的设备字典ID |
请求参数举例
只需发送删除检测器的ID
返回参数
参数名称 | 数据类型 | 是否必须 | 参数描述 |
---|---|---|---|
code | number | True | 是否成功 |
message | string | false | 成功删除返回complete |
返回参数举例
{
"code": 0,
"message": "complete"
}
第三方不建议直接调用设备删除接口,此接口需实际设备。文档不提供删除在线调试
上次更新: 2023/03/20, 15:30:53