# 微瓴数字空间通用接口文档
# 1. 概述
# 1.1.简介
微瓴DataSpace即微瓴数字空间,提供所有关于数据的计算、存储、管理与分发,包括静态地理数据的格式规范、编码体系、数据管理、模型构建;动态物联设备数据的系统对接、协议标准、数据上报、解析转换、分析清洗、逻辑流转、规则联动等服务。
应用开发商、设备开发者可通过数字空间提供的可视化配置,实现简单易用的配置管理和规则联动,以微服务架构来设计分布式调用逻辑,基于简单、实用、灵活的理念,每一个服务拥有各自的某一端到端业务场景(功能)与数据(数据库),服务之间互相不共享,避免产生依赖或继承抽象的接口、服务、模块。
# 1.2.特性与定义
接入微瓴:见微瓴开放平台说明:
(https://open.welink.qq.com/#/dev-resource/guide/platform)
你可以上报设备数据(状态、位置、)
通过微瓴可以获得的数据:
A. 静态数据(低频变化)
基础地理
地图
路线
地点
设备地理
B. 动态数据(高频变化)
物联设备
水电煤气表
能源、空调、冷机、给排水、消防、报警、广播、变配电、电梯、门禁等
移动对象(人、车、Robot位置)
上报位置
获取实时定位
C. 数据挖掘服务
统计与分析
数据学习
# 1.3.应用场景
应用场景举例,见章节5
# 1.4.名词解释
wId
为唯一ID,可理解为身份证,全平台通用字段,以参数形式使用。
wid可代表
静态的(建筑、楼层、房间、地点),
动态的(物联设备、移动对象人、车、机器人)
某种组合服务等。
POIID
地理层级ID,可表达地理嵌套关系,具体可参考下图地理层级关系图。
父子包含关系通过POIID规则继承示意图
POICODE
分类编码,区分不同种类。查询方法 见2.2.9
Projectid
项目id号。
与物联设备控制有关
DIN
物联设备唯一标识,可以是物联网关
Subid
子设备id,同一个物联网关可级联多个子设备,通过子设备id实现独立控制。
与权限验证及登录有关
token
动态密钥,有效时间20分钟,需重新登录。所有访问均需要带着token来获取。
appid
应用系统的 id,由平台分配,在开放平台注册申请。
https://open.welink.qq.com/#/dev-resource/guide/app-access
appsecret
同上。
app_ticket
用于登录API的应用票据,app_ticket有时间期限,请注意及时更新票据
Sig
加密的密文,用于登录API使用,生成方式见生成签名样例
生成规则,参考以下链接中的“签名机制”。
https://open.welink.qq.com/#/dev-resource/api/user-guide
DP
Datapoint,在微瓴物联平台申请的功能 ID
message_type
message_type | 说明 |
---|---|
1000100 | 文本消息广播至相关联的应用系统 |
1000101 | Json消息广播至相关联的应用系统 |
1000200 | 发送文本消息至其他应用系统 |
1000201 | 发送Json消息至其他应用系统 |
1000300 | 推送告警类消息给微瓴平台,不直接推送给应用,微瓴平台会针对告警消息的业务类别推送给相应的业务应用 |
1000302 | 推送告警类消息给微瓴平台,不直接推送给应用,微瓴平台会针对告警消息的业务类别推送给相应的业务应用 |
1000400 | 推送通知类消息给微瓴平台,不直接推送给应用,微瓴平台会针对通知消息的业务类别推送给相应的业务应用 |
1000500 | 推送普通消息给微瓴平台作为数据存储,不推送给应用 |
设备影子
设备影子是服务器端为设备缓存的一份状态和配置数据,代表着物理设备的一个数字化映射。
(TODO )
消息订阅
(TODO 实现能力、 websocket 等)
# 2. 微瓴静态数据接口
# 2.1.对象地理object-geo
# 2.1.1. WID查询坐标
- 功能描述 获取某对象的基本空间信息。
- 请求URL:
/space/geo/object/getByWId
- 请求方式:
GET
- 请求参数
参数名 | 类型 | 必填 | 数据约束 | 描述 |
---|---|---|---|---|
token | String | 是 | 非空且长度固定128个字符 | 动态密钥,有效期20分钟,需重新登录 |
wId | String | 是 | 非空且长度固定36位 | (注意是wId路径参数) 对象的唯一标识 |
project_id | String | 否 | 非空 | 项目编号 |
- 请求示例
/space/geo/object/getByWId
?wId=0007e43d-45d7-44c0-acfc-fc5539b6516a
&token=
2
3
- 返回参数
名称 | 类型 | 说明 | 示范值 | |
code | number | 返回码 | 返回码;0表示成功,非0表示出错 | |
success | Boolean | 错误信息 | 返回信息;true 表示成功,false 表示出错 | |
data | array | 对象数组 | ||
wId | string | 对象的唯一标识 | "0007e43d-45d7-44c0-acfc-fc5539b6516a", | |
poiId | string | POI编号 | "4403002230221018_9", | |
name | string | 设备名称 | "蓝牙ibeacon", | |
boothId | string | 现场编号 | "", | |
level | number | 对象所属层级 | 9, | |
longitude | number | 经度gcj20 | 113.935327719, | |
latitude | number | 纬度 | 22.522594372, | |
height | number | 绝对高度 | 86.45, | |
poiCode | string | 分类编码 | "w0907015", | |
sn | string | 设备SN实际编码 | "1918FC0636A0", | |
positionText | string | 位置描述 | "腾讯滨海大厦滨海南塔F18" |
- 返回示例
{
"code": 0,
"data": {
"wId": "0007e43d-45d7-44c0-acfc-fc5539b6516a",
"poiId": "4403002230221018_9",
"name": "蓝牙ibeacon",
"boothId": "",
"level": 9,
"longitude": 113.935327719,
"latitude": 22.522594372,
"height": 86.45,
"poiCode": "w0907015",
"sn": "1918FC0636A0",
"positionText": "腾讯滨海大厦_滨海南塔_F18"
},
"success": true
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# 2.1.2. 坐标查询WID
- 功能描述
获取包含指定坐标位置和指定父级空间对象的空间对象列表,如已知某设备对象的坐标和设备所在楼层,查询空间范围上包含该设备的自定义区域等。
- 请求URL:
/space/geo/getObjectsContainLocation
- 请求方式:
GET
- 请求参数
参数名 | 类型 | 必填 | 数据约束 | 描述 |
---|---|---|---|---|
token | String | 是 | 非空且长度固定128个字符 | 动态密钥,有效期20分钟,需重新登录 |
location | String | 是 | 非空 | 坐标位置,经纬度,格式:“纬度,经度”,如22.522646,113.935486 |
parentPoiId | String | 是 | 非空 | 父级对象的空间id ,如滨海大厦 '440300223022' |
project_id | String | 否 | 非空 | 项目编号 |
- 请求示例
/space/geo/getObjectsContainLocation
?location=22.522646%2C113.935486
&parentPoiId=44030022
&token=
2
3
4
- 返回参数
名称 | 类型 | 说明 | 示范值 | |
code | number | 返回码 | 返回码;0表示成功,非0表示出错 | |
success | Boolean | 错误信息 | 返回信息;true 表示成功,false 表示出错 | |
data | array | 对象数组 | ||
wId | string | 对象的唯一标识 | "638d5b0a-744d-4643-a7a6-cfc489875105", | |
poiId | string | POI编号 | "4403002230221007", | |
name | string | 设备名称 | "F7", | |
level | number | 对象所属层级 | 7, | |
longitude | number | 经度gcj20 | 113.935327719, | |
latitude | number | 纬度 | 22.522594372, | |
height | number | 绝对高度 | 35, | |
poiCode | string | 分类编码 | " m99999000", | |
positionText | string | 位置描述 | "腾讯滨海大厦_F7" |
- 返回示例
{
"code": 0,
"data": [
{
"wId": "638d5b0a-744d-4643-a7a6-cfc489875105",
"poiId": "4403002230221007",
"name": "F7",
"level": 7,
"longitude": 113.93536231722,
"latitude": 22.5228742683381,
"height": 35,
"poiCode": "m99999000",
"positionText": "腾讯滨海大厦_F7"
}
],
"success": true
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# 2.1.3. WID查询父级包含位置信息
- 功能描述
通过WID查询对象的父级空间包含关系及位置信息。例如:某个智能设备level9,查询此设备所处的level8房间名、level7楼层、level6建筑名等。
- 请求URL:
/space/geo/object/getLocationByWId
- 请求方式:
GET
- 请求参数
参数名 | 类型 | 必填 | 数据约束 | 描述 |
---|---|---|---|---|
token | String | 是 | 非空长度固定128位 | 动态密钥,有效期20分钟,需重新登录 |
wId | String | 是 | 非空长度固定36位 | (注意是wId路径参数) 对象的唯一标识 |
project_id | String | 否 | 非空 | 项目编号 |
- 请求示例
/space/geo/object/getLocationByWId
?wId=00019062-f1bd-4538-b5bf-14030ce7970d
&token=
2
3
返回参数
名称 类型 说明 示范值 code number 返回码 返回码;0表示成功,非0表示出错 success Boolean 错误信息 返回信息;true 表示成功,false 表示出错 data array 对象数组 wId string 对象的唯一标识 "0007e43d-45d7-44c0-acfc-fc5539b6516a", poiId string POI编号 "4403002230221018_9", name string 设备名称 "蓝牙ibeacon", level number 对象所属层级 9, longitude number 经度gcj20 113.935327719, latitude number 纬度 22.522594372, height number 绝对高度 86.45, poiCode string 分类编码 "w0907015", positionText string 位置描述 "腾讯滨海大厦_滨海南塔_F18" location array 数组(父级别) wId string 对象的唯一标识 poiId string POI编号 name string 设备名称 level number 对象所属层级 longitude number 经度gcj20 latitude number 纬度 height number 绝对高度 poiCode string 分类编码 positionText string 位置描述 返回示例
{
"code": 0,
"data": {
"wId": "00019062-f1bd-4538-b5bf-14030ce7970d",
"poiId": "44030022302210280510308",
"name": "工位",
"level": 8,
"longitude": 113.935115841964,
"latitude": 22.5230798095138,
"height": 128.9,
"poiCode": "m00403000",
"positionText": "腾讯滨海大厦_F28_工位",
"location": [
{
"wId": "a66348f2-0700-1000-abcd-35269c4636aa",
"poiId": "440300223022",
"name": "腾讯滨海大厦",
"level": 6,
"longitude": 113.935131878688,
"latitude": 22.52347513938,
"height": -6.3
},
{
"wId": "e0ace2f8-3823-4acc-989a-4db7bcf35f54",
"poiId": "4403002230221028",
"name": "F28",
"level": 7,
"longitude": 113.93536231722,
"latitude": 22.5228742683381,
"height": 128.9,
"poiCode": "m99999000",
"positionText": "腾讯滨海大厦_F28"
}
]
},
"success": true
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# 2.1.4. 批量查询对象
- 功能描述
批量返回某个建筑范围内的所有父子对象列表,如:已知某建筑wId(level6),查询本建筑的所有楼层(level7)、某层楼的所有房间(level8)等。关于不同层级对象的 POIID 与 Level 定义,见“名词解释”中 POIID 的介绍。
- 请求URL:
/space/geo/object/getSubObjects
- 请求方式:
GET
- 请求参数
参数名 | 类型 | 必填 | 数据约束 | 描述 |
---|---|---|---|---|
token | String | 是 | 非空且长度固定128个字符 | 动态密钥,有效期20分钟,需重新登录 |
wId | String | 是 | 非空且长度固定36位 | 对象的唯一标识,例如填入大厦wid或者楼层wid |
poiCode | String | 是 | 不超过64个字符 | 分类编码,详见2.2.9查询分类编码接口, 例如:洗手间m00201、车位号m00500000、照明灯具w0107006 |
level | String | 是 | 7(楼层)、8(房间)、9(设备点) | |
offset | int | 是 | 偏移量,默认为0 | |
limit | int | 是 | ||
name | String | 否 | ||
boothId | String | 否 | 图纸编号 精确值 | |
boothIdText | String | 否 | 图纸编号 文本匹配模糊查询 | |
srid | String | 否 | 默认值为4326 | |
dinNotEmpty | Boolean | 否 | 默认值为False | |
project_id | String | 否 | 非空 | 项目编号 |
备注: 1.offset和limit为自主分页请求参数,若数据量(返回结果中的totalRow)超过接口limit最大限制,建议偏移offset获取数据 2.limit最大限制2万条。当请求超过2千条时,接口将出现warn提示
- 请求示例
/space/geo/object/getSubObjects
?level=8
&offset=0
&limit=2
&wId=a66348f2-0700-1000-abcd-35269c4636aa
&poiCode=m
&token=
&name=
&srid=
&dinNotEmpty=
2
3
4
5
6
7
8
9
10
返回参数
名称 类型 描述 code String 0表示成功,非0表示出错 success Boolean true 表示成功,false 表示出错 data array 对象数组 wId String 对象的唯一标识,例如填入大厦wid或者楼层wid poiId String poiID见继承规则 Name String 名称 Level Number 7(楼层)、8(房间)、9(设备点) Longitude Number 经度, Latitude Number 纬度, Height Number 高度,相对高度,非绝对海拔 PoiCode String 分类编码,详见查询分类编码接口,例如:洗手间m00201、车位号m00500000、照明灯具w0107006 totalRow Number 返回数量 返回示例
{
"code": 0,
"data": {
"features": [
{
"level": 7,
"latitude": 22.523381873802,
"wId": "bae86426-d9b5-43ed-9e94-3e7238d7b83b",
"name": "F31",
"poiId": "4403002230221031",
"poiCode": "m99999000",
"height": 141.95,
"longitude": 113.935474696462
}
],
"totalRow": 12
},
"success": true
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 2.1.5. 批量查询地理对象
- 功能描述
批量返回某个空间范围内的所有对象列表,如:某栋建筑的所有楼层(level7)、某层楼的所有房间(level8)、某个房间内的某种设备(level9)等。
- 请求URL:
/space/geo/object/getGeoSubObjects
- 请求方式:
GET
- 请求参数
参数名 | 类型 | 必填 | 数据约束 | 描述 |
---|---|---|---|---|
token | String | 是 | 非空且长度固定128个字符 | 动态密钥,有效期20分钟,需重新登录 |
wId | String | 是 | 非空且长度固定36位 | 对象的唯一标识,例如填入大厦wid或者楼层wid |
poiCode | String | 是 | 不超过64个字符 | 分类编码,详见2.2.9查询分类编码接口, 例如:洗手间m00201、车位号m00500000、照明灯具w0107006 |
level | String | 是 | 7(楼层)、8(房间)、9(设备点) | |
offset | int | 是 | 偏移量,默认为0 (从第0条记录开始获取) | |
limit | int | 是 | 记录限制,默认50 | |
name | String | 否 | ||
project_id | String | 否 | 非空 | 项目编号 |
备注: 1.offset和limit为自主分页请求参数,若数据量(返回结果中的totalRow)超过接口limit最大限制,建议偏移offset获取数据 2.limit最大限制2万条。当请求超过2千条时,接口将出现warn提示
- 请求示例
/space/geo/object/getGeoSubObjects
?poiCode=m99
&level=7
&name=F7
&token=
&wId=a66348f2-0700-1000-abcd-35269c4636aa
2
3
4
5
6
返回参数
名称 类型 说明 示范值 code number 返回码 返回码;0表示成功,非0表示出错 success Boolean 错误信息 返回信息;true 表示成功,false 表示出错 data array 对象数组 totalRow number type string features array geometry array 空间对象 coordinates array 对象坐标串 如果是面第一个点与最后一个点相同 longitude,Latitude Number 经度,纬度 点1 longitude,Latitude Number 经度,纬度 点N type string 空间对象的几何类型 例如:复合多线'MultiLineString', 多边形'Polygon',复合多边形 'MultiPolygon', id string 对象的唯一标识 type string 类型 properties array 数组(属性) wId string 对象的唯一标识 poiId string POI编号 name string 设备名称 level number 对象所属层级 longitude number 经度gcj20 latitude number 纬度 height number 绝对高度 poiCode string 分类编码 positionText string 位置描述 返回示例
{
"code": 0,
"data": {
"features": [
{
"geometry": {
"coordinates": [
[
[
[
113.935474696462,
22.523381873802
],
[
113.935487513624,
22.5233446500345
]
]
]
],
"type": "MultiPolygon"
},
"id": "bae86426-d9b5-43ed-9e94-3e7238d7b83b",
"type": "Feature",
"properties": {
"gid": 18196,
"level": 7,
"latitude": 22.523381873802,
"wId": "bae86426-d9b5-43ed-9e94-3e7238d7b83b",
"name": "F31",
"poiId": "4403002230221031",
"poiCode": "m99999000",
"height": 141.95,
"longitude": 113.935474696462
}
}
],
"type": "FeatureCollection"
},
"success": true
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# 2.1.6. 保存/编辑自定义边界
- 功能描述
保存或者编辑自定义边界对象。
- 请求URL:
/space/geo/saveMetaArea
- 请求方式:
POST
- 请求参数
参数名 | 类型 | 必填 | 数据约束 | 描述 |
---|---|---|---|---|
token | String | 是 | 非空且长度固定128个字符 | 动态密钥,有效期20分钟,需重新登录 |
project_id | String | 否 | 非空 | 项目编号 |
- 请求示例
https://api.weiling.qq.com/space/geo/saveMetaArea?token=
- 请求包体
格式: application/json
中心点模式的自定义边界:
{
"name": "测试123",
"level": 8,
"height": -6.3,
"poiCode": 99901000,
"extMetaArea": {
"parentPoiId": "4403002230220001",
"mode": "point",
"center": {
"longitude": 113.935250639562,
"latitude": 22.522482718566
},
"radius": 400
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
多边形模式的自定义边界:
{
"wId": "1db2977f-466c-4dae-95f0-83624e4d4c6d",
"name": "测试1234",
"level": 8,
"height": -6.3,
"extMetaArea": {
"parentPoiId": "4403002230220001",
"mode": "polygon",
"points": [
{
"longitude": 113.935250639562,
"latitude": 22.522482718566
},
{
"longitude": 113.935250639562,
"latitude": 22.622482718566
},
{
"longitude": 113.965250639562,
"latitude": 22.622482718566
},
{
"longitude": 113.965250639562,
"latitude": 22.522482718566
}
]
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
- 包体参数
参数名 | 类型 | 必填 | 数据约束 | 描述 |
---|---|---|---|---|
wId | String | 否 | 长度固定36位 | 对象的唯一标识;若有 wId,表示更新;若无wId,表示新增 |
level | Integer | 是 | 数字,范围1-9 | 自定义空间对象所在空间层级 |
poiCode | String | 是 | 非空 | 自定义空间对象的空间分类编码 |
parentPoiId | String | 是 | 非空 | 自定义空间对象的父级对象的 PoiId |
mode | String | 是 | 非空,point 或 polygon | 自定义空间的模式;point 表示中心点模式,使用中心点和半径表示;polygon 表示多边形模式,使用多个顺序点表示 |
center | Object | 否 | 当mode为 point时为必须 | 中心点模式的自定义边界对象的中心点坐标,经纬度 |
radius | Number | 否 | 当 mode 为 point 时为必须 | 中心点模式的自定义边界对象的半径,单位米 |
points | List | 否 | 当mode为 polygon时必须 | 多边形模式的自定义边界对象的各点坐标,经纬度;注意顺序有关 |
返回参数
名称 类型 说明 示范值 code number 返回码 返回码;0表示成功,非0表示出错 success Boolean 错误信息 返回信息;true 表示成功,false 表示出错 data array 对象数组 wId string 对象的唯一标识 "0007e43d-45d7-44c0-acfc-fc5539b6516a", poiId string POI编号 "4403002230221018_9", name string 设备名称 "蓝牙ibeacon", level number 对象所属层级 9, longitude number 经度gcj20 113.935327719, latitude number 纬度 22.522594372, height number 绝对高度 86.45, poiCode string 分类编码 "w0907015", extMetaArea array 数组 自定义区域边界 parentPoiId array 父级别POI编号 radius string 对象的唯一标识 中心点模式的自定义边界对象的半径,单位米 points array 坐标串数组 多边形模式的自定义边界对象的各点坐标,经纬度;注意顺序有关 longitude number 经度gcj20 latitude number 纬度 mode string 自定义空间的模式 例如:多边形'Polygon' 返回示例
{
"code": 0,
"data": {
"wId": "c11e6aed-8033-44c7-8113-b5af0816fd8e",
"poiId": "4403002230220001_ma",
"level": 8,
"longitude": 113.950250639562,
"latitude": 22.572482718566,
"height": -6.3,
"extMetaArea": {
"parentPoiId": "4403002230220001",
"radius": 0,
"points": [
{
"latitude": 22.522482718566,
"longitude": 113.935250639562
},
{
"latitude": 22.622482718566,
"longitude": 113.935250639562
},
{
"latitude": 22.622482718566,
"longitude": 113.965250639562
},
{
"latitude": 22.522482718566,
"longitude": 113.965250639562
}
],
"mode": "polygon"
}
},
"success": true
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# 2.1.7. 查询POICODE分类编码
- 功能描述
查询分类编码(即 PoiCode)。
- 请求URL:
/space/geo/getCatalog
- 请求方式:
GET
- 请求参数
参数名 | 类型 | 必填 | 数据约束 | 描述 |
---|---|---|---|---|
token | String | 是 | 非空且长度固定128个字符 | 动态密钥,有效期20分钟,需重新登录 |
projectId | Integer | 是 | Int32 | 项目id,如11 |
page | Integer | 是 | Int32 | 页码,第一页为page为1 |
count | Integer | 是 | 不超过100 | 一页的条目数目 |
poiCode | String | 是 | 不超过64个字符 | 空间对象的poiCode分类编码,例如:w02或m02 |
- 请求示例
/space/geo/getCatalog
?projectId=11
&page=1
&count=10
&poiCode= w0701003
&token=
2
3
4
5
6
返回参数
名称 类型 说明 示范值 code String 0表示成功,非0表示出错 success Boolean 错误信息 返回信息;true 表示成功,false 表示出错 data array 数组 List array 数组 Id number 分类编码表顺序 Name String 名称 Level number 分类编码等级 ParentId number 上一级id号 ProjectId number 项目编号 isAssets Boolean 是否资产 true 为真,false 为否 PoiCode String 分类编码 例如:洗手间m00201、车位号m00500000、照明灯具w0107006 pageNumber number 当前页码 pageSize number 页行数 totalPage number 总页数 totalRow number 返回数量 返回示例
{
"code": 0,
"data": {
"list": [
{
"id": 4886,
"name": "服务设施-未分类",
"level": 2,
"parentId": 1,
"projectId": 11,
"isAssets": false,
"poiCode": "m00200"
},
{
"id": 4888,
"name": "卫生间",
"level": 2,
"parentId": 4886,
"projectId": 11,
"isAssets": false,
"poiCode": "m00201"
},
{
"id": 4894,
"name": "便民设施",
"level": 2,
"parentId": 4888,
"projectId": 11,
"isAssets": false,
"poiCode": "m00202"
}
],
"pageNumber": 1,
"pageSize": 10,
"totalPage": 2,
"totalRow": 12
},
"success": true
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# 2.1.8. DIN查询设备信息
- 功能描述
用DIN查询对象地理信息。
- 请求URL:
/space/inner/device/getDeviceByDeviceId
- 请求方式:
GET
- 请求参数
参数名 | 类型 | 必填 | 数据约束 | 描述 |
---|---|---|---|---|
token | String | 是 | 非空且长度固定128个字符 | 动态密钥,有效期20分钟,需重新登录 |
din | String | 是 | 通常为18位数字 | 设备在微瓴的唯一标识 |
project_id | String | 否 | 非空 | 项目编号 |
- 请求示例
/space/inner/device/getDeviceByDeviceId
?din=144115194541786483
&token=
2
3
返回参数
名称 类型 描述 code String 返回码;0表示成功,非0表示出错 success Boolean 返回信息;true 表示成功,false 表示出错 data array 数组 wid String 对象的唯一标识,例如填入大厦wid或者楼层wid poiId String Poi编号 boothId string 现场编号 name String 名称 level number 层级关系: 例如7(楼层)、8(房间)、9(设备点) longitude number 经度 latitude number 纬度 height number 高度 poiCode String 分类编码,详见查询分类编码接口,例如:洗手间m00201、车位号m00500000、照明灯具w0107006 sn String 厂家编号 din String 物联设备唯一标识,可以是物联网关 subID String 子设备id,同一个物联网关可级联多个子设备,通过子设备id实现独立控制 positionText String 位置描述信息 返回示例
{
"code": 0,
"data": {
"wId": "c25f5978-27e5-45be-8b49-dc4ce6e0b857",
"poiId": "44030022302210250200047_9",
"name": "优图盒子",
"boothId": "北门_2501",
"level": 9,
"longitude": 113.935307547835,
"latitude": 22.5231118649662,
"height": 115.7,
"poiCode": "w0713002",
"sn": "52E8DFBD562D41a0",
"din": "144115194541786483",
"subId": "",
"positionText": "滨海大厦_北塔_25F_西梯-北门_2501"
},
"success": true
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 2.1.9. DIN查询信息及设备父级地理包含关系
- 功能描述
用DIN查询对象地理信息。
- 请求URL:
/space/geo/object/getLocationByDin
- 请求方式:
GET
- 请求参数
参数名 | 类型 | 必填 | 数据约束 | 描述 |
---|---|---|---|---|
token | String | 是 | 非空且长度固定128个字符 | 动态密钥,有效期20分钟,需重新登录 |
din | String | 是 | 设备在微瓴的唯一标识 | |
project_id | String | 否 | 非空 | 项目编号 |
- 请求示例
/space/geo/object/getLocationByDin
?din=144115194541786483
&token=
2
3
返回参数
名称 类型 说明 示范值 code number 返回码 返回码;0表示成功,非0表示出错 success Boolean 错误信息 返回信息;true 表示成功,false 表示出错 data array 对象数组 wId string 对象的唯一标识 "0007e43d-45d7-44c0-acfc-fc5539b6516a", poiId string POI编号 "4403002230221018_9", name string 设备名称 "蓝牙ibeacon", boothId string 现场编号 level number 对象所属层级 9, longitude number 经度gcj20 113.935327719, latitude number 纬度 22.522594372, height number 绝对高度 86.45, poiCode string 分类编码 "w0907015", sn String 厂家编号 din String 物联设备唯一标识,可以是物联网关 subID String 子设备id,同一个物联网关可级联多个子设备,通过子设备id实现独立控制 positionText string 位置描述 "腾讯滨海大厦_滨海南塔_F18" location array 数组(父级别) wId string 对象的唯一标识 poiId string POI编号 name string 设备名称 level number 对象所属层级 longitude number 经度gcj20 latitude number 纬度 height number 绝对高度 返回示例
{
"code": 0,
"data": {
"wId": "c25f5978-27e5-45be-8b49-dc4ce6e0b857",
"poiId": "44030022302210250200047_9",
"name": "优图盒子",
"boothId": "北门_2501",
"level": 9,
"longitude": 113.935307547835,
"latitude": 22.5231118649662,
"height": 115.7,
"poiCode": "w0713002",
"sn": "52E8DFBD562D41a0",
"din": "144115194541786483",
"subId": "",
"positionText": "腾讯滨海大厦_滨海北塔_25F_西梯-北门_2501",
"location": [
{
"wId": "a66348f2-0700-1000-abcd-35269c4636aa",
"poiId": "440300223022",
"name": "腾讯滨海大厦",
"level": 6,
"longitude": 113.935131878688,
"latitude": 22.52347513938,
"height": -6.3
},
{
"wId": "fcbd41c0-dc95-46f8-9616-68e8b96f8c3d",
"poiId": "44030022302210250200047",
"name": "辅助分区(业务上无意义)",
"level": 8,
"longitude": 113.935337645889,
"latitude": 22.5230878195398,
"height": 115.7,
"poiCode": "m99901000",
"positionText": "腾讯滨海大厦_F25_辅助分区(业务上无意义)"
},
{
"wId": "6a1dcf46-f51f-4e39-893f-744d0220f70a",
"poiId": "4403002230221025",
"name": "F25",
"level": 7,
"longitude": 113.935356522636,
"latitude": 22.5228336837518,
"height": 115.7,
"poiCode": "m99999000",
"positionText": "腾讯滨海大厦_F25"
}
]
},
"success": true
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# 2.1.10. DIN查询周围设备信息
- 功能描述
用DIN,PoiCode查询对象地理信息。
- 请求URL:
space/geo/object/listNearbyObjectsByDin
- 请求方式:
GET
- 请求参数
名称 | 类型 | 说明 |
---|---|---|
scopeRadius | number | 搜索半径,单位米 |
scopeLevel | number | 搜索空间范围层级,大于0的整数,其中: 1.同个项目 -(不含该字段或值为 null 或为 0) 2.同个建筑 - 6 3.同一楼层 - 7 4.同一房间/位置区域 - 8 |
objectLevel | number | 表示要搜索的目标的层级,固定为 9,即设备层级 |
objectPoiCode | String | 表示要搜索的目标的 PoiCode,需在管理平台处从字典表中获取 productId 对应的 PoiCode |
limit | number | 查询结果限制,最多 200 个,若不设置,默认最 20 个 |
offset | number | 偏移量, 可以不传这个参数,默认是 0 |
project_id | String | 项目编号 |
- 请求示例
/space/geo/object/listNearbyObjectsByDin?
din=300000000000011111
&scopeRadius=50
&scopeLevel=7
&objectLevel=9
&objectPoiCode=w0701005
&offset=0
&limit=3
&token=****************************
2
3
4
5
6
7
8
9
- 返回参数
名称 | 类型 | 说明 | 示范值 | ||
code | number | 返回码 | 返回码;0表示成功,非0表示出错 | ||
success | Boolean | 错误信息 | 返回信息;true 表示成功,false 表示出错 | ||
data | array | 对象数组 | |||
wId | string | 对象的唯一标识 | "61138b73-d610-4a07-86e5-799667ec02c8", | ||
poiId | string | POI编号 | "4403002230221018_9", | ||
name | string | 设备名称 | "1F 3号楼梯室外出入口摄像头", | ||
boothId | string | 现场编号 | |||
level | number | 对象所属层级 | 2, | ||
longitude | number | 经度gcj20 | 121.37603134392273, | ||
latitude | number | 纬度 | 31.27399460631333, | ||
height | number | 绝对高度 | 2, | ||
poiCode | string | 分类编码 | "w0701005", | ||
sn | String | 厂家编号 | |||
din | String | 物联设备唯一标识,可以是物联网关 | |||
positionText | string | 位置描述 | "英雄商办楼_F1_C070" | ||
distance | number | 距离,数组按从小到大排序;单位:米 | "1.263541036" |
- 返回示例
{
"code": 0,
"data": [
{
"wId": "61138b73-d610-4a07-86e5-799667ec02c8",
"poiId": "310107000000100100037_9",
"name": "1F 3号楼梯室外出入口",
"boothId": "C070",
"level": 9,
"longitude": 121.37603134392273,
"latitude": 31.27399460631333,
"height": 2.0,
"poiCode": "w0701005",
"sn": "iDS-2PT7D28SLW-SH20190910AACHD60871251X",
"din": "300000000000010175",
"positionText": "英雄商办楼_F1_C070",
"distance": 1.263541036
},
{
"wId": "377643db-7b66-4b0a-9cd3-6e59a39434fb",
"poiId": "310107000000100100037_9",
"name": "1F 3号楼梯室外出入口",
"boothId": "C070",
"level": 9,
"longitude": 121.37603134392273,
"latitude": 31.27399460631333,
"height": 2.0,
"poiCode": "w0701005",
"sn": "iDS-2PT7D28SLW-SH20190910AACHD60871251X",
"din": "300000000000010175",
"positionText": "英雄商办楼_F1_C070",
"distance": 1.263541036
},
{
"wId": "7054a5fb-7df8-40c5-bceb-67ec26d40acc",
"poiId": "3101070000001001_9",
"name": "1F VIP电梯厅",
"boothId": "C067",
"level": 9,
"longitude": 121.37603027191103,
"latitude": 31.27400091213877,
"height": 2.0,
"poiCode": "w0701005",
"sn": "iDS-2PT7D28SLW-SH20190910AACHD60871257X",
"din": "300000000000010172",
"positionText": "英雄商办楼_F1_C067",
"distance": 1.92689158
}
],
"success": true
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# 2.1.11. 根据din获取设备
- 功能描述
获取指定din和subId所对应的地理对象,subId传空代表没有subId
- 请求URL:
space/geo/object/getByDin
- 请求方式:
GET
- 请求参数
名称 | 类型 | 说明 | ||
---|---|---|---|---|
token | String | 是 | 非空且长度固定128个字符 | 动态密钥,有效期20分钟,需重新登录 |
din | String | 是 | 非空 | 设备在微瓴的唯一标识 |
project_id | String | 否 | 非空 | 项目编号 |
- 请求示例
/space/geo/object/getByDin?
din=144115194540213736&
token=****************************
2
3
- 返回参数
名称 | 类型 | 说明 | 示范值 | ||
code | number | 返回码 | 返回码;0表示成功,非0表示出错 | ||
success | Boolean | 错误信息 | 返回信息;true 表示成功,false 表示出错 | ||
data | json | 对象数组 | |||
wId | string | 对象的唯一标识 | "0007e43d-45d7-44c0-acfc-fc5539b6516a", | ||
poiId | string | POI编号 | "4403002230221018_9", | ||
name | string | 设备名称 | "蓝牙ibeacon", | ||
level | number | 对象所属层级 | 9, | ||
longitude | number | 经度 | 113.935327719, | ||
latitude | number | 纬度 | 22.522594372, | ||
height | number | 绝对高度 | 86.45, | ||
poiCode | string | 分类编码 | "w0907015", | ||
positionText | string | 位置描述 | "腾讯滨海大厦_滨海南塔_F18" |
- 返回示例
{
"code": 0,
"data": {
"wId": "48a521dd-0fb6-4687-99a4-fe28ca05f50c",
"poiId": "4403002230220003_9",
"name": "网关",
"boothId": "C-010",
"level": 9,
"longitude": 113.934889707,
"latitude": 22.522769728,
"height": -15.7,
"poiCode": "w0107006",
"sn": "009569AEE98C0000",
"din": "144115194540213736",
"subId": "",
"positionText": "腾讯滨海大厦_地下室_B3_地下负三层"
},
"success": true
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 2.1.12. 获取指定din和subId所对应的地理对象
- 功能描述
获取指定din和subId所对应的地理对象,subId传空代表父子都返回
- 请求URL:
/space/geo/object/getGeoObjectsByDinAndSubId
- 请求方式:
GET
- 请求参数
名称 | 类型 | 说明 | ||
---|---|---|---|---|
token | String | 是 | 非空且长度固定128个字符 | 动态密钥,有效期20分钟,需重新登录 |
din | String | 是 | 非空 | 设备在微瓴的唯一标识 |
project_id | String | 否 | 非空 | 项目编号 |
- 请求示例
/space/geo/object/getGeoObjectsByDinAndSubId?
din=144115194540213736&
token=****************************
2
3
- 返回参数
名称 | 类型 | 说明 | 示范值 | ||
code | number | 返回码 | 返回码;0表示成功,非0表示出错 | ||
success | Boolean | 错误信息 | 返回信息;true 表示成功,false 表示出错 | ||
data | array | 对象数组 | |||
wId | string | 对象的唯一标识 | "0007e43d-45d7-44c0-acfc-fc5539b6516a", | ||
poiId | string | POI编号 | "4403002230221018_9", | ||
name | string | 设备名称 | "蓝牙ibeacon", | ||
level | number | 对象所属层级 | 9, | ||
longitude | number | 经度 | 113.935327719, | ||
latitude | number | 纬度 | 22.522594372, | ||
height | number | 绝对高度 | 86.45, | ||
poiCode | string | 分类编码 | "w0907015", | ||
positionText | string | 位置描述 | "腾讯滨海大厦_滨海南塔_F18" |
- 返回示例
{
"code": 0,
"data": [
{
"wId": "2070ca60-a19b-4113-b00a-e0b9c0c9d269",
"poiId": "4403002230220003_9",
"name": "计量灯控模块",
"boothId": "L-0287",
"level": 9,
"longitude": 113.934841972,
"latitude": 22.522797738,
"height": -15.7,
"poiCode": "w0107007",
"sn": "009569AEE98C0000",
"din": "144115194540213736",
"subId": "00124B000FF39D4D",
"cadFloor": "B3",
"positionText": "腾讯滨海大厦_地下室_B3_地下负三层",
"assetExtension": {},
"innerHeight": 0
},
{
"wId": "3b89e67e-51dd-4013-8ea6-990d7269d67c",
"poiId": "4403002230220003_9",
"name": "计量灯控模块",
"boothId": "L-0241",
"level": 9,
"longitude": 113.93488686,
"latitude": 22.52272158,
"height": -15.7,
"poiCode": "w0107007",
"sn": "009569AEE98C0000",
"din": "144115194540213736",
"subId": "00124B000FF3C588",
"cadFloor": "B3",
"positionText": "腾讯滨海大厦_地下室_B3_地下负三层",
"assetExtension": {},
"innerHeight": 0
},
{
"wId": "48a521dd-0fb6-4687-99a4-fe28ca05f50c",
"poiId": "4403002230220003_9",
"name": "网关",
"boothId": "C-010",
"level": 9,
"longitude": 113.934889707,
"latitude": 22.522769728,
"height": -15.7,
"poiCode": "w0107006",
"sn": "009569AEE98C0000",
"din": "144115194540213736",
"subId": "",
"cadFloor": "B3",
"positionText": "腾讯滨海大厦_地下室_B3_地下负三层",
"assetExtension": {},
"innerHeight": 0
}
],
"success": true
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# 2.1.13. wids列出对象
- 功能描述
列出wid列表出所对应的 不含geojson的地理对象
- 请求URL:
/space/geo/object/listByWIds
- 请求方式:
GET
- 请求参数
名称 | 类型 | 说明 | ||
---|---|---|---|---|
token | String | 是 | 非空且长度固定128个字符 | 动态密钥,有效期20分钟,需重新登录 |
wIds | String | 是 | 非空 | 设备标识 |
project_id | String | 否 | 非空 | 项目编号 |
- 请求示例
/space/geo/object/listByWIds?
wIds=291b568a-a0cb-4c29-9af0-5097a5a049b9,a66348f2-0700-1000-abcd-35269c4636aa&
token=****************************
2
3
- 返回参数
名称 | 类型 | 说明 | 示范值 | ||
code | number | 返回码 | 返回码;0表示成功,非0表示出错 | ||
success | Boolean | 错误信息 | 返回信息;true 表示成功,false 表示出错 | ||
data | array | 对象数组 | |||
wId | string | 对象的唯一标识 | "0007e43d-45d7-44c0-acfc-fc5539b6516a", | ||
poiId | string | POI编号 | "4403002230221018_9", | ||
name | string | 设备名称 | "蓝牙ibeacon", | ||
level | number | 对象所属层级 | 9, | ||
longitude | number | 经度 | 113.935327719, | ||
latitude | number | 纬度 | 22.522594372, | ||
height | number | 绝对高度 | 86.45, | ||
poiCode | string | 分类编码 | "w0907015", | ||
positionText | string | 位置描述 | "腾讯滨海大厦_滨海南塔_F18" | ||
assetExtension | jsonObject | 拓展信息 | {"nickName": "xxxx"} |
- 返回示例
{
"code": 0,
"data": [
{
"wId": "291b568a-a0cb-4c29-9af0-5097a5a049b9",
"poiId": "4403002230221004_9",
"name": "计量灯控模块",
"boothId": "L04-0068",
"level": 9,
"longitude": 113.935254413,
"latitude": 22.523169073,
"height": 17,
"poiCode": "w0107007",
"sn": "00019",
"din": "",
"subId": "01101",
"cadFloor": "F4",
"positionText": "腾讯滨海大厦_滨海北塔_F4_北塔",
"assetExtension": {},
"innerHeight": 0
},
{
"wId": "a66348f2-0700-1000-abcd-35269c4636aa",
"poiId": "440300223022",
"name": "腾讯滨海大厦",
"level": 6,
"longitude": 113.935131878688,
"latitude": 22.52347513938,
"height": -6.3,
"innerHeight": 0
}
],
"success": true
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# 2.1.14. wids列出含geojson对象
- 功能描述
列出wid列表出所对应的 含geojson的地理对象
- 请求URL:
/space/geo/object/listGeoByWIds
- 请求方式:
GET
- 请求参数
名称 | 类型 | 说明 | ||
---|---|---|---|---|
token | String | 是 | 非空且长度固定128个字符 | 动态密钥,有效期20分钟,需重新登录 |
srid | string | 是 | srid,项目projectId使用0 | |
wIds | string | 是 | 逗号隔开 | |
project_id | String | 否 | 非空 | 项目编号 |
- 请求示例
/space/geo/object/listGeoByWIds?
wIds=291b568a-a0cb-4c29-9af0-5097a5a049b9,a66348f2-0700-1000-abcd-35269c4636aa&
token=****************************
2
3
返回参数
返回示例
{
"code": 0,
"data": {
"features": [
{
"geometry": {
"coordinates": [
12683214.5046572,
2574454.95392706
],
"type": "Point"
},
"id": "291b568a-a0cb-4c29-9af0-5097a5a049b9",
"type": "Feature",
"properties": {
"latitude": 2574454.953927055,
"din": "",
"assetExtension": {},
"poiId": "4403002230221004_9",
"sn": "00019",
"poiCode": "w0107007",
"height": 17,
"longitude": 12683214.504657235,
"innerHeight": 0,
"cadFloor": "F4",
"level": 9,
"boothId": "L04-0068",
"subId": "01101",
"positionText": "腾讯滨海大厦_滨海北塔_F4_北塔",
"wId": "291b568a-a0cb-4c29-9af0-5097a5a049b9",
"name": "计量灯控模块"
}
},
{
"geometry": {
"coordinates": [
[
[
[
12683200.8642,
2574491.8385
],
[
12683215.3626,
2574488.0287
],
[
12683200.8642,
2574491.8385
]
]
]
],
"type": "MultiPolygon"
},
"id": "a66348f2-0700-1000-abcd-35269c4636aa",
"type": "Feature",
"properties": {
"latitude": 2574491.838499899,
"poiId": "440300223022",
"height": -6.3,
"longitude": 12683200.864200018,
"innerHeight": 0,
"level": 6,
"wId": "a66348f2-0700-1000-abcd-35269c4636aa",
"name": "腾讯滨海大厦"
}
}
],
"type": "FeatureCollection"
},
"success": true
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# 2.1.15. 根据dins列出地理对象
- 功能描述
列出din列表出所对应的 不含geojson的地理对象
- 请求URL:
/space/geo/object/listByDins
- 请求方式:
GET
- 请求参数
名称 | 类型 | 说明 | ||
---|---|---|---|---|
token | String | 是 | 非空且长度固定128个字符 | 动态密钥,有效期20分钟,需重新登录 |
srid | string | 是 | srid,项目projectId使用0 | |
wIds | string | 是 | 逗号隔开 | |
project_id | String | 否 | 非空 | 项目编号 |
- 请求示例
/space/geo/object/listByDins?
dins=144115192394050040,144115192394173152&
token=****************************
2
3
- 返回参数
名称 | 类型 | 说明 | 示范值 | ||
code | number | 返回码 | 返回码;0表示成功,非0表示出错 | ||
success | Boolean | 错误信息 | 返回信息;true 表示成功,false 表示出错 | ||
data | array | 对象数组 | |||
wId | string | 对象的唯一标识 | "0007e43d-45d7-44c0-acfc-fc5539b6516a", | ||
poiId | string | POI编号 | "4403002230221018_9", | ||
name | string | 设备名称 | "蓝牙ibeacon", | ||
level | number | 对象所属层级 | 9, | ||
longitude | number | 经度 | 113.935327719, | ||
latitude | number | 纬度 | 22.522594372, | ||
height | number | 绝对高度 | 86.45, | ||
poiCode | string | 分类编码 | "w0907015", | ||
positionText | string | 位置描述 | "腾讯滨海大厦_滨海南塔_F18" |
- 返回示例
{
"code": 0,
"data": [
{
"wId": "56b0a141-82c6-4c4d-9cd5-a90fa0b2d5cf",
"poiId": "44030022302210190200295_9",
"name": "优图盒子",
"boothId": "南门_1903",
"level": 9,
"longitude": 65.77724999189377,
"latitude": 81.76209999900311,
"height": 87.8,
"poiCode": "w0713002",
"sn": "035BCC78358C4a7a",
"din": "144115192394173152",
"subId": "",
"cadFloor": "F19",
"positionText": "腾讯滨海大厦_滨海北塔_19F_西梯-南门_1903",
"innerHeight": 0
},
{
"wId": "765b56cf-284a-4c47-9f6b-d0705dd2b38e",
"poiId": "44030022302210360200096_9",
"name": "优图盒子",
"boothId": "北门_3601",
"level": 9,
"longitude": 72.47675005160272,
"latitude": 43.75605000089854,
"height": 165.5,
"poiCode": "w0713002",
"sn": "02FE1C4A6E1C4436",
"din": "144115192394050040",
"subId": "",
"cadFloor": "F36",
"positionText": "腾讯滨海大厦_滨海南塔_36F_西梯-北门_3601",
"innerHeight": 0
}
],
"success": true
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# 2.1.16. 列出建筑列表
- 功能描述
列出当前所在项目所有建筑 不含geojson地理信息
- 请求URL:
/space/geo/object/listBuildings
- 请求方式:
GET
- 请求参数
名称 | 类型 | 说明 | ||
---|---|---|---|---|
token | String | 是 | 非空且长度固定128个字符 | 动态密钥,有效期20分钟,需重新登录 |
project_id | String | 否 | 非空 | 项目编号 |
- 请求示例
/space/geo/object/listBuildings?
token=****************************
2
返回参数
返回示例
{
"code": 0,
"data": [
{
"address": "上海市上海市黄浦区淮海中路2-8号(淮海中路西藏南路)",
"level": 6,
"city": "",
"latitude": 31.225639999999995,
"buildingExtension": {},
"hasDevice": true,
"buildingId": "203d7d71-f339-4b4d-8842-29c16c0a3011",
"buildingSubtype": "279",
"province": "上海市",
"district": "",
"name": "兰生大厦",
"occupiedArea": 59273.23,
"poiId": "310000000000",
"buildingType": "272",
"longitude": 121.48038,
"height": 0
}
],
"success": true
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# 2.1.17. 获取建筑详情
- 功能描述
获取建筑楼层、分塔楼层、位置等具体信息
- 请求URL:
/space/geo/object/getBuildingInfo
- 请求方式:
GET
- 请求参数
名称 | 类型 | 说明 | ||
---|---|---|---|---|
buildingId | String | 是 | 建筑wid | |
token | String | 是 | 非空且长度固定128个字符 | 动态密钥,有效期20分钟,需重新登录 |
project_id | String | 否 | 非空 | 项目编号 |
- 请求示例
/space/geo/object/getBuildingInfo?
buildingId=203d7d71-f339-4b4d-8842-29c16c0a3011&
token=****************************
2
3
返回参数
返回示例
{
"code": 0,
"data": {
"floorList": [
{
"wId": "d52a295f-75eb-4215-830b-d6eb063a2ef3",
"buildingFloorWid": "415eb1b7-78fd-4e33-8560-4470442b51a8",
"floorHeight": 8.55,
"name": "F40",
"alias": "",
"poiId": "31000000000010401100001",
"floorIndex": 40,
"poiCode": "c0201001",
"baseRegion": "兰生大厦",
"linkRegionNames": [],
"extension": {}
},
{
"wId": "6dcbb10c-b0cd-48b9-bad2-a00f3dcd4acc",
"buildingFloorWid": "f5b5c541-fced-4803-8943-fc555ab08a9f",
"floorHeight": 3.47,
"name": "F39",
"alias": "",
"poiId": "31000000000010391100001",
"floorIndex": 39,
"poiCode": "c0201001",
"baseRegion": "兰生大厦",
"linkRegionNames": [],
"extension": {}
}
],
"address": "上海市上海市上海市黄浦区淮海中路2-8号(淮海中路西藏南路)",
"level": 6,
"latitude": 31.225639999999995,
"buildingFloorList": [
{
"wId": "415eb1b7-78fd-4e33-8560-4470442b51a8",
"floorHeight": 8.55,
"name": "F40",
"alias": "",
"poiId": "3100000000001040",
"floorIndex": 40,
"poiCode": "m99999000",
"linkRegionNames": [],
"extension": {}
},
{
"wId": "f5b5c541-fced-4803-8943-fc555ab08a9f",
"floorHeight": 3.47,
"name": "F39",
"alias": "",
"poiId": "3100000000001039",
"floorIndex": 39,
"poiCode": "m99999000",
"linkRegionNames": [],
"extension": {}
}
],
"buildingId": "203d7d71-f339-4b4d-8842-29c16c0a3011",
"buildingSubtype": "279",
"name": "兰生大厦",
"occupiedArea": 59273.23,
"poiId": "310000000000",
"buildingType": "272",
"height": 0,
"longitude": 121.48038
},
"success": true
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# 2.1.18. 获取建筑详情
- 功能描述
获取建筑楼层、分塔楼层、位置等具体信息
- 请求URL:
/space/geo/object/listRegions
- 请求方式:
GET
- 请求参数
名称 | 类型 | 说明 | ||
---|---|---|---|---|
poiCode | String | 是 | region key | |
buildingId | String | 是 | 建筑wid | |
token | String | 是 | 非空且长度固定128个字符 | 动态密钥,有效期20分钟,需重新登录 |
project_id | String | 否 | 非空 | 项目编号 |
- 请求示例
/space/geo/object/listRegions?
poiCode=c0201001&
buildingId=203d7d71-f339-4b4d-8842-29c16c0a3011&
token=****************************
2
3
4
返回参数
返回示例
{
"code": 0,
"data": {
"regions": [
{
"name": "兰生大厦"
}
]
},
"success": true
}
2
3
4
5
6
7
8
9
10
11
# 3. 微瓴动态数据服务及接口
# 3.1.设备影子
- 概念:是一个用于存储设备上报状态、应用程序期望状态信息的数据模型,每个设备有且只有一个设备影子
- 功能:物联网平台提供设备影子功能,用于缓存设备状态。当设备在线时,可以直接获取云端指令;当设备离线后,再次上线可以主动拉取云端指令
# 3.1.1. 获取设备影子数据
- 请求URL:
/space/shadow/getDeviceShadow
- 请求方式:
GET
- 请求头需要添加 x-welink-app-id:
值为应用的appId
- 请求参数
参数名称 | 数据类型 | 必填 | 描述 |
---|---|---|---|
wId | String | 是 | 对象的唯一标识,非空且长度固定36位 |
path | String | 否 | 查询的某个子属性,格式类似xxx,xxx,英文逗号分隔 |
flag | Boolean | 否 | 默认值为:true |
token | String | 是 | 动态密钥,有效期20分钟,需重新登录 |
project_id | String | 否 | 项目编号 |
- 请求示例
/space/shadow/getDeviceShadow
?flag=
&path=
&token=
&wId=a66348f2-0700-1000-abcd-35269c4636aa
2
3
4
5
- 返回参数
名称 | 类型 | 说明 | 示范值 | ||||
code | number | 返回码 | 返回码;0表示成功,非0表示出错 | ||||
success | Boolean | 错误信息 | 返回信息;true 表示成功,false 表示出错 | ||||
data | array | 对象数组 | |||||
metadata | array | 元数据,用来表征每个属性的更新时间 | |||||
desired | array | 设备预期状态信息 | |||||
SRS | array | 业务数据的属性名称 | |||||
timestamp | time | 时间 | |||||
reported | array | 设备上报状态名称 | |||||
SRS | array | 业务数据的属性名称 | |||||
timestamp | time | 时间 | |||||
state | array | 设备的状态信息 | |||||
desired | array | 设备预期状态的信息 | |||||
SRS | array | 业务数据的属性名称 | |||||
data | array | 以reported为基准取reported与desired的内容差集,desired多出的字段,值为null | 若reported为{"SRS": {"KK": "AAAA", "SS": 4326}},desired为{"SRS": 4326},则data为{"SRS": {"KK": "AAAA", "SS": 4326}} | ||||
SRS | array | 业务数据的属性名称 | |||||
KK | string | 业务数据的属性名称 | |||||
SS | number | 业务数据的属性名称 | |||||
reported | array | 设备上报状态信息 | |||||
SRS | array | 业务数据的属性名称 | |||||
KK | string | 业务数据的属性名称 | |||||
SS | number | 业务数据的属性名称 | |||||
version | string | 版本号 | |||||
timestamp | string | 时间 |
- 返回示例
{
"code": 0,
"data": {
"metadata": {
"desired": {
"SRS": {
"timestamp": 1564057658312
}
},
"reported": {
"SRS": {
"timestamp": 1564056186881
}
}
},
"state": {
"desired": {
"SRS": "4326"
},
"data": {
"SRS": {
"KK": "AAAA",
"SS": 4326
}
},
"reported": {
"SRS": {
"KK": "AAAA",
"SS": 4326
}
}
},
"version": "9",
"timestamp": "2019-07-25T05:28:01.517+0000"
},
"success": true
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# 3.1.2. 更新设备影子期望数据接口
- 请求URL:
/space/shadow/updateDesired
- 请求方式:
POST
- 请求参数
参数名 | 类型 | 必填 | 数据约束 | 描述 |
---|---|---|---|---|
token | String | 是 | 非空且长度固定128个字符 | 动态密钥,有效期20分钟,需重新登录 |
wId | String | 是 | 非空且长度固定36位 | 对象的唯一标识 |
din | String | 是 | 设备在微瓴的唯一标识 | |
version | String | 是 | 影子版本version | |
project_id | String | 否 | 非空 | 项目编号 |
- 请求示例
/space/shadow/updateDesired
?din=
&version=
&token=xxx_xxx
&wId=a66348f2-0700-1000-abcd-35269c4636aa
2
3
4
5
- 请求包体
格式: application/json
body: JSON Object
{"SRS": 4326, "MSG_ID": 100004529, "Order_ID": [0], "Robot_ID": "111111111111111113", "Robot_Pose": [0, 0], "Robot_EStop": 0, "Robot_Power": 0, "Robot_Bumper": 0, "Robot_Velocity": 0.00, "Robot_Temperature": 0.00}
- 返回参数
参数名 | 类型 | 必填 | 描述 |
---|---|---|---|
code | String | 是 | 返回码;0表示成功,非0表示出错 |
success | Boolean | 是 | 返回信息;true 表示成功,false 表示出错 |
- 返回示例
{
"code": 20029,
"success": true
}
2
3
4
# 3.2.业务历史数据
# 3.2.1. 获取设备原始历史数据(此接口将会在2021年3月16号下线,建议使用3.2.3接口获取原始数据)
- 请求URL:
/space/datahub/raw-data/getDeviceData
- 请求方式:
GET
注意:有权限控制,拉取对应的数据需要配置权限。
- 请求参数
参数名 | 类型 | 必填 | 描述 | 数据约束 |
---|---|---|---|---|
din | String | 是 | 设备在微瓴的唯一标识 | |
dp | String | 是 | 对应datapoint | |
beginRecordId | String | 否 | 起始记录id,可从返回结果中获取, beginRecordId第一次可以不填 | |
endRecordId | String | 否 | 终止记录id | |
limit | int | 否 | 拉取数量限制,最大500 | |
token | String | 是 | 鉴权token | |
beginTime | Long | 否 | 开始时间,毫秒时间戳 | |
endTime | Long | 否 | 结束时间,毫秒时间戳 | |
timeDesc | Boolean | 否 | true 从最近记录查询 false 从最早记录查询 | |
project_id | String | 否 | 项目编号 |
返回参数
名称 类型 说明 示范值 code number 返回码 返回码;0表示成功,非0表示出错 success Boolean 错误信息 返回信息;true 表示成功,false 表示出错 data array 对象数组 UinType string 设备标识类型,可是第三方ID体系 "DIN","UUID","WID"等都可以 DP string 上报方式 100005552 Year number 年 2019 Month number 月 12 DayInMonth number 当月的第几天 11 Hour string 小时 Minute number 分 5 Second number 秒 5 DayInWeek number 当周的第几天 2 record_id string 记录id "5c0f1b519aa3c470455af079" MsgTS number 时间戳 1544493905 Api string API类型 report data Point Uin String DIN物联设备唯一标识,可以是物联网关 DIN:"144115194553693415",
wId:"0007e43d-45d7-44c0-acfc-fc5539b6516a",Seq String value array 数组(父级别) 自定义消息体 status number 根据项目可变消息体 Robot_ID string Msg_ID number Lock_ID string longitude number latitude number height number 请求示例
/space/datahub/raw-data/getDeviceData
?din=
&dp=
&token=
&wId=a66348f2-0700-1000-abcd-35269c4636aa
2
3
4
5
- 返回示例
{
"code": 0,
"data": [
{
"UinType": "din",
"Hour": 10,
"DP": 100005552,
"DayInWeek": 2,
"Month": 12,
"record_id": "5c0f1b519aa3c470455af079",
"MsgTS": 1544493905,
"DayInMonth": 11,
"Minute": 5,
"Second": 5,
"Year": 2018,
"Api": "report_data_point",
"Uin": "144115194553693415",
"value": {
"Status": 1,
"Robot_ID": "144115194553693415",
"MSG_ID": 100005552,
"Lock_ID": "2"
},
"seq": "277"
}
],
"success": true
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# 3.2.2. 获取应用原始历史数据(此接口将会在2021年3月16号下线,建议使用3.2.3接口获取原始数据)
- 请求URL:
/space/datahub/raw-data/getAppData
- 请求方式:
GET
- 请求参数
参数名 | 类型 | 必填 | 描述 | **数据约束 ** |
---|---|---|---|---|
appId | Long | 是 | 要拉取的应用的appId | |
beginRecordId | String | 否 | 起始记录id,可从返回结果中获取beginRecordId第一次可以不填 | |
endRecordId | String | 否 | 终止记录id | |
limit | int | 否 | 拉取数量限制,最大500 | |
token | String | 是 | 动态密钥,有效期20分钟,需重新登录 | |
beginTime | Long | 是 | 开始时间,毫秒时间戳(开始和结束时间必须在同一个月) | |
endTime | Long | 是 | 结束时间,毫秒时间戳(开始和结束时间必须在同一个月) | |
timeDesc | Boolean | 否 | true 从最近记录查询 false 从最早记录查询 | |
project_id | String | 否 | 项目编号 |
- 返回参数
名称 | 类型 | 说明 | 示范值 | |
code | number | 返回码 | 返回码;0表示成功,非0表示出错 | |
success | Boolean | 错误信息 | 返回信息;true 表示成功,false 表示出错 | |
data | array | 对象数组 | ||
record_id | string | 记录id | "5c0f1b519aa3c470455af079" | |
message_type | string | 消息体类型 | 1000201 | |
to_appid | string | 到应用id | ||
msg_attribute | string | 消息属性 | ack | |
content | object | 内容字段 | 待补充,不用应用不同包体 |
- 请求示例
/space/datahub/raw-data/getAppData
?appId=40309
&beginRecordId=5cbfc05abf8e647ef1cb84bc
&limit=10
&token=
2
3
4
5
- 返回示例
{
"code": 0,
"data": [
{
"record_id": "5cc94b4e14fe80600897a522",
"message_type": "1000201",
"to_appid": "40191",
"msg_attribute": "ack",
"content": {
"ai_token": "token",
"device_id": "144115192401798329",
"ai_client_id": 1001,
"ai_cmd": 5,
"task_id": "62bf3279-2550-4d22-a020-34e72f9855c4",
"ai_type": 7,
"ai_version": "v1.0",
"ai_body": {
"start_time": {
"$numberLong": "1555904506687"
},
"similarity": 4,
"end_time": {
"$numberLong": "1555904516687"
},
"device_ids": [
"144115192401798329"
],
"time_interval": 600,
"person_id": "98242671-5F46-47E6-98AB-15A4A865475C",
"top_num": 50
},
"ex_info": "ARMTASK",
"client_id": "40338"
}
}
],
"success": true
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# 3.2.3. 原始数据文件获取接口
基于项目中不断提出的原始数据以文件形式进行下载和获取的需求,微瓴通过对原始数据进行改造的基础上,开发了基于对象模型数据的原始数据文件下载接口。由于该接口支持海量数据的查询,单次请求数据量大,所以该接口设计为异步接口,调用流程如下。
调用流程:
- 调用提交任务接口,查询参数为 自定义起止时间,对象模型id,以及文件格式(支持parquet,json,csv三种)
- 通过该接口的返回可以获得任务id
- 调用查询任务状态结果接口,使用任务id为参数
- 若返回state为1,则继续等待。若返回state为0,则通过返回的url下载文件。
# 3.2.3.1 提交任务接口
- 接口说明:该接口主要用于提交Extract任务。
- 接口地址:
/space/data-hub/common/v0.1/etl/extract/dataExtractOperation
- 请求方式:
GET
- 所属模块:数字空间 data-space 服务
- 请求参数:URL
参数名 | 类型 | 必填 | 数据约束 | 描述 |
---|---|---|---|---|
operation | int | 是 | 必须为1 | 1为提交任务操作标识 |
modelId | long | 是 | 不能为空 | 对象模型Id |
fileType | int | 否 | 指定[0,1,2] | 文件类型 [0 parquet.zip;1 json.zip; 2 csv.zip] |
startTime | long | 否 | 毫秒时间戳,默认当天0时刻 | 数据抽取起始时间 |
endTime | long | 否 | 毫秒时间戳,默认当前时间 | 数据抽取结束时间 |
备注: 1.抽取时间范围生效粒度为秒,余数毫秒级被舍弃,例 1606979072732(2020-12-03 15:04:32.732)将被约束置为(2020-12-03 15:04:32.000) 2.约束后抽取时间范围中,起始时间必须小于结束时间 3.文件类型json中的数据内容为json-raw(每行为一个json对象) 4.重复提交同一任务都会返回生成或指定的taskId。
示例:
# GET请求
https://apitest-cloud.welink.qq.com/space/data-hub/common/v0.1/etl/extract/dataExtractOperation?operation=1&modelId=1&fileType=1&token={token}
2
- 返回结果:
// 1. 添加任务成功
// response json body - "data" 对象结构
{
"desc": "task add success, please query by taskId",
"taskId": "6739476990857773057"
}
// 2. 任务已存在
// response json body - "data" 对象结构
{
"desc": "task already exist, please query by taskId",
"taskId": "6739476990857773057"
}
2
3
4
5
6
7
8
9
10
11
12
# 3.2.3.2 查询任务状态结果接口
- 接口说明:该接口主要用于通过指定taskId查询正在运行的Extract任务状态。
- 接口地址:
/space/data-hub/common/v0.1/etl/extract/dataExtractOperation
- 请求方式:
GET
- 所属模块:数字空间 data-space 服务
- 请求参数:URL
参数名 | 类型 | 必填 | 数据约束 | 描述 |
---|---|---|---|---|
operation | int | 是 | 必须为0 | 0为查询操作标识 |
taskId | String | 是 | 不能为空 | 任务Id |
例如:
GET请求·
https://apitest-cloud.welink.qq.com/space/data-hub/common/v0.1/etl/extract/dataExtractOperation?operation=0&taskId=123456789&token={token}
2
则转至ETL-extract服务的请求参数将为:
{
"appid":"40417",
"sign":"612c7b02bd69c5103d69b1ed66b4b94f",
"timestamp":1606978849136,
"info":{
"fields":[
{
"value":"0",
"key":"operation"
},
{
"value":"123456789",
"key":"taskId"
}
]
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
- 返回结果:
// 1. 正在处理
// response json body - "data" 对象结构
{
"taskId": "123456789", // 任务ID
"state": 1, // 任务状态处理中
"expTime": 0,
"url": "",
"fileName": "",
"desc": "the task in progress"
}
// 2. 处理完成
// response json body - "data" 对象结构
{
"taskId": "123456789", // 任务ID
"state": 0, // 任务状态处理完成
"expTime": 202011301532, // URL过期时间
"url": "https://bucket.cos.region.myqcloud.com/key", // 可用下载地址
"fileName": "1_1_20201124125020_20201125220150.json.zip" // 可用下载名称
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 3.3. 通用id对象管理接口
# 3.3.1 上报,更新,删除通用id对象信息
使用 Welink OpenApi 消息推送接口 /common/msg/report
进行上报
请求URL:/common/msg/report
请求方法:POST
请求参数:
请求参数 | 参数类型 | 是否必填 | 参数说明 |
---|---|---|---|
token | String | 是 | 登入鉴权获参数:登录微瓴鉴权接口获取的动态密钥(token) |
iotim_ticket | String | 是 | 应用接入微瓴时, 平台分配的鉴权参数:登录获取的物联票据 |
message_type | Integer | 是 | 消息类型,上报数字空间数据默认使用的 message_type 为 1000500 |
content | Object | 是 | 消息内容, 请参照微瓴对象模型通用id对象管理模数据格式进行上报 https://api.weiling.qq.com/doc/data_space/space_model.html#_4-0微瓴自有模块 |
- 请求示例
/common/msg/report
{
"message_type": 1000500,
"content":{
"reportTs":xxxxxxxxx,
"preperties":{},
"eventTs":{
"register":{
......
}
}
}
}
//a.请求头:Content-Type:application/json
//b.请求参数:"token": "********","iotim_ticket": "************"
//c.请求包体:{"message_type":1000100,"content":"test content"}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
- 返回参数
返回参数 | 参数类型 | 参数说明 |
---|---|---|
code | String | 错误码, 0表示请求成功, 非0则请求失败 |
message | String | 执行结果消息 |
data | Json | 操作结果 |
seq | String | 消息的seq |
- 返回示例
{
"code": 0,
"message": "OK",
"data": {
"seq": 5031740
}
}
2
3
4
5
6
7
# 3.3.2. 获取通用id对象信息
- 请求URL:
/space/datahub/common-object/getProfile
- 请求方式:
GET
注意:有权限控制,拉取对应的数据需要配置权限。
- 请求参数
参数名 | 类型 | 必填 | 描述 | 数据约束 |
---|---|---|---|---|
token | String | 是 | 非空且长度固定128个字符 | 动态密钥,有效期20分钟,需重新登录 |
paramType | int | 是 | 0:代表通过wId查询 1:代表通过poiCode及systemId查询 2:代表通过objectType和uniqueId查询 | 必须是0,1,2 |
wId | String | 否 | 通用id对象的微瓴id | 仅限于paramType为1时必填 |
poiCode | String | 否 | 通用id对象的所属系统类型编号 | 仅限于paramType为2时必填 |
systemId | String | 否 | 通用id对象在请求系统内部的自有id | 仅限于paramType为2时必填 |
objectType | String | 否 | 通用id对象的对象类型 | 仅限于paramType为3时必填 |
uniqueId | String | 否 | 通用id对象的自有唯一id | 仅限于paramType为3时必填 |
返回参数
名称 类型 说明 示范值 code number 返回码 返回码;0表示成功,非0表示出错 success Boolean 错误信息 返回信息;true 表示成功,false 表示出错 data object 对象数组 wId string 对象唯一标识,微瓴ID 38d5b0a-744d-4643-a7a6-cfc489875105c uniqueId string 上报方式 1205010005xxxxxxxxxxxx objectType number 对象类型 0 profile json 对象信息 {"name":"test","gender":0,"age":26} 请求示例(paramType为0时)
/space/datahub/common-object/getProfile
?token=
¶mType=0
&wId=a66348f2-0700-1000-abcd-35269c4636aa
2
3
4
- 请求示例(paramType为1时)
/space/datahub/common-object/getProfile
?token=
¶mType=1
&poiCode=xxxxx
&systemId=xxxxxxxxxxxxxxx
2
3
4
5
- 请求示例(paramType为2时)
/space/datahub/common-object/getProfile
?token=
¶mType=2
&objectType=0
&uniqueId=xxxxxxxxxxx
2
3
4
5
- 返回示例
{
"code": 0,
"data": [
{
"wId": "xxxxxxxxxxxxxxx",
"objectType": 0,
"uniqueId": "xxxxxxxxxxxxxxxxxx",
"profile": {
"gender": 1,
"name": "test",
"identify": 100005552,
"address": "xxxxxxxxx"
},
"seq": "277"
}
],
"success": true
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# 3.3.3. 生成通用id对象信息二维码字符串
- 请求URL:
/space/datahub/common-object/encryptionWId
- 请求方式:
GET
注意:有权限控制,拉取对应的数据需要配置权限。
- 请求参数
参数名 | 类型 | 必填 | 描述 | 数据约束 |
---|---|---|---|---|
token | String | 是 | 非空且长度固定128个字符 | 动态密钥,有效期20分钟,需重新登录 |
objectType | String | 是 | 通用id对象的对象类型 | |
uniqueId | String | 是 | 通用id对象的自有唯一id |
返回参数
名称 类型 说明 示范值 code number 返回码 返回码;0表示成功,非0表示出错 success Boolean 错误信息 返回信息;true 表示成功,false 表示出错 data object 对象 encryptionString string 对象微瓴id加密字符串 38d5b0a-744d-4643-a7a6-cfc489875105c 请求示例
/space/datahub/common-object/encryptionWId
?token=
&objectType=0
&uniqueId=xxxxxxxxxxx
2
3
4
- 返回示例
{
"code": 0,
"data":
{
"encryptionString": "xxxxxxxxxxxxxxx"
},
"success": true
}
2
3
4
5
6
7
8
# 3.3.4. 解密通用id对象信息二维码字符串
- 请求URL:
/space/datahub/common-object/decryptionWId
- 请求方式:
GET
注意:有权限控制,拉取对应的数据需要配置权限。
- 请求参数
参数名 | 类型 | 必填 | 描述 | 数据约束 |
---|---|---|---|---|
token | String | 是 | 非空且长度固定128个字符 | 动态密钥,有效期20分钟,需重新登录 |
encryptionString | String | 是 | 加密字符串 |
返回参数
名称 类型 说明 示范值 code number 返回码 返回码;0表示成功,非0表示出错 success Boolean 错误信息 返回信息;true 表示成功,false 表示出错 data object 对象 objectType string 对象类型 0 uniqueId string 对象自有唯一id xxxxxxxxxxxxx encryptionTime long 毫秒级加密时间戳 1589234568000 请求示例
/space/datahub/common-object/encryptionWId
?token=
&encryptionString=xxxxxxxxxxxxxxxxx
2
3
- 返回示例
{
"code": 0,
"data":
{
"objectType": 0,
"uniqueId": "xxxxxxxxxxxxxxxx",
"encryptionTime":1589234568000
},
"success": true
}
2
3
4
5
6
7
8
9
10
# 3.3.5. 获取通用id对象信息
- 请求URL:
/space/datahub/common-object/getProfileBatch
- 请求方式:
POST
注意:有权限控制,只能获取自己appid注册的通用ID信息
请求body
参数名 类型 必填 描述 数据约束 token String 是 非空且长度固定128个字符 动态密钥,有效期20分钟,需重新登录 返回参数
名称 类型 说明 示范值 code number 返回码 返回码;0表示成功,非0表示出错 success Boolean 错误信息 返回信息;true 表示成功,false 表示出错 data object 对象数组 wId string 对象唯一标识,微瓴ID 38d5b0a-744d-4643-a7a6-cfc489875105c uniqueId string 上报方式 1205010005xxxxxxxxxxxx objectType number 对象类型 0 profile json 对象信息 {"name":"test","gender":0,"age":26} 请求示例
/space/datahub/common-object/getProfileBatch
?token=
2
- 请求包体
格式:application/json body: JSON Object
["xxxxxxxxxx1","xxxxxxxxxx2","xxxxxxxxx3"] ##为uniqueId的list
- 返回示例
{
"code": 0,
"data": [
{
"wId": "xxxxxxxxxxxxxxx",
"objectType": 0,
"uniqueId": "xxxxxxxxxxxxxxxxxx",
"profile": {
"gender": 1,
"name": "test1",
"identify": 100005551,
"address": "xxxxxxxxx"
}
},
{
"wId": "xxxxxxxxxxxxxxx",
"objectType": 0,
"uniqueId": "xxxxxxxxxxxxxxxxxx",
"profile": {
"gender": 1,
"name": "test2",
"identify": 100005552,
"address": "xxxxxxxxx"
}
},
{
"wId": "xxxxxxxxxxxxxxx",
"objectType": 0,
"uniqueId": "xxxxxxxxxxxxxxxxxx",
"profile": {
"gender": 1,
"name": "test3",
"identify": 100005553,
"address": "xxxxxxxxx"
}
}
],
"success": true
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# 3.4.对象状态数据
# 3.4.1. 获取设备或者应用模块对象状态数据
请求URL:
/space/datahub/common/v1.0/current/getDeviceStatus
请求方式:
GET
请求参数
参数名 类型 必填 描述 数据约束 token String 是 动态密钥,有效期20分钟,需重新登录 非空且长度固定128个字符 buildId String 否 使用建筑poiid传参,若为空,则返回全部地理区域对应对象 无 floor String 否 使用楼层poiid传参,若为空,则返回全部楼层对应对象 无 poiCode String 否 对象类型分类编码 无 din String 否 设备在微瓴的唯一标识 无 wId String 否 对象唯一微瓴id 无 返回参数
名称 类型 说明 示范值 code number 返回码 返回码;0表示成功,非0表示出错 success Boolean 错误信息 返回信息;true 表示成功,false 表示出错 data object 对象数组 wId string 对象唯一标识,微瓴ID 38d5b0a-744d-4643-a7a6-cfc489875105c din string 设备在微瓴的唯一标识 120xxxxxxxx buildingId string 所属区域id 4205010000 floor string 所属楼层 F8 eventTs string 状态上报毫秒级时间戳 eventTime string 状态上报datetime "2020-10-22 00:00:00" poiCode string 对象类型分类编码 w0000000 productId string 对象厂商编号 sn string 对象资产编号 deviceStatus string 对象信息 0:正常;1:故障;2;离线 deviceType string 对象基本类型 content object 对象最后上报消息体
# 3.5. 获取统计聚合数据
# 3.5.1. 获取设备或者应用模块统计分析后数据
请求URL:
/space/datahub/common/v1.0/statistics/getAggregateData
请求方式:
GET
请求参数
参数 参数描述 是否必填 示例 备注 token 鉴权口令 是 20分钟需更新一次 poiCode 业务物模型编号 是 poi_code=t0608068 t0608068 aggType 聚合类型 是 aggType=count count,sum,average geoLevel 通用聚合级别 是 classifyLevel=7 6:楼栋级别
7:楼层级别
99:自定义区域interval 聚合时间维度 是 interval=5 以分钟为单位 geoTargetId 地理目标wid 否 geoTargetId=xxxxxxxxxx 若无则返回全部 geoTargetName 地理目标名称 否 geoTargetName=parkinglotA 若无则返回全部 businessType 业务分类 否 businessType=in 若无则返回全部业务类型 beginTime 起始时间 是 beginTime=1569491100 秒级时间戳 endTime 终止时间 是 endTime=1569493100 秒级时间戳 返回参数
字段 字段描述 示例 code 处理状态码,0:正常其它:异常, "code":0 message 错误信息,Code非0的时候,说明错误信息 data 数据对象数组,jsonArray "data":[{},{}] timestamp 聚合的时间节点(聚合结束毫秒级时间戳) "timestamp":1569491100000 time 聚合的时间节点(聚合结束datetime时间) "time":2019/9/26 17:45:00" businessType 某个通用的聚合参数(楼层,区域,地理层级) "classify":"F7" value 具体的业务聚合内容 "value":14 字段示例
"code": 0, "data": [{ "timestamp": "2019-09-26T17:45:00.000+0000", "time": 1545965848000, "geoTargetId": "xxxxxxxxxxxxxxxxx", "geoTargetName":"F17", "businessType":"invade", "value":20}, { "timestamp": "2019-09-26T17:45:00.000+0000", "time": 1545965848000, "geoTargetId": "xxxxxxxxxxxxxxxxx", "geoTargetName":"F17", "businessType":"retention", "value":14}], "success": true }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# 3.5.2. 获取设备或者应用模块统计分析后数据(v2.1)
请求URL:
/space/data-hub/common/v2.1/statistics/getAggregateData
请求方式:
GET
请求参数
参数名 类型 必填 数据约束 描述 indexId int 否 大于 0 指标 id aggCustomId string 否 不为空 自定义指标 id businessType string 否 长度不大于32 指定业务维度类型 geoLevel int 否 0、-1、[5, 9] 之间的整数 通用聚合维度、级别 geoTargetId string 否 支持最多100个id(英文逗号分隔),单个id长度不大于36 指定空间对象id,若无则返回全部 interval int 是 大于 0,具体见下面说明 聚合时间维度,单位分钟 beginTime long 否 大于 0 起始时间,单位秒 endTime long 否 大于 0 终止时间,单位秒,默认为当前时间 maxItem int 否 [1,100]之间的整数,默认100,特殊支持:interval 在1440时,可输入[1,400]之间的整数,默认100 最大聚合数量 备注说明
- interval 在 [1, 60) 之间的整数,也即 1 分钟到 1 小时之间的整分钟值;
- interval 在 [60, 1440) 之间的整数且为 60 的倍数,也即 1 小时到 1 天之间的整小时值;
- interval 在 [1440, ) 之间的整数且为 1440 的位数,也即按 N 天为间隔
- 时间间隔要求: interval * maxItem <= (endTime - beginTime),其中 maxItem 表示返回结果中时间维度的最大个数,建议是 100。
- 默认终止时间: endTime = Min(endTime, beginTime + maxItem * interval)
- 默认起始时间: beginTime = endTime - maxItem * interval
返回参数
字段 字段描述 示例 code 处理状态码,0:正常其它:异常, "code":0 message 错误信息,Code非0的时候,说明错误信息 data 数据对象数组,jsonArray "data":{"result":,"meta":} result 业务聚合结果 "result":{"businessType":{...}} -- businessType 业务类型聚合时间段及其指标值 "businessType":{"geoTargetId":{"time1":v1,"time2":v2,...}} meta 聚合结果补充描述 描述对象名称等信息 -- geo_names 空间对象的名称 若存在,则有对应的name信息 字段示例
"code": 0, "data": { "result": { "car_in": { "8402d17f-0eeb-4c92-bfea-32bb40e88a25": { "2020-05-17 22:01:00": 10, "2020-05-17 22:02:00": 12, "2020-05-17 22:03:00": 20, "2020-05-17 22:04:00": null, "2020-05-17 22:05:00": 1 }, "b405fda0-f8dc-45c4-adbe-e7a6a4eb8898": { "2020-05-17 22:01:00": 3, "2020-05-17 22:02:00": 15, "2020-05-17 22:03:00": 8, "2020-05-17 22:04:00": null, "2020-05-17 22:05:00": 1 } }, "car_out": { "8402d17f-0eeb-4c92-bfea-32bb40e88a25": { "2020-05-17 22:01:00": 12, "2020-05-17 22:02:00": 5, "2020-05-17 22:03:00": 6, "2020-05-17 22:04:00": null, "2020-05-17 22:05:00": 1 }, "b405fda0-f8dc-45c4-adbe-e7a6a4eb8898": { "2020-05-17 22:01:00": 7, "2020-05-17 22:02:00": 8, "2020-05-17 22:03:00": 3, "2020-05-17 22:04:00": null, "2020-05-17 22:05:00": 1 } } }, "meta": { "geo_names": { "8402d17f-0eeb-4c92-bfea-32bb40e88a25": "floor_7", "b405fda0-f8dc-45c4-adbe-e7a6a4eb8898": "滨海大厦" } } }, "message": "OK"
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# 3.6 对象模型管理接口
# 3.6.1 对象模型查询接口
- 接口说明:该接口主要用于管理平台或对外提供对象模型的查询操作。
- 请求url:
/space/objectmodel/getModel
- 请求方式:
GET
- 所属模块:数字空间 data-space 服务
- 请求参数:
参数名 | 类型 | 必填 | 数据约束 | 描述 |
---|---|---|---|---|
token | String | 是 | 非空长度固定128位 | 动态密钥,有效期20分钟,需重新登录 |
modelId | Long | 否 | 大于0 | 模型id |
customModelId | String | 否 | 不超过36字符 | 自定义ModelId,主要用于SAAS语义化调用 |
poiCode | String | 否 | 非空长度不超过32位 | 对象类型编码 |
productId | Long | 否 | 大于0 | 设备产品 id |
备注: 1.接口将默认使用token中指定的projectId为限制条件,通过modelId、customModelId、poiCode、productId中的参数条件顺序(必须含有一个参数条件;且若有多个参数以更前一个参数为指定条件,后者将不会生效),获取对应数据。 2.在项目下 modelId、poiCode、customModelId 三者都是唯一的。 3.通过 productId 查询将会以最新(modelId)最大值为准提供。 4.当项目下没有对应的自定义模型时,在相同查询条件下如果存在微瓴公共对象模型的话,接口会主动返回微瓴公共对象模型(标准对象模型)。
返回结果:
// response json body - "data" 对象结构
{
"projectId": 11111118, // projectID(微瓴公共对象模型projectId=0)
"id": 1010, // modelID
"name": "资产类型名称", // 对象类型编码的名称
"poiCode": "w0101001", // 对象类型编码
"customModelId": fire_warning, // 自定义模型id(语义化)
"detailedTypeCode": prod_170000101, // 检索字段(待定)
"model": "{这里是对象模型的具体内容}", // 模型配置内容
"description": "描述", // 模型配置描述
"created": "2020-08-01 12:00:00", // 创建时间
"groupName": "项目自定义对象模型" // 模型类型分为两类:微瓴公共对象模型、项目自定义对象模型
}
2
3
4
5
6
7
8
9
10
11
12
13
备注:
1.若没有对应的配置,则 data 为 null(反馈码 code 仍然为 0)
# 3.6.2 对象模型批量查询接口
接口说明:该接口主要用于管理平台或对外提供对象模型的批量查询操作,支持poiCode对应名称的检索等。
请求地址:
/space/objectmodel/getModelList
请求方式:
GET
所属模块:数字空间 data-space 服务
请求参数:
参数名 | 类型 | 必填 | 数据约束 | 描述 |
---|---|---|---|---|
token | String | 是 | 非空长度固定128位 | 动态密钥,有效期20分钟,需重新登录 |
poiCode | String | 否 | 非空长度不超过32位 | 对象类型编码 |
name | String | 否 | URLencode 编码参数 | 资产类型名称,查询过程将会默认去除前后空格 |
customModelId | String | 否 | 字符串 | 自定义对象模型ID |
match | String | 否 | 字符串 | 当match条件不为空时,将对poiCode、name、customModelId进行模糊查询,且这三个参数将失效(poiCode可置为w) |
withCustomized | Boolean | 否 | 默认为false | 是否返回除公共以外的项目下自定义模型对象配置,若为true,则会依据projectId进行额外查询 |
withModel | Boolean | 否 | 默认为false | 对象模型列表中的元素内容是否包含具体模型内容(若不需要具体内容,建议不传) |
page | int | 是 | 大于或等于 0 | 当前页码,0为首页 |
size | int | 是 | 大于 0 | 分页大小,整数[1,200] |
备注: 1.poiCode、name中至少有一个是必填参数,若需要查询全部,可将poiCode=w;且poiCode支持前缀模糊匹配,name支持模糊匹配,customModelId支持模糊匹配
查询示例: 1.GET /space/objectmodel/getModelList?poiCode=w&page=0&size=200&token={token} 2.GET /space/objectmodel/getModelList?poiCode=w&match=系统&page=0&size=200&token={token}
返回结果:
// response json body - "data" 对象结构
[
{
"projectId": 11111118, // projectID(微瓴公共对象模型projectId=0)
"id": 1010, // modelID
"name": "资产类型名称", // 对象类型编码的名称
"poiCode": "w0101001", // 对象类型编码
"customModelId": fire_warning, // 自定义模型id(语义化)
"detailedTypeCode": prod_170000101, // 检索字段(待定)
"model":1.0, // 模型配置内容
"description": 1.0, // 模型配置描述
"created": "2020-08-01 12:00:00", // 创建时间
"groupName": "项目自定义对象模型" // 模型类型分为两类:微瓴公共对象模型、项目自定义对象模型
}
]
2
3
4
5
6
7
8
9
10
11
12
13
14
15
备注:
1.若没有对应的配置,则 data 为 null(反馈码 code 仍然为 0)
# 3.7 数字空间告警接口
# 3.7.1. 获取告警列表
请求url:
/space/datahub/alarm/v0.1/getAlarmList
请求方法:
GET
请求参数:
参数名 | 参数类型 | 说明 | 是否必填 |
---|---|---|---|
token | String | 鉴权token | 是 |
type | String | 告警类型 | 否 |
status | String | 状态 processed unprocessed processing | 否 |
subType | String | 告警子类型 | 否 |
level | int | 告警级别 1-5 | 否 |
beginTime | String | 开始时间 yyyyMMddHHmmss | 否 |
endTime | String | 结束时间 yyyyMMddHHmmss | 否 |
id | String | 告警id | 否 |
appIds | String | 上报的appid列表,英文,分隔 | 否 |
imgFlag | boolean | 是否返回告警的图片信息 | 否 |
page | int | 页码,默认1 | 否 |
size | int | 每页数量,默认10 | 否 |
project_id | int | 项目ID | 否 |
executeId | String | 执行ID,可以支持关联告警消息的快速条件检索,格式:字母(自动转小写)、数字、 横杠“-”、点“.”、下划线“_”, 长度:36字符,若格式不对,将直接置空 | 否 |
- 请求示例:
https://apitest.welink.qq.com/space/datahub/alarm/v0.1/getAlarmList
?project_id=······
&token=·············
&subType=·············
2
3
4
- 返回参数:
参数名 | 参数类型 | 描述 |
---|---|---|
code | Int | 返回码 |
data | JsonObject | 返回数据 |
success | boolean | 是否成功 |
- 返回示例:
{
"code":0,
"data":{
"size":1,
"data":[
{
"image":{
"data":"abfa497c-a019-4fbc-8262-f8567236a0df",//图片fileID,使用应用api 11.2 cos接口下载
"type":3
},
"handler":{
"type": "", //处理方式:"url" (打开链接处理) , "other"(其他处理方式)
"data": "" //对应的url或者其他的处理方式
},//处理方式,
"execute_id":"",//执行ID
"level":3,//告警等级
"advice":"",//告警处理建议
"sub_type_cn":"安全帽检测",//事件子业务类型
"description":"",//事件描述
"type":"security_monitoring",//事件业务类型
"processor":[
{
"name":"李XX",
"id":"31937"
},
{
"name":"XXgui",
"id":"59758"
}
],//处理人信息
"process_time":"1637744103002",//处理时间
"process_description":"",//处理描述
"extend":{
},//拓展信息,上报的数据内容,放在这里
"wid":"025e3653-fecc-462f-8857-21e5138123116",
"sub_type":"safety_helmet",
"type_cn":"安防监控",
"process_extend":{
},
"id":"4933fda2-7519-49c2-b302-631a74324b68",
"time":"1637744102364",
"position":{
"innerHeight":0,
"level":9,
"latitude":22.5224714909961,
"din":"144115192498589396",
"building":"腾讯滨海大厦",
"position_text":"腾讯滨海大厦_F7_东走道_AFJK000",
"device_name":"F7_东走道_AFJK000",
"wId":"025e3653-fecc-462f-8857-21e5138123116",
"dt_name":"半球摄像头",
"cad_floor":"F7",
"area_info":"",
"poi_id":"4403002230221007_9",
"height":37.5,
"longitude":113.935214671757
},//设备位置信息
"repeatNum":0,
"app_id":41202,
"status":"processing"//处理状态
}
],
"count":96267,
"page":1
},
"success":true
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# 3.7.2. 处理告警记录
请求url:
/space/datahub/alarm/v0.1/changeStatus
请求方法:
POST
请求参数:
参数名 | 参数类型 | 说明 | 示例 | 是否必填 |
---|---|---|---|---|
uuid | String | 告警的uuid,返回的列表中的id | uuid=790453a6-9ca4-45bc-a814-59359f5b4715 | 是 |
status | String | 告警状态 processed unprocessed processing misreport shield | status=unprocessed | 是 |
processor | String | 告警处理人,可以为JSON字符串,处理人信息从微瓴平台获取 | processor=[{"val": "XXX@qq.com", "name": "XXX", "id": "31603"}] | 是 |
processTime | Long | 告警处理时间 | processTime=1594738943979 | 是 |
advice | String | 告警处理建议 | 否 | |
processDescription | String | 告警处理的描述信息 | 否 | |
processExtend | String | 告警处理的扩展信息,可以为JSON字符串 | 否 | |
token | String | 鉴权 | token=XXX | 是 |
注意:参数均放在URL里面,需要urlEncode。
- 请求示例:
https://apitest.welink.qq.com/space/datahub/alarm/v0.1/changeStatus
?uuid=790453a6-9ca4-45bc-a814-59359f5b4715
&processTime=1594738943979
&status=processed
&processor=[{"val": "XXX@qq.com", "name": "XXX", "id": "31603"}]
&token=
&processDescription=
&processExtend={}
2
3
4
5
6
7
8
- 返回参数:
参数名 | 参数类型 | 描述 |
---|---|---|
code | Int | 返回码 |
success | boolean | 是否成功 |
- 返回示例:
{
"code": 0,
"success": true
}
2
3
4
# 3.7.3. 根据类型级别状态统计告警信息
请求url:
/space/datahub/alarm/v0.1/getCountByTypeAndLevelAndStatus
请求方法:
GET
请求参数:
参数名 | 参数类型 | 说明 | 是否必填 |
---|---|---|---|
type | String | 告警类型 | 否 |
status | String | 状态 processed unprocessed processing misreport shield | 否 |
level | String | 告警级别 | 否 |
token | String | 鉴权token | 是 |
isAll | Boolean | 是否统计全量告警数据(包括被收敛的),默认false | 否 |
- 请求示例:
https://apitest.welink.qq.com/space/datahub/alarm/v0.1/getCountByTypeAndLevelAndStatus?token=
- 返回参数:
参数名 | 参数类型 | 描述 |
---|---|---|
code | Int | 返回码 |
data | JsonObject | 返回数据 |
success | boolean | 是否成功 |
- 返回示例:
{
"code": 0,
"data": {
"people_flow": { //告警类型
"77777": { //appid
"3": 1115, //"告警等级":告警数量
"5": 1103
}
},
"device": {
"40405": {
"4": 31
}
},
"security_monitoring": {
"30248": {
"1": 3
},
"66666": {
"2": 3
}
}
},
"success": true
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# 3.7.4. 根据告警类型状态起始时间统计告警信息
请求url:
/space/datahub/alarm/v0.1/getStatisticsData
请求方法:
GET
l请求参数:
参数名 | 参数类型 | 说明 | 是否必填 |
---|---|---|---|
type | String | 告警类型 | 否 |
status | String | 状态 processed unprocessed processing misreport shield | 否 |
beginTime | String | 开始时间yyyyMMddHHmmss | 否 |
endTime | String | 结束时间yyyyMMddHHmmss | 否 |
appIds | String | 告警上报的appid,英文,分隔 | 否 |
token | String | 鉴权token | 是 |
isAll | Boolean | 是否统计全量告警数据(包括收敛的告警)默认false | 否 |
- 请求示例:
https://apitest.welink.qq.com/space/datahub/alarm/v0.1/getStatisticsData?token=
- 返回参数:
参数名 | 参数类型 | 描述 |
---|---|---|
code | Int | 返回码 |
data | JsonObject | 返回数据 |
success | boolean | 是否成功 |
- 返回示例:
{
"code": 0,
"data": {
"count": 4
},
"success": true
}
2
3
4
5
6
7
# 3.7.5. 根据告警类型状态起始时间 按照时间间隔统计告警信息
请求url:
/space/datahub/alarm/v0.1/getStatisticsDataByStep
请求方法:
GET
请求参数:
参数名 | 参数类型 | 说明 | 是否必填 |
---|---|---|---|
type | String | 告警类型 | 否 |
status | String | 状态 processed unprocessed processing misreport shield | 否 |
beginTime | String | 开始时间yyyyMMddHH | 是 |
endTime | String | 结束时间yyyyMMddHH | 是 |
appIds | String | 告警上报的appid,英文,分隔 | 否 |
step | int | 时间间隔,默认3600s | 否 |
token | String | 鉴权token | 是 |
isAll | Boolean | 是否统计全量告警数据(包含收敛数据),默认false | 否 |
- 请求示例:
https://apitest.welink.qq.com/space/datahub/alarm/v0.1/getStatisticsDataByStep?
token=
&step=3600
&beginTime=2019041511
&&endTime=2019041523
2
3
4
5
- 返回参数:
参数名 | 参数类型 | 描述 |
---|---|---|
code | Int | 返回码 |
data | JsonObject | 返回数据 |
success | boolean | 是否成功 |
- 返回示例:
{
"code": 0,
"data": {
"2019041511": 23,
"2019041512": 24,
"2019041513": 23,
"2019041514": 24,
"2019041515": 24,
"2019041516": 24,
"2019041517": 24,
"2019041518": 24,
"2019041519": 22,
"2019041520": 24
},
"success": true
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# 3.7.6. 批量获取告警图片信息
请求url:
/space/datahub/alarm/v0.1/getImageByIds
请求方法:
POST
请求参数:
header: Content-Type: application/json
body: ArrayList 类似[“warningId1”,”warningId2”]
返回参数:
参数名 | 参数类型 | 描述 |
---|---|---|
code | Int | 返回码 |
data | JsonArray | 返回数据 |
success | boolean | 是否成功 |
- 返回示例:
{
"code": 0,
"data": [
{
"id": 23,
"image": {
"type": 3,
"data": "abccccccccc"
}
}
],
"success": true
}
2
3
4
5
6
7
8
9
10
11
12
13
# 3.7.7. 批量添加告警处理记录
请求url:
/space/datahub/alarm/v0.1/addProcessRecord
请求方法:
POST
请求参数:
header: Content-Type: application/json
body: JSONArray 例:
[ { "warningId": "3456", "dealTime": 1556708722342, "dealManager": "haiboliu", "dealType": "重启", "dealDesc": "重启修复", "appendixFileId": "abcdefg", "isValid": 0 }, { "warningId": "4589", "dealTime": 1556708722355, "dealManager": "haiboliu", "dealType": "重启", "dealDesc": "重启修复", "appendixFileId": "cdefeee", "isValid": 0 } ]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20返回示例:
参数名 | 参数类型 | 描述 |
---|---|---|
code | Int | 返回码 |
data | JsonArray | 返回数据 |
success | boolean | 是否成功 |
- 返回示例:
{
"code": 0,
"data": [
{
"id": 23,
"waringId": "3456"
}
],
"success": true
}
2
3
4
5
6
7
8
9
10
# 3.7.8. 根据wId和时间查询人流告警信息
请求url:
/space/datahub/alarm/v0.1/ getPeopleFlowList
请求方法:
GET
请求参数:
参数名 | 参数类型 | 说明 | 是否必填 |
---|---|---|---|
wId | String | 告警类型 | 否 |
beginTime | String | 开始时间yyyyMMddHHmmss | 否 |
endTime | String | 结束时间yyyyMMddHHmmss | 否 |
token | String | 鉴权token | 是 |
- 请求示例:
https://apitest.welink.qq.com/space/datahub/alarm/v0.1/getPeopleFlowList?token=
- 返回参数:
参数名 | 参数类型 | 描述 |
---|---|---|
code | Int | 返回码 |
data | JsonArray | 返回数据 |
success | boolean | 是否成功 |
- 返回示例:
{
"code": 0,
"data": [
{
"eventDatetime": "2019-05-13T11:18:04.000+0000""eventTs": 123"floor": "7F""threshold": 1"value": 2"wId": "123333"
}
],
"success": true
}
2
3
4
5
6
7
8
9
# 3.7.9. 根据告警id查询告警处理记录
请求url:
/space/datahub/alarm/v0.1/getProcessRecord
请求方法:
GET
请求参数:
参数名 | 参数类型 | 说明 | 是否必填 |
---|---|---|---|
warningId | String | 告警id,多个用,分隔 | 是 |
token | String | 鉴权token | 是 |
- 请求示例:
https://apitest.welink.qq.com/space/datahub/alarm/v0.1/getProcessRecord?
warningId=123,321
&token=
2
3
- 返回参数:
参数名 | 参数类型 | 描述 |
---|---|---|
code | Int | 返回码 |
data | JsonArray | 返回数据 |
success | boolean | 是否成功 |
- 返回示例:
{
"code": 0,
"data": [
{
"id": 1,
"alarmId": "12345",
"processor": "haiboliu",
"processTime": "2019-05-01T11:05:22.000+0000",
"processType": "重启",
"description": "重启修复",
"fileId": "abcdefg",
"isValid": 0,
"gmtCreate": "2019-05-06T09:28:40.000+0000",
"gmtModified": "2019-05-06T09:28:40.000+0000",
"rowStatus": 0
}
],
"success": true
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 3.7.10. 获取收敛的告警列表
请求url:
/space/datahub/alarm/v0.1/getConvergenceAlarmList
请求方法:
GET
请求参数:
参数名 | 参数类型 | 说明 | 是否必填 |
---|---|---|---|
token | String | 鉴权token | 是 |
id | String | 告警id | 是 |
page | int | 页码,默认1 | 否 |
size | int | 每页数量,默认10,最大100 | 否 |
- 请求示例:
https://apitest.welink.qq.com/space/datahub/alarm/v0.1/getConvergenceAlarmList?
id=123
&token=
&page=1
&size=10
2
3
4
5
- 返回参数:
参数名 | 参数类型 | 描述 |
---|---|---|
code | Int | 返回码 |
data | JsonObject | 返回数据 |
success | boolean | 是否成功 |
- 示例示例:
{
"code": 0,
"data": {
"size": 1,
"data": [
{
"handler": {
},
"sub_type": "online",
"level": 1,
"advice": "",
"description": "",
"id": "",
"time": "1552640930201",
"position": {
"wId": "b474ce98-04e2-4b5c-b9fd-abf3f7d8600d",
"level": 9,
"sub_id": "",
"din": "144115192382209921"
},
"type": "device",
"processor": {
},
"status": "processed"
}
],
"count": 5201,
"page": 1
},
"success": true
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# 3.7.11. 通用告警统计接口
# 3.7.11.1. 当前项目所含告警类型接口
功能描述:获取当前项目下所有告警类型
请求URL:
/space/datahub/alarm/v0.1/getCatalog
请求方式:
GET
请求参数:
参数名 | 类型 | 必填 | 数据约束 | 描述 |
---|---|---|---|---|
token | String | 是 | 非空且长度固定129个字符 | 动态密钥,有效期20分钟,需重新登录 |
请求示例:
https://domain/space/datahub/alarm/v0.1/getCatalog&token=
- 返回参数:
参数名 | 类型 | 描述 |
---|---|---|
code | String | 返回码;0表示成功,非0表示出错 |
data | String | 返回数据 |
success | Boolean | 返回信息;true 表示成功,false 表示出错 |
- 返回示例:
{
"code": 0,
"data": [{
"englishName": "security_monitoring",
"name": "安防监控"
}, {
"englishName": "fire_protecting",
"name": "消防"
}, {
"englishName": "work_order",
"name": "工单"
}],
"success": true
}
2
3
4
5
6
7
8
9
10
11
12
13
14
# 3.7.11.2. 当前项目所含告警子类型接口
功能描述:获取当前项目下指定告警类型下所含告警子类型
请求URL:
/space/datahub/alarm/v0.1/getSubCatalog
请求方式:
GET
请求参数:
参数名 | 类型 | 必填 | 数据约束 | 描述 |
---|---|---|---|---|
token | String | 是 | 非空且长度固定129个字符 | 动态密钥,有效期20分钟,需重新登录 |
type | String | 是 | 指定告警类型 |
请求示例:
https://domain/space/datahub/alarm/v0.1/getSubCatalog&type=work_order?token=
- 返回参数:
参数名 | 类型 | 描述 |
---|---|---|
code | String | 返回码;0表示成功,非0表示出错 |
data | String | 返回数据 |
success | Boolean | 返回信息;true 表示成功,false 表示出错 |
- 返回示例:
{
"code": 0,
"data": [{
"englishName": "order_report",
"name": "工单上报"
}, {
"englishName": "order_cancel",
"name": "工单取消"
}, {
"englishName": "order_response",
"name": "工单回复"
}],
"success": true
}
2
3
4
5
6
7
8
9
10
11
12
13
14
# 3.7.11.3. 告警数据统计计数接口
功能描述:获取当前项目下指定条件下所含告警的数量
请求URL:
/space/datahub/alarm/v0.1/getStatisticsData
请求方式:
GET
请求参数:
参数名 | 类型 | 必填 | 数据约束 | 描述 |
---|---|---|---|---|
token | String | 是 | 非空且长度固定128个字符 | 动态密钥,有效期20分钟,需重新登录 |
type | string | 否 | 指定告警类型 | |
status | string | 否 | 指定状态告警 | |
appIds | string | 否 | 指定appid | |
beginTime | string | 否 | 指定查询时间起始 | |
endTime | string | 否 | 指定查询时间终止 | |
level | integer | 否 | 指定级别 | |
subType | string | 否 | 指定告警子类型 |
- 请求示例:
https://domain/space/datahub/alarm/v0.1/getStatisticsData&type=work_order?token=
- 返回参数:
参数名 | 类型 | 描述 |
---|---|---|
code | String | 返回码;0表示成功,非0表示出错 |
data | String | 返回数据 |
success | Boolean | 返回信息;true 表示成功,false 表示出错 |
- 返回示例:
{
"code": 0,
"data": {
"count": 84573
},
"success": true
}
2
3
4
5
6
7
# 3.7.12. 告警状态统计接口
请求方式:GET
url:/space/datahub/alarm/v0.1/getStatisticsDataByTypeStatus
注:限制查询时间段间隔最长1天,遵循左闭右开
请求参数:
ID 描述 类型 备注 beginTime 开始时间 String 格式:yyyyMMHHddmmss,等价时间查询条件 >= beginTime endTime 结束时间 String 格式:yyyyMMHHddmmss,等价时间查询条件 < endTime 请求示例:
https://domian/space/datahub/alarm/v0.1/getStatisticsDataByTypeStatus?token=XXX&beginTime=20210924140000&endTime=20210924150000
1返回参数:
ID 描述 类型 描述 code 返回码 Num data 返回数组 Array count 统计数量 Num subType 子业务类型 String type 业务类型 String status 告警状态 String 返回示例:
{ "code":0, "data":[ { "count":24, "subType":"fire_alarm", "type":"fire_protecting", "status":"unprocessed" }, { "count":6, "subType":"fire_alarm", "type":"fire_protecting", "status":"processing" }, { "count":24, "subType":"retention", "type":"security_monitoring", "status":"unprocessed" }, { "count":6, "subType":"retention", "type":"security_monitoring", "status":"processing" } ], "success":true }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# 3.7.13. 当前项目所有告警类型
功能描述:获取当前项目下所有告警类型以及子类型(包括没有产生过的告警)
请求URL:
/space/datahub/alarm/v0.1/getAllCatalog
请求方式:
GET
请求参数:
参数名 | 类型 | 必填 | 数据约束 | 描述 |
---|---|---|---|---|
token | String | 是 | 非空且长度固定129个字符 | 动态密钥,有效期20分钟,需重新登录 |
请求示例:
https://domain/space/datahub/alarm/v0.1/getAllCatalog?token=
- 返回参数:
参数名 | 类型 | 描述 |
---|---|---|
code | String | 返回码;0表示成功,非0表示出错 |
data | String | 返回数据 |
success | Boolean | 返回信息;true 表示成功,false 表示出错 |
- 返回示例:
{
"code": 0,
"data": {
"device": {// 告警类型名称
"level": "1", // 告警类型层级,可能为1或2
"name": "设备", // 告警类型中文名称
"id": "7", // 告警类型id
"projectId": "0", // 所属项目id
"english_name": "device", // 告警类型英文名称
"parentId": "0" // 告警类型所属的父类型id,如果为0说明是一级告警类型。或者通过没有 "."也能判断
},
"device.fault": { // 通过device.开头可以判断该二级告警类型所属的一级告警类型为device,也可以通过parentId判断
"level": "2",
"name": "故障",
"id": "36",
"projectId": "0",
"english_name": "fault",
"parentId": "7"
}
},
"success": true
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# 3.8. 联动配置
# 3.8.1 联动管理-只允许操作应用所属项目下的
# 3.8.1.1 联动列表查询
- 请求url:
/space/ruleengine/rule/getList
- 请求方式:
GET
- 请求参数:
请求参数 | 参数类型 | 是否必填 | 参数说明 |
---|---|---|---|
type | String | 否 | 事件触发类型(app, device, timer) |
keyWords | String | 否 | 联动名称/联动ID |
pageSize | Int | 是 | 每页数量 |
pageNumber | Int | 是 | 页码 |
token | String | 是 | token |
- 请求示例:
/space/ruleengine/rule/getList?
type=
&keyWords=
&pageSize=1
&pageNumber=1
&token=
2
3
4
5
6
- 返回参数:
字段 | 参数类型 | 字段描述 | 示例 |
---|---|---|---|
pageSize | Int | 每页数据量 | "pageSize": 10 |
pageNumber | Int | 当前页码 | "pageNumber": 1 |
totalRow | Int | 列表总条数 | "totalRow": 2 |
totalPage | Int | 总页码 | "totalPage": 2 |
list | array | 数据列表 | |
id | Int | 联动名称联动id | "id": 88 |
name | String | 联动名称 | "name": "10202" |
event | array | 触发事件名称 | "event": ["事件名称01"] |
action | String | 执行动作名称 | "action": "deviceAssign1" |
effectivePeriod | String | 有效周期内容 | "effectivePeriod": "永久有效" |
status | Int | 状态(0:关,1:开) | "status": 0 |
beginDate | String | 起始时间 | "beginDate": "1000-01-01T00:00:00.000+0800" |
endDate | String | 结束时间 | "endDate": "1000-01-01T00:00:00.000+0800" |
validAll | Boolean | 有效周期 | "validAll": true |
- 返回示例:
{
"code": 0,
"data": {
"list": [
{
"beginDate": "1000-01-01T00:00:00.000+0800",
"effectivePeriod": "{\"Tuesday\":{\"startInclude\":\"0:00\",\"endExclude\":\"23:59\"},\"Thursday\":{\"startInclude\":\"0:00\",\"endExclude\":\"23:59\"}}",
"endDate": "1000-01-01T00:00:00.000+0800",
"name": "10202",
"action": "deviceAssign-1",
"id": 88,
"event": [
"事件",
"3231",
"1qazsw",
"事件名称01"
],
"validAll": false,
"status": 0
},
{
"beginDate": "1000-01-01T00:00:00.000+0800",
"effectivePeriod": "永久有效",
"endDate": "1000-01-01T00:00:00.000+0800",
"name": "33",
"action": "deviceAssign1",
"id": 83,
"event": [
"事件名称01"
],
"validAll": true,
"status": 0
}
],
"pageNumber": 1,
"pageSize": 10,
"totalPage": 2,
"totalRow": 2
},
"message": "ok"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# 3.8.1.2 删除联动
- 请求url:
/space/ruleengine/rule/deleteById
- 请求方式:
POST
- 请求参数:
请求参数 | 参数类型 | 是否必填 | 参数说明 |
---|---|---|---|
id | long | 是 | 联动ID |
token | String | 是 | token(带在url里面) |
- 请求示例:
/space/ruleengine/rule/deleteById?
id=
&token=
2
3
- 返回参数
字段 | 参数类型 | 字段描述 | 示例 |
---|---|---|---|
code | Int | 状态码 | "code": 0 |
success | Boolean | 是否成功 | "success": true |
- 返回示例:
{
"code": 0,
"success": true
}
2
3
4
# 3.8.1.3 修改联动状态
- 请求url:
/space/ruleengine/rule/updateStatusById
- 请求方式:
POST
- 请求参数:
请求参数 | 参数类型 | 是否必填 | 参数说明 |
---|---|---|---|
id | long | 是 | 联动id |
status | int | 是 | 1 为正常启用即状态开,0 为停用即状态关, -1 为删除 |
token | String | 是 | token(带在url里面) |
- 请求示例:
/space/ruleengine/rule/updateStatusById?token=
2
注:id和status为一个对象
{
id:xx,
status:1
}
2
3
4
- 返回参数:
字段 | 参数类型 | 字段描述 | 示例 |
---|---|---|---|
code | Int | 状态码 | "code": 0 |
success | Boolean | 是否成功 | "success": true |
- 返回示例:
{
"code": 0,
"success": true
}
2
3
4
5
# 3.8.1.4 联动测试
- 请求url:
/space/ruleengine/rule/test
- 请求方式:
POST
- 请求参数:
请求参数 | 参数类型 | 是否必填 | 参数说明 |
---|---|---|---|
id | long | 是 | 联动ID |
token | String | 是 | token(带在url里面) |
- 返回参数
字段 | 参数类型 | 字段描述 | 示例 |
---|---|---|---|
code | Int | 状态码 | "code": 0 |
success | Boolean | 是否成功 | "success": true |
- 返回示例:
{
"code": 0,
"success": true
}
2
3
4
# 3.8.1.5 添加联动
- 请求url:
/space/ruleengine/rule/add
- 请求方式:
POST
- 请求参数:
请求参数 | 参数类型 | 是否必填 | 参数说明 |
---|---|---|---|
name | String | 是 | 联动名称,长度20 |
description | String | 是 | 联动说明,长度50 |
eventId | long | 是 | 事件ID,多个事件以英文逗号分隔 |
actionId | long | 是 | 动作ID |
validAll | int | 是 | 生效类型,1-永久有效,0-固定时间段 |
validPeriod | Json | 是 | “全天有效”的时候为空,“固定时间段有效”显示对应的有效时间数组, 格式请严格按照周一到周日示例,否则联动不会生效 |
beginDate | String | 否 | validAll为固定时间段时不能为空,起始时间,格式yyyy-MM-dd |
endDate | String | 否 | validAll为固定时间段时不能为空,结束时间,格式yyyy-MM-dd |
token | String | 是 | token(带在url里面) |
- 请求示例(1)
{
"name": "testrulename",
"description": "testdescription",
"eventId": 145,
"actionId": 112,
"validAll": 0, //固定时间段
"validPeriod": "{ \"Monday\":{ \"startInclude\":\"0:00\", \"endExclude\":\"23:59\" }, \"Tuesday\":{ \"startInclude\":\"0:00\", \"endExclude\":\"23:59\"
}, \"Wednesday\":{ \"startInclude\":\"0:00\", \"endExclude\":\"23:59\" }, \"Thursday\":{ \"startInclude\":\"0:00\", \"endExclude\":\"23:59\"
}, \"Friday\":{ \"startInclude\":\"0:00\", \"endExclude\":\"23:59\" }, \"Saturday\":{ \"startInclude\":\"0:00\", \"endExclude\":\"23:59\"
}, \"Sunday\":{ \"startInclude\":\"0:00\", \"endExclude\":\"23:59\" }}",
"beginDate": "2020-08-31",
"endDate": "2020-09-09"
}
2
3
4
5
6
7
8
9
10
11
12
13
- 请求示例(2)
{
"name": "testrulename",
"description": "testdescription",
"eventId": 145,
"actionId": 112,
"validAll": 1, //永久有效
"validPeriod": "",
"beginDate": "",
"endDate": ""
}
2
3
4
5
6
7
8
9
10
- 返回参数:
字段 | 参数类型 | 字段描述 | 示例 |
---|---|---|---|
code | Int | 状态码 | "code": 0 |
success | Boolean | 是否成功 | "success": true |
id | Int | 联动ID | "id": 1 |
- 返回示例:
{
"code": 0,
"success": true,
"data": {
"id": 1
}
}
2
3
4
5
6
7
8
# 3.8.1.6 修改联动
- 请求url:
/space/ruleengine/rule/modify
- 请求方式:
POST
- 请求参数:
请求参数 | 参数类型 | 是否必填 | 参数说明 |
---|---|---|---|
id | long | 是 | 联动id |
name | String | 是 | 联动名称,长度20 |
description | String | 是 | 联动说明,长度50 |
eventId | long | 是 | 事件ID,多个事件以英文逗号分隔 |
actionId | long | 是 | 动作ID |
validAll | int | 是 | 生效类型,1-永久有效,0-固定事件段 |
validPeriod | Json | 是 | “全天有效”的时候为空,“固定时间段有效”显示对应的有效时间数组, 格式请严格按照周一到周日示例,否则联动不会生效 |
beginDate | String | 否 | validAll为固定时间段时不能为空,起始时间,格式yyyy-MM-dd |
endDate | String | 否 | validAll为固定时间段时不能为空,结束时间,格式yyyy-MM-dd |
token | String | 是 | token(带在url里面) |
- 请求示例(1)
{
"id": 113,
"name": "testrulename",
"description": "testdescription1111",
"eventId": 145,
"actionId": 112,
"validAll": 0, //固定时间段
"validPeriod": "{ \"Monday\":{ \"startInclude\":\"0:00\", \"endExclude\":\"23:59\" }, \"Tuesday\":{ \"startInclude\":\"0:00\", \"endExclude\":\"23:59\"
}, \"Wednesday\":{ \"startInclude\":\"0:00\", \"endExclude\":\"23:59\" }, \"Thursday\":{ \"startInclude\":\"0:00\", \"endExclude\":\"23:59\"
}, \"Friday\":{ \"startInclude\":\"0:00\", \"endExclude\":\"23:59\" }, \"Saturday\":{ \"startInclude\":\"0:00\", \"endExclude\":\"23:59\"
}, \"Sunday\":{ \"startInclude\":\"0:00\", \"endExclude\":\"23:59\" }}",
"beginDate": "2020-08-31",
"endDate": "2020-09-09"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
- 请求示例(2)
{
"id": 113,
"name": "testrulename",
"description": "testdescription1111",
"eventId": 145,
"actionId": 112,
"validAll": 1, //永久有效
"validPeriod": "",
"beginDate": "",
"endDate": ""
}
2
3
4
5
6
7
8
9
10
11
- 返回参数:
字段 | 参数类型 | 字段描述 | 示例 |
---|---|---|---|
code | Int | 状态码 | "code": 0 |
success | Boolean | 是否成功 | "success": true |
- 返回示例:
{
"code": 0,
"success": true
}
2
3
4
5
# 3.8.1.7 联动详情
- 请求url:
/space/ruleengine/rule/getById
- 请求方式:
GET
- 请求参数:
请求参数 | 参数类型 | 是否必填 | 参数说明 |
---|---|---|---|
id | long | 是 | 联动id |
token | String | 是 | token |
- 返回参数:
字段 | 参数类型 | 字段描述 | 示例 |
---|---|---|---|
id | Int | 联动id | "id": 113 |
name | String | 联动名称 | "name": "testactionname" |
description | String | 联动说明 | "description": "testdescription1111" |
validAll | Boolean | 生效周期类型(1:全天有效, 0:固定时间段) | "validAll": true |
validPeriod | String | 有效期,JSON字符串(全天有效时为空) | "validPeriod": "" |
beginDate | String | 起始时间 | "beginDate": "1000-01-01T00:00:00.000+0800" |
endDate | String | 结束时间 | "endDate": "1000-01-01T00:00:00.000+0800" |
status | Boolean | 启用状态,0-停用,1-启用 | "status": 0 |
eventObj | array | ||
id | Int | 事件id | "id": 145 |
name | String | 事件名称 | "name": "测试对象模型消息002" |
type | String | 事件触发类型名称 | "type": "app" |
condition | String | 触发条件 | "condition":"[]" |
actionObj | array | ||
actionId | Int | 动作id | "actionId": 156 |
actionName | String | 动作名称 | "actionName": "tee" |
actionType | String | 动作类型(app/推送消息至应用-携带空间设备:无,appWithNearbyDevices/推送至应用-携带空间设备:携带,device/推送消息至设备-指定设备,nearbyDevices/推送消息至设备-事件所在范围内的设备,toAlarm/转换为告警,toNotification/转换为通知) | "actionType": "device" |
actionExplain | String | 动作说明 | "actionExplain": "tet" |
applyDevice | String | 具体应用(appid)/具体设备(DIN/subID) | applyDevice": "200200000000001108,200200000000000336,200200000000001104" |
msgType | String | 消息类型(original/custom) | "msgType": "custom" |
actionContent | String | 消息内容 | "actionContent": "{"action":"open","device_id":"%%(value.device)","item":"%%(value.list[0])","item2":"%%(value.list[2])"}" |
createdTime | String | 创建时间 | "createdTime": "2020-08-24T17:45:57.000+0800" |
sinkConfig | String | 动作sinkConfig | "sinkConfig": "{"nearbySearch"{"objectPoiCode":"w0701003","deviceAssign":"deviceId"}}" |
- 返回示例:
{
"code": 0,
"data": {
"actionObj": {
"actionType": "device",
"msgType": "custom",
"actionContent": "{\"action\":\"open\",\"device_id\":\"%%(value.device)\",\"item\":\"%%(value.list[0])\",\"item2\":\"%%(value.list[2])\"}",
"actionExplain": "tet",
"actionId": 156,
"createdTime": "2020-08-24T17:45:57.000+0800",
"sinkConfig": "{\"nearbySearch\":{\"objectPoiCode\":\"w0701003\",\"deviceAssign\":\"deviceId\"}}",
"deviceAssign": "deviceId",
"applyDevice": "200200000000001108,200200000000000336,200200000000001104",
"actionName": "tee"
},
"beginDate": "1000-01-01T00:00:00.000+0800",
"endDate": "1000-01-01T00:00:00.000+0800",
"name": "testactionname",
"description": "testdescription1111",
"id": 113,
"validAll": true,
"validPeriod": "",
"eventObj": [
{
"condition": "[{\"type\":\"objmodel\",\"attr\":\"故障(Fault)\",\"oper\":\"=\",\"val\":\"1\",\"obj\":{\"id\":\"Fault\",\"name\":\"故障\",\"type\":\"enum\",\"modelName\":\"生活水泵\",\"modelId\":105,\"define\":{\"mapping\":{\"0\":\"无故障\",\"1\":\"有故障\"},\"type\":\"enum\"}}}]",
"name": "测试对象模型消息002",
"id": 145,
"type": "app"
}
],
"status": 0
},
"success": true
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# 3.8.2. 动作管理-只允许操作应用所属项目下的
# 3.8.2.1 动作列表查询
- 请求url:
/space/ruleengine/action/getList
- 请求方式:
GET
- 请求参数:
请求参数 | 参数类型 | 是否必填 | 参数说明 |
---|---|---|---|
actionType | String | 否 | 动作类型(app,device,toAlarm,toNotification) |
actionName | String | 否 | 动作名称/动作ID |
pageSize | int | 是 | 每页数量 |
pageNumber | int | 是 | 页码 |
token | String | 是 | token |
- 请求示例:
/ruleengine/action/getList?
pageNumber=
&pageSize=
&token=
2
3
4
- 返回参数:
字段 | 参数类型 | 字段描述 | 示例 |
---|---|---|---|
pageSize | Int | 每页数据量 | "pageSize": 10 |
pageNumber | Int | 当前页码 | "pageNumber": 1 |
totalRow | Int | 列表总条数 | "totalRow": 2 |
totalPage | Int | 总页码 | "totalPage": 1 |
list | array | ||
actionId | Int | 动作id | "actionId": 158 |
actionName | String | 动作名称 | "actionName": "rar" |
actionType | String | 动作类型 | "actionType": "device" |
actionExplain | String | 动作说明 | "actionExplain": "fee" |
msgType | String | 消息类型(original/custom) | "msgType": "origin" |
msgContent | String | 消息内容 | "msgContent": "" |
createdTime | String | 创建时间 | "createdTime": "2020-08-25T11:54:35.000+0800" |
datapoint | String | 功能码 | "datapoint": "112233" |
appid | Int | appid | "appid": 0 |
din | String | 设备在微瓴唯一标识 | "din": "200200000000001108,200200000000001104,200200000000000336" |
link | array | 联动规则名称 | "link": [] |
sinkConfig | String | 动作sinkConfig | "sinkConfig": "{"nearbySearch":{"objectPoiCode":"w0701003","deviceAssign":"deviceId"}}" |
- 返回示例:
{
"code": 0,
"data": {
"totalRow": 2,
"pageNumber": 1,
"totalPage": 1,
"pageSize": 10,
"list": [
{
"actionType": "device",
"datapoint": "112233",
"msgType": "origin",
"msgContent": "",
"actionExplain": "fee",
"appid": 0,
"din": "200200000000001108,200200000000001104,200200000000000336",
"link": [],
"actionId": 158,
"createdTime": "2020-08-25T11:54:35.000+0800",
"sinkConfig": "{\"nearbySearch\":{\"objectPoiCode\":\"w0701003\",\"deviceAssign\":\"deviceId\"}}",
"actionName": "rar"
},
{
"actionType": "app",
"datapoint": "",
"msgType": "origin",
"msgContent": "",
"actionExplain": "action_explain",
"appid": 100323,
"din": "",
"link": [],
"actionId": 157,
"createdTime": "2020-08-25T11:10:05.000+0800",
"sinkConfig": "{\"nearbySearch\":{\"objectPoiCode\":\"\",\"deviceAssign\":\"deviceType\"}}",
"actionName": "log_action"
}
]
},
"success": true
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# 3.8.2.2 添加动作
- 请求url:
/space/ruleengine/action/add
- 请求方式:
POST
- 请求参数:
请求参数 | 参数类型 | 是否必填 | 参数说明 |
---|---|---|---|
actionName | String | 是 | 动作名称,长度15 |
actionType | String | 是 | 动作类型-app(推送消息至应用)/appWithNearbyDevices(推送消息至应用,携带空间设备)/device(推送消息至设备)/nearbyDevices(推送消息至设备,携带空间设备)/toAlarm(转告警)/toNotification(转通知) |
actionExplain | String | 是 | 动作说明,长度50 |
appId | String | 是 | 应用id,actionType为app/appWithNearbyDevices时不能为空 |
deviceId | String | 否 | 设备id,actionType为device/nearbyDevices时不能为空,为空的话表示没有关联设备 |
dataPoint | String | 否 | dp,actionType类型为device/nearbyDevices时不能为空 |
msgType | String | 是 | 消息类型:origin/custom,当actionType为toAlarm/toNotification时,msgType填origin |
msgContent | String | 否 | 消息内容,msgType值为custom时,msgContent必填 |
token | String | 是 | token(带在url里面) |
sinkConfig | JSON | 是 | 数据下沉配置 |
sinkConfig里面参数 | 说明(字段没有特别说明的都为必填项) | ||
{ "nearbySearch": { "objectLevel": 9, "limit": "1", "objectPoiCode": "w0715000", "scopeLevel": "0", "deviceAssign": "deviceType", "scopeRadius": "12" } } | JSON | 是 | 推送消息至应用,携带空间设备 objectLevel 为要搜索的目标的层级固定填9,即设备层级 limit 为设备限定数量,0~200,默认20个 objectPoiCode 为设备类型编码 scopeLevel 为空间范围,0-同一项目,6-同一建筑,7-同一楼层,8-同一房间/位置区域 deviceAssign 为指定设备 deviceType-按设备类型,deviceId-指定设备 scopeRadius 为搜索半径,单位米,精确到小数点后2位,大于0 |
{ "nearbySearch": { "objectPoiCode": "", "deviceAssign": "deviceType" } } | JSON | 是 | 推送消息至应用,不携带空间设备 objectPoiCode 为设备类型编码 deviceAssign 为指定设备 deviceType-按设备类型,deviceId-指定设备 |
{ "nearbySearch": { "objectPoiCode": "", "deviceAssign": "deviceType" } } | 是 | 推送消息至设备,指定设备 objectPoiCode 为设备类型编码,为空表示全部 deviceAssign 为指定设备 deviceType-按设备类型,deviceId-指定设备 | |
{ "nearbySearch": { "objectLevel": 9, "limit": "11", "objectPoiCode": "", "scopeLevel": "6", "deviceAssign": "deviceType", "scopeRadius": "12" } } | JSON | 是 | 推送消息至设备,事件范围内所在设备 objectLevel 为要搜索的目标的层级固定填9,即设备层级 limit 为设备限定数量,0~200,默认20个 objectPoiCode 为设备类型编码 scopeLevel 为空间范围,0-同一项目,6-同一建筑,7-同一楼层,8-同一房间/位置区域 deviceAssign 为指定设备 deviceType-按设备类型,deviceId-指定设备 scopeRadius 为搜索半径,单位米,精确到小数点后2位,大于0 |
{ "toAlarmConfig": { "secondAlarmTypeName": "入侵检测", "secondAlarmType": "invade", "positionType": "origin", "advice": "test_advice", "firstAlarmTypeName": "安防监控", "description": test_description", "alarmLevel": "2", "position": "", "firstAlarmType": "security_monitoring" } } | JSON | 是 | 转换为告警 secondAlarmTypeName 为二级告警类型名称 secondAlarmType 为二级告警类型 positionType 为告警位置,origin-事件所在位置 custom-自定义位置 advice 为告警处理建议,可以为空 firstAlarmTypeName 为一级告警类型名称 description 为告警描述,可以为空 alarmLevel 为告警级别,1-提示,2-一般,3-紧急,4-严重,5-致命 position 为自定义位置 firstAlarmType 为一级告警类型 |
{ "toNotificationConfig": { "firstNotificationType": "device", "positionType": "origin", "secondNotificationTypeName": "设备", "secondNotificationType": "device", "description": "", "firstNotificationTypeName": "设备", "position": "" } } | JSON | 是 | 转换为通知 firstNotificationType 为一级通知类型 positionType 为告警位置,origin-事件所在位置 custom-自定义位置 firstNotificationTypeName 为一级通知类型名称 secondNotificationType 为二级通知类型 secondNotificationTypeName 为二级通知类型名称 description 为通知描述,可以为空 position 为自定义位置 |
- 请求示例:
{
"actionName": "testactionname",
"actionType": "app",
"actionExplain": "testdescription",
"appId": 145,
"deviceId": 112,
"dataPoint": 1,
"msgType": "origin",
"msgContent": "",
"sinkConfig": "{\"toAlarmConfig\":{\"secondAlarmTypeName\":\"火警\",\"secondAlarmType\":\"fire_alarm\",\"positionType\":\"custom\",\"advice\":\"4444444444\",\"firstAlarmTypeName\":\"消防\",\"description\":\"3333333333\",\"alarmLevel\":\"3\",\"position\":\"222222222222222\",\"firstAlarmType\":\"fire_protecting\"}}"
}
2
3
4
5
6
7
8
9
10
11
- 返回示例:
{
"code": 0,
"data": {
"id": 159
},
"success": true
}
2
3
4
5
6
7
# 3.8.2.3 删除动作
- 请求url:
/space/ruleengine/action/deleteById
- 请求方式:
POST
- 请求参数:
请求参数 | 参数类型 | 是否必填 | 参数说明 |
---|---|---|---|
id | long | 是 | 动作id |
token | String | 是 | token(带在url里面) |
- 请求示例:
{
"id": 159
}
2
3
- 返回示例:
{
"code": 0,
"success": true
}
2
3
4
# 3.8.2.4 修改动作
- 请求url:
/space/ruleengine/action/modify
- 请求方式:
POST
- 请求参数:
请求参数 | 参数类型 | 是否必填 | 参数说明 |
---|---|---|---|
id | long | 是 | 动作id |
actionName | String | 是 | 动作名称,长度15 |
actionType | String | 是 | 动作类型-app(推送消息至应用)/appWithNearbyDevices(推送消息至应用,携带空间设备)/device(推送消息至设备)/nearbyDevices(推送消息至设备,携带空间设备)/toAlarm(转告警)/toNotification(转通知) |
actionExplain | String | 是 | 动作说明,长度50 |
appId | String | 是 | 应用id,actionType为app/appWithNearbyDevices时不能为空 |
deviceId | String | 否 | 设备id,actionType为device/nearbyDevices时不能为空,为空的话表示没有关联设备 |
dataPoint | String | 否 | dp,actionType类型为device/nearbyDevices时不能为空 |
msgType | String | 是 | 消息类型:origin/custom,当actionType为toAlarm/toNotification时,msgType填origin |
msgContent | String | 否 | 消息内容,msgType值为custom时,msgContent必填 |
sinkConfig | JSON | 是 | 动作sinkConfig,参见添加动作接口sinkConfig字段 |
token | String | 是 | token(带在url里面) |
- 请求示例:
{
"id": 159,
"actionName": "testactionname",
"actionType": "app",
"actionExplain": "testdescription1",
"appId": 145,
"deviceId": 112,
"dataPoint": 1,
"msgType": "origin",
"msgContent": "",
"sinkConfig": "{\"toAlarmConfig\":{\"secondAlarmTypeName\":\"火警\",\"secondAlarmType\":\"fire_alarm\",\"positionType\":\"custom\",\"advice\":\"4444444444\",\"firstAlarmTypeName\":\"消防\",\"description\":\"3333333333\",\"alarmLevel\":\"3\",\"position\":\"222222222222222\",\"firstAlarmType\":\"fire_protecting\"}}"
}
2
3
4
5
6
7
8
9
10
11
12
- 返回示例:
{
"code": 0,
"success": true
}
2
3
4
# 3.8.2.5 动作详情信息
- 请求url:
/space/ruleengine/action/getById
- 请求方式:
GET
- 请求参数:
请求参数 | 参数类型 | 是否必填 | 参数说明 |
---|---|---|---|
id | long | 是 | 动作id |
token | String | 是 | token |
- 请求示例:
/space/ruleengine/action/getById?
token=
&id=
2
3
- 返回参数:
返回参数 | 参数类型 | 参数说明 |
---|---|---|
code | String | 错误码,0表示成功,其他见错误码 |
message | String | 执行结果消息 |
data | Json | 查询结果 |
actionId | Long | 动作Id |
actionName | String | 动作名称 |
actionType | String | 动作类型--app/device/toAlarm/toNotification |
actionExplain | String | 动作说明 |
appid | Long | appid |
deviceId | String | deviceId |
msgType | String | 消息类型:origin/custom |
link | Array | 与动作相关的联动名称列表 |
msgContent | String | 消息详情--如果msgType是origin则是空 |
sinkConfig | JSON | 动作sinkConfig |
datapoint | String | dp功能码 |
- 返回示例:
{
"code": 0,
"data": {
"actionType": "device",
"datapoint": "123123",
"msgType": "custom",
"msgContent": "{\"action\":\"open\",\"device_id\":\"%%(value.device)\",\"item\":\"%%(value.list[0])\",\"item2\":\"%%(value.list[2])\"}",
"actionExplain": "tet",
"appid": 0,
"link": [
"testactionname"
],
"actionId": 156,
"sinkConfig": "{\"nearbySearch\":{\"objectPoiCode\":\"w0701003\",\"deviceAssign\":\"deviceId\"}}",
"deviceId": "200200000000001108,200200000000000336,200200000000001104",
"actionName": "tee"
},
"success": true
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 3.8.2.6 获取项目下所有不同的动作名称
- 请求url:
/space/ruleengine/action/getNames
- 请求方式:
GET
- 请求参数:
请求参数 | 参数类型 | 是否必填 | 参数说明 |
---|---|---|---|
token | String | 是 | token(带在url里面) |
- 请求示例:
/space/ruleengine/action/getNames?
token=
2
- 返回参数
返回参数 | 参数类型 | 参数说明 |
---|---|---|
code | String | 错误码,0表示成功,其他见错误码 |
message | String | 执行结果消息 |
data | Json | 查询结果 |
list | jsonArray | 动作名称 |
totalRow | Integer | 动作名称总数 |
- 返回示例:
{
"code": 0,
"data": {
"list": [
"测试名称",
"测试",
"test"
],
"totalRow": 3
},
"message": "ok"
}
2
3
4
5
6
7
8
9
10
11
12
# 3.8.2.7 根据设备ID查询动作列表
- 请求url:
/space/ruleengine/action/getByDeviceID
- 请求方式:
GET
- 请求参数:
请求参数 | 参数类型 | 是否必填 | 参数说明 |
---|---|---|---|
deviceId | String | 是 | 设备id,逗号分隔,最多100个 |
token | String | 是 | token |
- 请求示例:
/space/ruleengine/action/getByDeviceID?
deviceId=
&token=
2
3
- 返回参数
返回参数 | 参数类型 | 参数说明 |
---|---|---|
list | jsonMap | key为deviceId,value为关联的action数组列表 |
actionId | Int | 动作id |
actionName | String | 动作名称 |
actionType | String | 动作类型(pushApply/pushDeivce) |
actionExplain | String | 动作说明 |
appid | String | 具体应用 |
deviceId | String | 设备id |
datapoint | Int | dp功能码 |
msgType | String | 消息类型(original/custom) |
msgContent | String | 消息内容 |
sinkConfig | String | 数据下沉对象配置 |
- 返回示例:
{
"code":0,
"message":"ok",
"data":{
"pageNumber":1,
"pageSize":10,
"totalPage":20,
"totalRow":200,
"list":{
"$deviceId1":[
{
"actionExplain":"123",
"actionId":123,
"actionName":"测试动作1",
"actionType":"pushApply",
"appid":"123456",
"datapoint":123,
"deviceId":"200200000000001108",
"msgContent":"12312313213131131311313",
"msgType":"custom",
"sinkConfig":"{\"nearbySearch\":{\"objectPoiCode\":\"w0701003\",\"deviceAssign\":\"deviceId\"}}"
}
],
"$deviceId2":[
{
"actionExplain":"123",
"actionId":123,
"actionName":"测试动作1",
"actionType":"pushApply",
"appid":"123456",
"datapoint":123,
"deviceId":"200200000000001108",
"msgContent":"12312313213131131311313",
"msgType":"custom",
"sinkConfig":"{\"nearbySearch\":{\"objectPoiCode\":\"w0701003\",\"deviceAssign\":\"deviceId\"}}"
}
]
}
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# 3.8.2.8 根据应用ID查询动作列表
- 请求url:
/space/ruleengine/action/getByAppID
- 请求方式:
GET
- 请求参数:
请求参数 | 参数类型 | 是否必填 | 参数说明 |
---|---|---|---|
appId | String | 是 | 应用id,逗号分隔,最多10个 |
token | String | 是 | token |
- 请求示例:
/space/ruleengine/action/getByAppID?
appId=
&token=
2
3
- 返回参数
返回参数 | 参数类型 | 参数说明 |
---|---|---|
list | jsonMap | key为deviceId,value为关联的action数组列表 |
actionId | Int | 动作id |
actionName | String | 动作名称 |
actionType | String | 动作类型(pushApply/pushDeivce) |
actionExplain | String | 动作说明 |
appid | String | 具体应用 |
deviceId | String | 设备id |
msgType | String | 消息类型(original/custom) |
msgContent | String | 消息内容 |
- 返回示例:
{
"code":0,
"message":"ok",
"data":{
"pageNumber":1,
"pageSize":10,
"totalPage":20,
"totalRow":200,
"list":{
"$appID1":[
{
"actionExplain":"123",
"actionId":123,
"actionName":"测试动作1",
"actionType":"app",
"appid":"123456",
"msgContent":"12312313213131131311313",
"msgType":"custom"
}
],
"$appID2":[
{
"actionExplain":"123",
"actionId":123,
"actionName":"测试动作1",
"actionType":"app",
"appid":"123456",
"msgContent":"12312313213131131311313",
"msgType":"custom"
}
]
}
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# 3.8.3.事件管理-只允许操作应用所属项目下的
# 3.8.3.1 事件列表查询
- 请求url:
/space/ruleengine/event/getList
- 请求方式:
GET
- 请求参数:
请求参数 | 参数类型 | 是否必填 | 参数说明 |
---|---|---|---|
type | String | 否 | 事件触发类型(app, device, timer) |
keyWords | String | 否 | 事件名称/事件id |
pageSize | Int | 是 | 每页数量 |
pageNumber | Int | 是 | 页码 |
token | String | 是 | token |
- 请求示例:
/space/ruleengine/event/getList?
type=
&keyWords=
&pageSize=
&pageNumber=
&token=
2
3
4
5
6
- 返回参数
返回参数 | 参数类型 | 参数说明 |
---|---|---|
pageSize | Int | 每页数据量 |
pageNumber | Int | 当前页码 |
totalRow | Int | 列表总条数 |
totalPage | Int | 总页码 |
list | array | |
id | Int | 事件id |
name | String | 事件名称 |
triggerType | String | 事件触发类型(app) |
triggerCondition | String | 触发条件 |
effectivePeriod | String | 有效期 |
link | array | 已关联联动名称 |
createdTime | String | 创建时间 |
poiCode | String | 设备或应用系统分类编号--当触发类型为deviceType返回 |
din | String | 设备的din--当触发类型为device的时候返回 |
- 返回示例:
{
"code": 0,
"data": {
"list": [
{
"triggerCondition": "[{\"type\":\"custom\",\"attr\":\"test\",\"oper\":\"=\",\"val\":\"23\",\"obj\":\"\"}]",
"name": "测试测试对象模型消息",
"link": [
"log——rule"
],
"createdTime": "2020-08-19T17:29:55.000+0800",
"id": 147,
"triggerType": "app",
"triggerTime": "",
"poiCode": ""
},
{
"triggerCondition": "[{\"type\":\"objmodel\",\"attr\":\"状态(Status)\",\"oper\":\">\",\"val\":\"1\",\"obj\":{\"id\":\"Status\",\"name\":\"状态\",\"type\":\"int\",\"modelName\":\"红外对射感烟探测器
\",\"modelId\":138,\"define\":{\"type\":\"int\"}}}]",
"name": "测试对象模型消息003",
"link": [
"测试对象模型事件联动001"
],
"createdTime": "2020-08-19T15:37:37.000+0800",
"id": 146,
"triggerType": "deviceType",
"triggerTime": "",
"poiCode": "w0701003"
}
"pageNumber": 1,
"pageSize": 10,
"totalPage": 1,
"totalRow": 2
},
"message": "ok"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# 3.8.3.2 添加事件
- 请求url:
/space/ruleengine/event/add
- 请求方式:
POST
- 请求参数:
请求参数 | 参数类型 | 是否必填 | 参数说明 |
---|---|---|---|
eventName | String | 是 | 事件名称,长度15 |
triggerType | String | 是 | 事件触发类型 timer/app/device |
eventExplain | String | 是 | 事件说明,长度50 |
triggerTime | String | 是 | 触发时间--对应触发类型为timer,注意:该参数为cron表达式,从分钟开始写起,后台会缺省补充秒那一位为0,否则会校验失败 |
msgContent | String | 是 | 触发消息内容--对应触发类型为app/device |
appId | Long | 否 | 上报应用appid--对应触发类型为app |
din | String | 是 | din--对应触发类型为device |
poiCode | String | 否 | 设备类型--对应触发类型为device |
token | String | 是 | token(带在url里面) |
msgContent(格式为JSON串) | 字段释义 |
---|---|
[{ "type": "custom", "attr":"content.properties.test_six", "oper":"<", "val":"23", obj": { "id": 9, "name": "test", "type": "double", "modelId": "3414", "modelName": "直流屏", "eventId": "12", "eventName": "事件名称", "define": "属性定义"} ] | type : custom - 自定义数据,objmodel - 标准对象模型数据 attr : 匹配属性,用来与上报消息格式字段匹配 oper : 判断符号,如>、<、>=等 val : 判断值 obj : 消息管理对象模型属性,当数据类型为标准对象模型数据时存在 { id : 属性id name : 属性名称 type : 属性类型 modelId : 属性所属对象模型编号 modelName : 属性所属对象模型名称 eventId : 属性所属对象模型事件编号,为空时属性直属于对象模型 eventName : 属性所属对象模型事件名称 define : "" 属性定义} |
请求示例:
- 定时器触发
{
"eventName": "testEventName",
"triggerType": "timer",
"eventExplain": "testexplain",
"appId": "10000",
"din": "",
"triggerTime": "0/1 * * * ?", //每分钟执行一次,后台会在cron前面补充0,即0 0/1 * * * ?
"msgContent": "[{\"attr\":\"123\",\"oper\":\"!=\",\"val\":\"12\"}]",
"poiCode": ""
}
2
3
4
5
6
7
8
9
10
- 应用触发 - 标准对象模型
{
"eventName": "testEventName",
"triggerType": "app",
"eventExplain": "testexplain",
"appId": "10000",
"din": "",
"triggerTime": "",
"msgContent": "[{\"type\":\"objmodel\",\"attr\":\"content.properties.test_six\",\"oper\":\"<\",\"val\":\"23\",\"obj\":{\"id\":\"test_six\",\"name\":\"test_six\",\"type\":\"double\",\"modelName\":\"直流屏\",\"modelId\":3414,\"define\":{\"unit\":\"33\",\"min\":1,\"max\":3,\"step\":1,\"type\":\"double\"}}}]",
"poiCode": ""
}
2
3
4
5
6
7
8
9
10
- 应用触发 - 自定义模型
{
"eventName": "testEventName",
"triggerType": "app",
"eventExplain": "testexplain",
"appId": "10000",
"din": "",
"triggerTime": "",
"msgContent": "[{\"attr\":\"123\",\"oper\":\"!=\",\"val\":\"12\"}]",
"poiCode": ""
}
2
3
4
5
6
7
8
9
10
- 设备触发 - 标准对象模型
{
"eventName": "testEventName",
"triggerType": "deviceType",
"eventExplain": "testexplain",
"appId": "10000",
"din": "",
"triggerTime": "",
"msgContent": "[{\"type\":\"objmodel\",\"attr\":\"properties.sad\",\"oper\":\"=\",\"val\":\"2\",\"obj\":{\"id\":\"sad\",\"name\":\"sda1\",\"type\":\"bool\",\"modelName\":\"高压配电设备-未分类\",\"modelId\":116,\"define\":{\"mapping\":{\"0\":\"1\",\"1\":\"2\",\"true\":\"2\",\"false\":\"1\"},\"type\":\"bool\"}}}]",
"poiCode": ""
}
2
3
4
5
6
7
8
9
10
- 设备触发 - 自定义模型
{
"eventName": "testEventName",
"triggerType": "deviceType",
"eventExplain": "testexplain",
"appId": "10000",
"din": "",
"triggerTime": "",
"msgContent": "[{\"attr\":\"123\",\"oper\":\"!=\",\"val\":\"12\"}]",
"poiCode": ""
}
2
3
4
5
6
7
8
9
10
返回参数:
返回参数 | 参数类型 | 参数说明 |
---|---|---|
code | String | 错误码,0表示成功,其他表示失败 |
data | Json | 执行结果消息 |
- 返回示例:
{
"code": 0,
"data": {
"id": 148
},
"success": true
}
2
3
4
5
6
7
# 3.8.3.3 删除事件
- 请求url:
/space/ruleengine/event/deleteById
- 请求方式:
POST
- 请求参数:
请求参数 | 参数类型 | 是否必填 | 参数说明 |
---|---|---|---|
id | long | 是 | 事件id |
token | String | 是 | token(带在url里面) |
- 请求示例:
{
"id": "148"
}
2
3
- 返回示例:
{
"code": 0,
"success": true
}
2
3
4
# 3.8.3.4 修改事件
- 请求url:
/space/ruleengine/event/modify
- 请求方式:
POST
- 请求参数:
请求参数 | 参数类型 | 是否必填 | 参数说明 |
---|---|---|---|
id | Int | 是 | 事件id |
eventName | String | 是 | 事件名称,长度15 |
triggerType | String | 是 | 事件触发类型 timer/app/device |
eventExplain | String | 是 | 事件说明,长度50 |
triggerTime | Long | 是 | 触发事件--对应触发类型为timer,注意:该参数为cron表达式,从分钟开始写起,后台会缺省补充秒那一位为0,否则会校验失败 |
msgContent | String | 是 | 触发消息内容--对应触发类型为app/device(参数格式可参考【3.2 添加事件】msgContent 字段说明) |
appId | Long | 否 | 上报应用appid--对应触发类型为app |
din | String | 是 | din--对应触发类型为device |
poiCode | String | 否 | 设备类型--对应触发类型为device |
token | String | 是 | token(带在url里面) |
- 请求示例:
{
"id":149,
"eventName": "testEventName",
"triggerType": "timer",
"eventExplain": "testexplain",
"appId": "10000",
"din": "",
"triggerTime": "0/1 * * * ?", //每分钟执行一次,后台会在cron前面补充0,即0 0/1 * * * ?
"msgContent": "[{\"attr\":\"123\",\"oper\":\"!=\",\"val\":\"12\"}]",
"poiCode": ""
}
2
3
4
5
6
7
8
9
10
11
- 返回示例:
{
"code": 0,
"success": true
}
2
3
4
# 3.8.3.5 事件详情信息
- 请求url:
/space/ruleengine/event/getById
- 请求方式:
GET
- 请求参数:
请求参数 | 参数类型 | 是否必填 | 参数说明 |
---|---|---|---|
id | long | 是 | 事件id |
token | String | 是 | token |
- 请求示例:
/space/ruleengine/event/getById?
id=
&token=
2
3
- 返回参数
返回参数 | 参数类型 | 参数说明 |
---|---|---|
code | String | 错误码,0表示成功,其他见错误码 |
success | boolean | 是否执行成功 |
data | Json | 查询结果 |
eventId | Long | 事件Id |
eventName | String | 事件名称 |
triggerType | String | 事件触发类型--app/timer/device |
eventExplain | String | 事件说明 |
appId | Long | 应用上报appid--timer时为空 |
din | String | 设备id--触发类型为device时不为空 |
msgContent | String | 触发消息--timer时为空 |
triggerTime | String | 触发事件--app时为空 |
link | Array(String) | 与事件相关的联动名称列表 |
createdTime | Date | 创建时间 |
poiCode | String | poicode |
- 返回示例:
{
"code": 0,
"data": {
"eventId": 149,
"msgContent": "[{\"attr\":\"123\",\"oper\":\"!=\",\"val\":\"12\"}]",
"appId": 10000,
"eventExplain": "testexplain",
"din": "",
"link": [
"testrule001"
],
"eventName": "testEventName",
"createdTime": "2020-08-25T19:40:48.000+0800",
"triggerType": "timer",
"triggerTime": "0 0/1 * * * ?",
"poiCode": ""
},
"success": true
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 3.8.3.6 获取项目下所有不同的事件名称
- 请求url:
/space/ruleengine/event/getNames
- 请求方式:
GET
- 请求参数:
请求参数 | 参数类型 | 是否必填 | 参数说明 |
---|---|---|---|
token | String | 是 | token |
- 请求示例:
/space/ruleengine/event/getNames?
token=
2
- 返回参数
返回参数 | 参数类型 | 参数说明 |
---|---|---|
code | String | 错误码,0表示成功,其他见错误码 |
message | String | 执行结果消息 |
data | Json | 查询结果 |
list | jsonArray(String) | 事件名称 |
totalRow | Integer | 事件名称总数 |
- 返回示例:
{
"code": 0,
"message": "ok",
"data": {
"list": ["事件名称", "事件", "test"],
"totalRow": 3
}
}
2
3
4
5
6
7
8
# 3.8.3.7 根据设备ID查询事件列表
- 请求url:
/space/ruleengine/event/getByDeviceID
- 请求方式:
GET
- 请求参数:
请求参数 | 参数类型 | 是否必填 | 参数说明 |
---|---|---|---|
deviceId | String | 是 | 设备id,逗号分隔,最多100个 |
token | String | 是 | token |
- 请求示例:
/space/ruleengine/event/getByDeviceID?
deviceId=
&token=
2
3
- 返回参数
返回参数 | 参数类型 | 参数说明 |
---|---|---|
data | jsonMap | key为deviceId,value为关联的event数组列表 |
id | Int | 事件id |
name | String | 事件名称 |
triggerType | String | 事件触发类型(device) |
triggerCondition | String | 触发条件 |
- 返回示例:
{
"code": 0,
"data": {
"200900000000006754": [
{
"triggerCondition": "[{\"type\":\"custom\",\"attr\":\"fgd\",\"oper\":\">\",\"val\":\"gw\",\"obj\":\"\"}]",
"name": "test01",
"id": 212,
"triggerType": "device"
}
],
"200900000000006751": [
{
"triggerCondition": "[{\"type\":\"objmodel\",\"attr\":\"sda1(sad)\",\"oper\":\"=\",\"val\":\"567\",\"obj\":{\"id\":\"sad\",\"name\":\"sda1\",\"type\":\"bool\",\"modelName\":\"高压配电设备-未分类
\",\"modelId\":116,\"define\":{\"mapping\":{\"0\":\"1\",\"1\":\"2\",\"true\":\"2\",\"false\":\"1\"},\"type\":\"bool\"}}}]",
"name": "test02",
"id": 214,
"triggerType": "device"
}
],
"200900000000006750": [
{
"triggerCondition": "[{\"type\":\"custom\",\"attr\":\"fgd\",\"oper\":\">\",\"val\":\"gw\",\"obj\":\"\"}]",
"name": "test03",
"id": 212,
"triggerType": "device"
}
]
},
"success": true
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# 3.8.3.8 根据应用ID查询事件列表
- 请求url:
/space/ruleengine/event/getByAppID
- 请求方式:
GET
- 请求参数:
请求参数 | 参数类型 | 是否必填 | 参数说明 |
---|---|---|---|
appId | String | 是 | 应用id,逗号分隔,最多100个 |
token | String | 是 | token |
- 请求示例:
/space/ruleengine/event/getByAppID?
appID=
2
- 返回参数
返回参数 | 参数类型 | 参数说明 |
---|---|---|
data | jsonMap | key为deviceId,value为关联的event数组列表 |
id | Int | 事件id |
name | String | 事件名称 |
triggerType | String | 事件触发类型(app) |
triggerCondition | String | 触发条件 |
- 返回示例:
{
"code": 0,
"data": {
"100483": [
{
"triggerCondition": "[{\"attr\":\"testlf\",\"oper\":\">\",\"val\":\"888\"}]",
"name": "应用上报触发事件01",
"id": 143,
"triggerType": "app"
},
{
"triggerCondition": "[{\"attr\":\"123\",\"oper\":\"!=\",\"val\":\"12\"}]",
"name": "testEventNamelf0907",
"id": 233,
"triggerType": "app"
}
],
"100399": [
{
"triggerCondition": "[{\"type\":\"custom\",\"attr\":\"1\",\"oper\":\">\",\"val\":\"1\",\"obj\":\"\"},{\"type\":\"custom\",\"attr\":\"1\",\"oper\":\">\",\"val\":\"1\",\"obj\":\"\"},
{\"type\":\"custom\",\"attr\":\"2\",\"oper\":\"=\",\"val\":\"1\",\"obj\":\"\"},{\"type\":\"custom\",\"attr\":\"4\",\"oper\":\">\",\"val\":\"4\",\"obj\":\"\"},
{\"type\":\"custom\",\"attr\":\"6\",\"oper\":\">\",\"val\":\"6\",\"obj\":\"\"},{\"type\":\"custom\",\"attr\":\"7\",\"oper\":\">=\",\"val\":\"45\",\"obj\":\"\"},
{\"type\":\"custom\",\"attr\":\"234\",\"oper\":\">\",\"val\":\"324\",\"obj\":\"\"},{\"type\":\"custom\",\"attr\":\"7654\",\"oper\":\">=\",\"val\":\"345\",\"obj\":\"\"},
{\"type\":\"custom\",\"attr\":\"215435\",\"oper\":\"<=\",\"val\":\"5431\",\"obj\":\"\"}]",
"name": "应用上报触发事件02",
"id": 218,
"triggerType": "app"
},
{
"triggerCondition": "[{\"type\":\"objmodel\",\"attr\":\"设备状态(Status)\",\"oper\":\">\",\"val\":\"1\",\"obj\":{\"id\":\"Status\",\"name\":\"设备状态\",\"type\":\"int\",\"modelName\":\"火灾自动报警及联动系统-未分
类\",\"modelId\":2118,\"define\":{\"type\":\"int\"}}},{\"type\":\"objmodel\",\"attr\":\"告警(device_fault)-时间戳(eventTs)\",\"oper\":\"<\",\"val\":\"1\",\"obj\":
{\"id\":\"eventTs\",\"name\":\"时间戳\",\"type\":\"long\",\"modelName\":\"火灾自动报警及联动系统-未分类\",\"modelId\":2118,\"eventName\":\"告警\",\"eventId\":\"device_fault\",\"define\":
{\"type\":\"long\"}}}]",
"name": "应用上报触发事件03",
"id": 219,
"triggerType": "app"
}
]
},
"success": true
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41