# 微瓴动态数据服务及接口

# 1.设备影子

  • 概念:是一个用于存储设备上报状态、应用程序期望状态信息的数据模型,每个设备有且只有一个设备影子
  • 功能:物联网平台提供设备影子功能,用于缓存设备状态。当设备在线时,可以直接获取云端指令;当设备离线后,再次上线可以主动拉取云端指令

# 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
1
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
}
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

# 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
1
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
}
1
2
3
4

# 2.业务历史数据

# 2.1. 获取设备原始历史数据(新项目已弃用)

  • 请求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
1
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
}
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

# 2.2. 获取应用原始历史数据(新项目已弃用)

  • 请求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=
1
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
}
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
45
46
47
48
49
50
51

# 2.3. 原始数据文件获取接口(新项目已弃用)

基于项目中不断提出的原始数据以文件形式进行下载和获取的需求,微瓴通过对原始数据进行改造的基础上,开发了基于对象模型数据的原始数据文件下载接口。由于该接口支持海量数据的查询,单次请求数据量大,所以该接口设计为异步接口,调用流程如下。

调用流程:

  1. 调用提交任务接口,查询参数为 自定义起止时间,对象模型id,以及文件格式(支持parquet,json,csv三种)
  2. 通过该接口的返回可以获得任务id
  3. 调用查询任务状态结果接口,使用任务id为参数
  4. 若返回state为1,则继续等待。若返回state为0,则通过返回的url下载文件。

# 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}
1
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"
}
1
2
3
4
5
6
7
8
9
10
11
12

# 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}
1
2

则转至ETL-extract服务的请求参数将为:

{
    "appid":"40417",
    "sign":"612c7b02bd69c5103d69b1ed66b4b94f",
    "timestamp":1606978849136,
    "info":{
        "fields":[
            {
                "value":"0",
                "key":"operation"
            },
            {
                "value":"123456789",
                "key":"taskId"
            }
        ]
    }
}
1
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"  // 可用下载名称
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

# 2.4.获取设备原始历史数据

  • 请求URL:/big-data/indicator/data/api/raw-data/getDeviceData
  • 请求方式:POST
  • 请求参数 注意:原始数据存储需要先跟客户确定好存储字段信息,然后物模型配置字段数据存入DB,不是所有数据都让存;原则是,量小量数据存这里;若数据量大,存储时间长,建议存hdfs,走离线任务拉取原始数据。
字段 类型 必填 字段描述
project_id Int 项目id
wid jsonarray
modelId Int 物模型id
beginRecordId Int 起始记录id,可从返回结果中获取, beginRecordId第一次可以不填
endRecordId Int 终止记录id
beginTime Int 开始时间,毫秒时间戳,不填或者填0则默认当天0时刻
endTime Int 结束时间,毫秒时间戳,不填或者填0则默认当前时间
timeDesc bool true 从最近记录查询 false 从最早记录查询,默认升序
columns jsonarray 查询的物模型字段,不填默认查询物模型所有字段
building string 设备的位置范围:建筑,poiID 1-12位
floor string 设备的位置范围:楼层,poiID 13-16位
area string 设备的位置范围:房间,poiID 17-21位
poiCode string 设备类型
pid string 产品类型
filterParam jsonArray 根据物模型字段具体值过滤
pageNumber int32 页码,不填或为0默认第一页
pageSize int32 每页拉取数量,最大1000,默认值为1000

filterParam内的字段:

字段 类型 必填 字段描述
field string 物模型字段名称
operator int 符号: 1: ">", 2: "<", 3: "=", 4: ">=", 5: "<=", 6: "!="
value string 物模型字段对应的具体值
备注1.:参数如果传入开始和结束id值作为查询条件,则查询范围为左开右闭区间;如果传入开始和结束时间作为查询条件,查询范围是左闭右闭区间.
2.抽取时间范围生效粒度为秒,余数毫秒级被舍弃,例 1606979072732(2020-12-03 15:04:32.732)将被约束置为(2020-12-03 15:04:32.000)
3.约束后抽取时间范围中,起始时间必须小于结束时间
4.查询条件wid优先级高于poiCode和pid;如果传了wid作为查询条件则会忽略poiCode和pid条件
  • 请求示例
{
    "wid": [
        "5396a3d0-93be-4bdd-9ee6-dc33ddbd00a71"
    ],
    "modelId": 202581,
    "limit": 10,
    "beginTime": 1663212265228,
    "endTime": 1663212266228,
    "timeDesc": true,
    "columns": ["poi_code"]
    "filterParam": [
        {
            "field": "register_data",
            "operator": 3,
            "value": "test"
        },
        {
            "field": "poi_code",
            "operator": 6,
            "value": "w0205003"
        }
    ],
    "poiCode":"w0205004",
    "pid":"tets"

}
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
  • 返回参数
字段 类型 字段描述
code Int 返回码
message String 错误信息
data JsonObject 内容数组
pageNumber int 页码
pageSize int 每页数量
totalPage int 总页数
totalRow int 总行数
list jsonArray 原始数据数组
api String API类型
record_id Int 记录id
Seq String 消息号
wid String
reportTs String 上报时间,毫秒时间戳
value jsonObject 物模型字段具体数据
  • 返回示例
{
    "code": 0,
    "message": "Success",
    "data": {
        "pageNumber": 1,
        "pageSize": 1000,
        "totalPage": 0,
        "totalRow": 0,
        "list": [
		 {
            "api": "report_data_point",
            "record_id": 1,
            "seq": "277",
            "wid": "testwid",
            "reportTs": "1660013192000",
            "value": {
                "poiCode": "poicode",
                "registerData": "registerData"
            }
        }]
    }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

# 2.5.获取应用原始历史数据

  • 请求URL:/big-data/indicator/data/api/raw-data/getAppData
  • 请求方式:POST
  • 请求参数 注意:原始数据存储需要先跟客户确定好存储字段信息,然后物模型配置字段数据存入DB,不是所有数据都让存;原则是,量小量数据存这里;若数据量大,存储时间长,建议存hdfs,走离线任务拉取原始数据。
字段 类型 必填 字段描述
project_id Int 项目id
appId Int 应用id
wid jsonArray
modelId Int 物模型id
beginRecordId Int 起始记录id,可从返回结果中获取, beginRecordId第一次可以不填
endRecordId Int 终止记录id
beginTime Int 开始时间,毫秒时间戳,不填或者填0则默认当天0时刻
endTime Int 结束时间,毫秒时间戳,不填或者填0则默认当前时间
timeDesc bool true 从最近记录查询 false 从最早记录查询,默认升序
columns jsonArray 查询的物模型字段,不填默认查询物模型所有字段
filterParam string 根据物模型字段具体值过滤
pageNumber int32 页码,不填或为0默认第一页
pageSize int32 每页拉取数量,最大1000,默认值为1000

filterParam内的字段:

字段 类型 必填 字段描述
field string 物模型字段名称
operator int 符号: 1: ">", 2: "<", 3: "=", 4: ">=", 5: "<=", 6: "!="
value string 物模型字段对应的具体值

备注:参数如果传入开始和结束id值作为查询条件,则查询范围为左开右闭区间;如果传入开始和结束时间作为查询条件,查询范围是左闭右闭区间2.抽取时间范围生效粒度为秒,余数毫秒级被舍弃,例 1606979072732(2020-12-03 15:04:32.732)将被约束置为(2020-12-03 15:04:32.000)3.约束后抽取时间范围中,起始时间必须小于结束时间

  • 返回参数
字段 类型 字段描述
code Int 返回码
message String 错误信息
data JsonObject 内容数组
pageNumber int 页码
pageSize int 每页数量
totalPage int 总页数
totalRow int 总行数
list jsonArray 原始数据数组
record_id Int 记录id
message_type Int 消息类型
reportTs String 上报时间,毫秒时间戳
wid String
content jsonObject 物模型字段具体数据
  • 返回示例
{
    "code": 0,
    "message": "Success",
    "data": {
        "pageNumber": 1,
        "pageSize": 1000,
        "totalPage": 0,
        "totalRow": 0,
        "list": [{
            "record_id": 1,
            "message_type": 1000500,
            "reportTs": "1660187687000",
            "wid": "testtetst",
			"app_id": 100761,
            "content": {
                "poiCode": "poicode",
                "registerData": "registerData"
            }
        }]
    }
}

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

# 3. 对象模型管理接口

# 3.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" 对象结构
{
"code": 0,
"message": "ok",
"data": {
"projectId": 0,		// projectID(微瓴公共对象模型projectId=0)
"id": 2053,		// modelID
"name": "人脸识别门禁",		// 对象类型编码的名称
"poiCode": "w0713001",		// 对象类型编码
"customModelId": "weiling_w0713001",		// 自定义模型id(语义化)
"customModelName": "",		//自定义模型名称
"detailedTypeCode": "",		// 检索字段(待定)
"model": "{\"profile\":{\"poiCode\":\"w0713001\"},\"services\":[{\"outputData\":[{\"mode\":\"rw\",\"define\":{\"mapping\":{\"0\":\"失败\",\"1\":\"成功\",\"true\":\"成功\",\"false\":\"失败\"},\"type\":\"bool\"},\"name\":\"ack返回结果\",\"id\":\"success\",\"required\":false,\"desc\":\"\",\"order\":1650786358463}],\"inputData\":[{\"mode\":\"rw\",\"define\":{\"mapping\":{\"0\":\"关\",\"1\":\"开\"},\"type\":\"enum\"},\"name\":\"开关状态\",\"id\":\"status\",\"required\":false,\"desc\":\"\",\"order\":1650786358463}],\"name\":\"开关门\",\"id\":\"control\",\"required\":false,\"callType\":\"async\",\"desc\":\"\",\"order\":1650786358463}],\"properties\":[{\"mode\":\"rw\",\"define\":{\"type\":\"string\"},\"name\":\"设备ID\",\"id\":\"device_id\",\"required\":false,\"desc\":\"\",\"order\":1650786184820},{\"mode\":\"rw\",\"define\":{\"mapping\":{\"0\":\"关\",\"1\":\"开\"},\"type\":\"enum\"},\"name\":\"开关状态\",\"id\":\"door_status\",\"required\":false,\"desc\":\"\",\"order\":1650786245572}],\"events\":[{\"name\":\"未知通过事件\",\"id\":\"pass\",\"type\":\"notify\",\"required\":false,\"properties\":[{\"mode\":\"rw\",\"define\":{\"type\":\"long\"},\"name\":\"时间戳\",\"id\":\"eventTs\",\"required\":false,\"desc\":\"\",\"order\":1625738909878},{\"mode\":\"rw\",\"define\":{\"mapping\":{\"0\":\"告警\",\"1\":\"通知\",\"2\":\"消警\"},\"type\":\"enum\"},\"name\":\"事件类型\",\"id\":\"eventType\",\"required\":false,\"desc\":\"\",\"order\":1625738909878},{\"mode\":\"rw\",\"define\":{\"min\":0,\"max\":1000,\"type\":\"string\"},\"name\":\"描述\",\"id\":\"describe\",\"required\":false,\"desc\":\"\",\"order\":1625738909878},{\"mode\":\"rw\",\"define\":{\"type\":\"int\"},\"name\":\"通过人数1\",\"id\":\"passNum\",\"required\":false,\"desc\":\"\",\"order\":1625738909878},{\"mode\":\"rw\",\"define\":{\"type\":\"int\"},\"name\":\"通过人数2\",\"id\":\"passPerson\",\"required\":false,\"desc\":\"\",\"order\":1625738909878},{\"mode\":\"rw\",\"define\":{\"min\":0,\"max\":1000,\"type\":\"string\"},\"name\":\"区域id\",\"id\":\"recognitionId\",\"required\":false,\"desc\":\"\",\"order\":1625738909878},{\"mode\":\"rw\",\"define\":{\"min\":0,\"max\":1000,\"type\":\"string\"},\"name\":\"人名\",\"id\":\"personName\",\"required\":false,\"desc\":\"\",\"order\":1625738909879}],\"desc\":\"\",\"order\":1625738909879},{\"name\":\"进场\",\"id\":\"in\",\"type\":\"notify\",\"required\":false,\"properties\":[{\"mode\":\"rw\",\"define\":{\"type\":\"long\"},\"name\":\"时间戳\",\"id\":\"eventTs\",\"required\":false,\"desc\":\"\",\"order\":1625739053989},{\"mode\":\"rw\",\"define\":{\"mapping\":{\"0\":\"告警\",\"1\":\"通知\",\"2\":\"消警\"},\"type\":\"enum\"},\"name\":\"事件类型\",\"id\":\"eventType\",\"required\":false,\"desc\":\"\",\"order\":1625739053990},{\"mode\":\"rw\",\"define\":{\"min\":0,\"max\":1000,\"type\":\"string\"},\"name\":\"描述\",\"id\":\"describe\",\"required\":false,\"desc\":\"\",\"order\":1625739053990},{\"mode\":\"rw\",\"define\":{\"type\":\"int\"},\"name\":\"通过人数1\",\"id\":\"passNum\",\"required\":false,\"desc\":\"\",\"order\":1625739053990},{\"mode\":\"rw\",\"define\":{\"type\":\"int\"},\"name\":\"通过人数2\",\"id\":\"passPerson\",\"required\":false,\"desc\":\"\",\"order\":1625739053990},{\"mode\":\"rw\",\"define\":{\"min\":0,\"max\":1000,\"type\":\"string\"},\"name\":\"区域id\",\"id\":\"recognitionId\",\"required\":false,\"desc\":\"\",\"order\":1625739053990},{\"mode\":\"rw\",\"define\":{\"min\":0,\"max\":1000,\"type\":\"string\"},\"name\":\"人名\",\"id\":\"personName\",\"required\":false,\"desc\":\"\",\"order\":1625739053990}],\"desc\":\"\",\"order\":1625739053990},{\"name\":\"出场\",\"id\":\"out\",\"type\":\"notify\",\"required\":false,\"properties\":[{\"mode\":\"rw\",\"define\":{\"type\":\"long\"},\"name\":\"时间戳\",\"id\":\"eventTs\",\"required\":false,\"desc\":\"\",\"order\":1625739186985},{\"mode\":\"rw\",\"define\":{\"mapping\":{\"0\":\"告警\",\"1\":\"通知\",\"2\":\"消警\"},\"type\":\"enum\"},\"name\":\"事件类型\",\"id\":\"eventType\",\"required\":false,\"desc\":\"\",\"order\":1625739186985},{\"mode\":\"rw\",\"define\":{\"min\":0,\"max\":1000,\"type\":\"string\"},\"name\":\"描述\",\"id\":\"describe\",\"required\":false,\"desc\":\"\",\"order\":1625739186985},{\"mode\":\"rw\",\"define\":{\"type\":\"int\"},\"name\":\"通过人数1\",\"id\":\"passNum\",\"required\":false,\"desc\":\"\",\"order\":1625739186985},{\"mode\":\"rw\",\"define\":{\"type\":\"int\"},\"name\":\"通过人数2\",\"id\":\"passPerson\",\"required\":false,\"desc\":\"\",\"order\":1625739186985},{\"mode\":\"rw\",\"define\":{\"min\":0,\"max\":1000,\"type\":\"string\"},\"name\":\"区域id\",\"id\":\"recognitionId\",\"required\":false,\"desc\":\"\",\"order\":1625739186985},{\"mode\":\"rw\",\"define\":{\"min\":0,\"max\":1000,\"type\":\"string\"},\"name\":\"人名\",\"id\":\"personName\",\"required\":false,\"desc\":\"\",\"order\":1625739186985}],\"desc\":\"\",\"order\":1625739186985}]}",		// 模型配置内容
"description": "",		//模型配置描述
"created": "2022-04-24 15:47:15",		//创建时间
"groupName": "微瓴公共对象模型"		// 模型类型分为两类:微瓴公共对象模型、项目自定义对象模型
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

备注:

1.若没有对应的配置,则 data 为 null(反馈码 code 仍然为 0)

2.对象模型规范 (opens new window)

# 3.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]
customModelName String 字符串 自定义模型名称

备注: 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" 对象结构
{
"code": 0,
"message": "ok",
"data": [
{
"projectId": 0,  // projectID(微瓴公共对象模型projectId=0)
"id": 116,  // modelID
"name": "高压配电设备-未分类",  // 对象类型编码的名称
"poiCode": "w0101000",  // 对象类型编码
"customModelId": "weiling_w0101000",  // 自定义模型id(语义化)
"customModelName": "高压配电设备-未分类",  //自定义模型名称
"detailedTypeCode": "",   // 检索字段(待定)
"model": "{\"profile\":{\"poiCode\":\"w0101000\"},\"services\":[{\"outputData\":[{\"mode\":\"rw\",\"define\":{\"min\":1,\"max\":2,\"step\":1,\"type\":\"long\"},\"name\":\"45\",\"id\":\"ret\",\"required\":false,\"desc\":\"\",\"order\":1593309647190}],\"inputData\":[{\"mode\":\"rw\",\"define\":{\"min\":1,\"max\":2,\"type\":\"string\"},\"name\":\"3234\",\"id\":\"ccdsfsdfd\",\"required\":false,\"desc\":\"\",\"order\":1593314654265}],\"name\":\"1\",\"id\":\"2\",\"required\":false,\"callType\":\"async\",\"desc\":\"\",\"order\":1593309647190},{\"outputData\":[{\"mode\":\"rw\",\"define\":{\"type\":\"int\"},\"name\":\"aaa\",\"id\":\"bbbbbb\",\"required\":false,\"desc\":\"\",\"order\":1593481514980}],\"inputData\":[{\"mode\":\"rw\",\"define\":{\"type\":\"int\"},\"name\":\"aaa\",\"id\":\"aaa\",\"required\":false,\"desc\":\"\",\"order\":1593336025149}],\"name\":\"测试服务\",\"id\":\"testrtrt\",\"required\":false,\"callType\":\"async\",\"desc\":\"\",\"order\":1593336025150}],\"properties\":[{\"mode\":\"rw\",\"define\":{\"mapping\":{\"0\":\"1\",\"1\":\"2\",\"true\":\"2\",\"false\":\"1\"},\"type\":\"bool\"},\"name\":\"sda\",\"id\":\"sad\",\"required\":false,\"desc\":\"sdsaasd\",\"order\":1592999013805}],\"events\":[]}",  // 模型配置内容
"description": "",  // 模型配置描述
"created": "2020-11-06 19:18:02",  // 创建时间
"groupName": "微瓴公共对象模型"   // 模型类型分为两类:微瓴公共对象模型、项目自定义对象模型
},
{
"projectId": 0,
"id": 119,
"name": "高压进线柜",
"poiCode": "w0101001",
"customModelId": "weiling_w0101001",
"customModelName": "高压进线柜",
"detailedTypeCode": "",
"model": "{\"profile\":{\"poiCode\":\"w0101001\"},\"services\":[],\"properties\":[{\"mode\":\"rw\",\"define\":{\"unit\":\"度\",\"min\":1,\"max\":1000,\"step\":1,\"type\":\"float\"},\"name\":\"用电量\",\"id\":\"energy_used\",\"required\":false,\"desc\":\"\",\"order\":1595471247627},{\"mode\":\"rw\",\"define\":{\"unit\":\"吨\",\"min\":1,\"max\":100,\"step\":1,\"type\":\"int\"},\"name\":\"用水量\",\"id\":\"water_consumption\",\"required\":false,\"desc\":\"\",\"order\":1595471376157}],\"events\":[]}",
"description": "",
"created": "2020-11-06 19:18:02",
"groupName": "微瓴公共对象模型"
}
]
}
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

备注:

1.若没有对应的配置,则 data 为 null(反馈码 code 仍然为 0)

2.对象模型规范 (opens new window)

# 4.对象状态数据

# 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 对象最后上报消息体

# 5. 获取统计聚合数据

# 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

# 5.2. 获取设备或者应用模块统计分析后数据(v2.1)

备注:v2.1聚合接口,从2022/08/15起暂停支持新入驻项目的聚合统计(推荐使用 v3.1版本接口)。此接口仅限支持(微瓴项目ID<=223)

  • 请求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 最大聚合数量
  • 备注说明

  1. interval 在 [1, 60) 之间的整数,也即 1 分钟到 1 小时之间的整分钟值;
  2. interval 在 [60, 1440) 之间的整数且为 60 的倍数,也即 1 小时到 1 天之间的整小时值;
  3. interval 在 [1440, ) 之间的整数且为 1440 的位数,也即按 N 天为间隔
  4. 时间间隔要求: interval * maxItem <= (endTime - beginTime),其中 maxItem 表示返回结果中时间维度的最大个数,建议是 100
  5. 默认终止时间: endTime = Min(endTime, beginTime + maxItem * interval)
  6. 默认起始时间: beginTime = endTime - maxItem * interval
  7. gap统计和其他时序指标有区别,gap统计返回的数据表示的是上一个时间段跟历史数据之间差值。举例:按天统计,26号0点的数据表示的是25号一整天的最大值跟之前历史最大值之间的差值。(即今天是25号,且有最大值产生,那么在26号0点就会有对应的数据)
  • 返回参数

    字段 字段描述 示例
    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

# 5.3.获取设备或者应用模块统计分析后数据(V3.1)

此接口是提供给前端或第三方应用使用的查看数据指标任务计算结果的接口 注:指标配置的业务维度/自定义位置维度需要谨慎选择合适的字段,建议上报的业务维度值/自定义维度值种类在10个以内

  • 请求URL:/big-data/indicator/data/api/getAggregateData
  • 请求方式:GET
  • 请求参数
参数名 类型 必填 数据约束 描述
indexId Int 大于 0 指标id
aggCustomId string 不为空 自定义指标id,indexId和aggCustomId必须传一个,不能同时为空
geoLevel int 0:项目(all);-1:自定位置(customGeoField); 6:楼栋(6); 7:楼层(7); 8: 房间(8);9:自定义指标ID;10:标准维度设备点 通用聚合维度、级别,需要填写配置的指标对应的聚合空间维度
geoTargetId string 支持最多100个id(英文逗号分隔),单个id长度不大于36 指定空间对象id,如果是项目all维度不需要传递,自定义id维度可以不传递,楼层楼栋wid维度则需要传递
interval int 大于 0,具体见下面说明 聚合时间维度,单位分钟
aggregateType string 自然月传month;自然年传year 统计维度自然月/年
businessType string 长度不大于32 指定业务维度类型
beginTime long 大于 0 起始时间,单位秒
endTime long 大于 0 终止时间,单位秒,默认为当前时间
maxItem int [1,100]之间的整数,特殊支持:interval 超过1440时,[1,400]之间的整数,默认值100;如果按自然月/自然年统计,默认值和最大值为3650(存10年数据) 最大聚合数量
  • 备注说明
  1. interval 在 [1, 60) 之间的整数,也即 1 分钟到 1 小时之间的整分钟值;
  2. interval 在 [60, 1440) 之间的整数且为 60 的倍数,也即 1 小时到 1 天之间的整小时值;
  3. interval 在 [1440, ) 之间的整数且为 1440 的倍数,也即按 N 天为间隔
  4. 时间间隔要求: interval * maxItem <= (endTime - beginTime),其中 maxItem 表示返回结果中时间维度的最大个数,建议是 100。
  5. 默认终止时间: endTime = Min(endTime, beginTime + maxItem * interval)
  6. 默认起始时间: beginTime = endTime - maxItem * interval

特殊支持:按自然月/自然年统计,指标需要创建为时序聚合统计,interval固定传递1440,beginTime和endTime需要填写开始月份/年份的第一天和结束月份/年份的最后一天,后台是根据开始时间和结束时间的范围来计算的。比如想要查询2022.1-2022.3 3个月的数据,beginTime传递2022.1.1 00:00:00的时间戳,endTime传2022.3.31 00:00:00的时间戳;

  • 返回参数
字段 字段描述 示例
code 处理状态码,0:正常其它:异常, "code":0
message 错误信息,Code非0的时候,说明错误信息
data 数据内容
result 业务聚合结果
-- businessType 业务类型聚合时间段及其指标值 如果没有上报业务维度数据则为init
meta 聚合结果补充描述 描述对象名称等信息
--geo_names 空间对象的名称 若存在,则有对应的name信息
range 统计时间范围
beginTime 统计开始时间
endTime 统计结束时间
Interval 统计时间间隔,单位毫秒
  • 字段示例
{
    "code": 0,
    "message": "Success",
    "data": {
        "result": {
            "init": {
                "ef5e9f40-a070-4bbd-8931-2f24f847ed50": {
                    "2022-06-14 21:00:00": 0,
                    "2022-06-14 22:00:00": 0,
                    "2022-06-14 23:00:00": 0,
                    "2022-06-15 00:00:00": 99.2727,
                    "2022-06-15 01:00:00": 0,
                    "2022-06-15 02:00:00": 0,
                    "2022-06-15 03:00:00": 0,
                    "2022-06-15 04:00:00": 0,
                    "2022-06-15 05:00:00": 0,
                    "2022-06-15 06:00:00": 0
					//如果是自然月 格式为"2021-01": 0,自然年 格式为"2021": 0
                }
            }
        },
        "meta": {
            "geo_names": {}
        },
        "range": {
            "beginTime": "2022-06-14 21:00:00",
            "endTime": "2022-06-15 06:59:59",
            "interval": "3600000"
        }
    }
}
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

# 6. 通用id对象管理接口

# 6.1. 上报,更新,删除通用id对象信息

使用 Welink OpenApi 消息推送接口 /common/msg/report进行上报

  • 请求URL:/common/msg/report

  • 请求方法:POST

  • 请求参数:

请求参数 参数类型 是否必填 参数说明
token String 登入鉴权获参数:登录微瓴鉴权接口获取的动态密钥(token)
iotim_ticket String 应用接入微瓴时, 平台分配的鉴权参数:登录获取的物联票据
message_type Integer 消息类型,上报数字空间数据默认使用的 message_type1000500
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"}
1
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
  }
}
1
2
3
4
5
6
7

# 6.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=
&paramType=0
&wId=a66348f2-0700-1000-abcd-35269c4636aa
1
2
3
4
  • 请求示例(paramType为1时)
/space/datahub/common-object/getProfile
?token=
&paramType=1
&poiCode=xxxxx
&systemId=xxxxxxxxxxxxxxx
1
2
3
4
5
  • 请求示例(paramType为2时)
/space/datahub/common-object/getProfile
?token=
&paramType=2
&objectType=0
&uniqueId=xxxxxxxxxxx
1
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
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

# 6.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
1
2
3
4
  • 返回示例
{
  "code": 0,
  "data": 
    {
      "encryptionString": "xxxxxxxxxxxxxxx"
      },
  "success": true
}
1
2
3
4
5
6
7
8

# 6.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
1
2
3
  • 返回示例
{
  "code": 0,
  "data": 
    {
      "objectType": 0,
      "uniqueId": "xxxxxxxxxxxxxxxx",
      "encryptionTime":1589234568000
      },
  "success": true
}
1
2
3
4
5
6
7
8
9
10

# 6.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=
1
2
  • 请求包体

格式:application/json body: JSON Object

["xxxxxxxxxx1","xxxxxxxxxx2","xxxxxxxxx3"] ##为uniqueId的list
1
  • 返回示例
{
  "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
}
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

#