IoT数据采集
注意事项
调用该接口使用Bearer token,Bearer token的含义是在请求的header中添加Authorization参数并且值是Bearer {access_token},注意Bearer和access_token之间有空格。
前提条件
1、请确保您已在平台上申请了租户,并在平台中创建了应用产品或其他产品;
2、请以租户管理员或开发者身份登录平台,在已创建好的应用产品或其他产品中点击开发设置,,可以看到token生成依赖的appId和appSecret;
3、按照获取access_token的文档说明,已了解access_token在业务中的作用;
域名说明
https://open.apps.paas.se-unicloud.com
1、推送设备信息
1.1 接口名
{domain}/api/kafka/sync_device
1.2 调用方式
调用方式使用POST,application/json方式
1.3 请求参数
参数名 |
类型 |
是否必填 |
含义 |
示例 |
domainId |
string |
是 |
应用所属租户的租户Id |
123 |
subDomainId |
string |
是 |
应用Id |
123 |
operate |
string |
是 |
操作 |
add,update,delete |
value |
array |
是 |
设备信息 |
[{}] |
value字段格式
参数名 |
类型 |
是否必填 |
含义 |
示例 |
count |
number |
是 |
设备数量 |
2 |
deviceStorage |
number |
否 |
设备占用存储空间(单位:G) |
2 |
deviceType |
string |
是 |
设备类型 |
SMBPQ1 |
stationCode |
string |
否 |
场站code |
STSDF1 |
province |
string |
是 |
省份 |
江苏省 |
projectCode |
string |
否 |
项目code |
fj |
json示例
{
"domainId":"zt4iu",
"subDomainId":"5fc4adbffdcd8c233b8ac4d7",
"operate":"add",
"value":[{
"count": 2,
"deviceStorage": 0,
"deviceType": "SMBPQ1",
"stationCode": "003",
"province": "江苏省",
"projectCode": "fj"
}]
}
1.4 返回示例
{
"code": 1, // 1为成功,其它为失败
"message": "success",
"data": {},
"error": ""
}
2、推送设备指标
2.1 接口名
{domain}/api/kafka/sync_stastic
2.2 调用方式
调用方式使用POST,application/json方式
2.3 请求参数
参数名 |
类型 |
是否必填 |
含义 |
示例 |
domainId |
string |
是 |
应用所属租户的租户Id |
123 |
subDomainId |
string |
是 |
应用Id |
123 |
common |
object |
是 |
通用指标 |
{} |
business |
object |
是 |
业务指标 |
{} |
common字段格式
参数名 |
类型 |
是否必填 |
含义 |
示例 |
manage_equipment |
number |
是 |
管理设备 |
10 |
internet_asset_value |
number |
是 |
互联网资产价值 |
10 |
low_of_the_month |
number |
是 |
当月流量 |
2 |
online_time_of_the_month |
number |
是 |
当月在线时长 |
348 |
collection_points |
number |
是 |
采集单数 |
109 |
the_amount_of_data |
number |
是 |
数据量 |
20 |
number_of_models |
number |
是 |
模型数 |
5 |
business字段格式(不同业务使用的指标参数不通,详情请看指标参数定义)
json示例
{
"domainId":"zt4iu",
"subDomainId":"5fc4adbffdcd8c233b8ac4d7",
"common":{
"manage_equipment": 1000, //管理设备,单位:台
"internet_asset_value": 2014, //互联网资产价值,单位:元
"low_of_the_month": 512, //当月流量,单位:G
"online_time_of_the_month": 49, //当月在线时长,单位:小时
"collection_points": 1102, //采集单数
"the_amount_of_data": 1024, //数据量,单位:G
"number_of_models": 20 // 模型数,单位:个
},
"business":{
"online_equipment": 100, //在线设备数
"offline_equipment": 11, //离线设备数
"cumulative_total_income": 7, // 累计总收益
...
}
}
2.4 返回示例
{
"code": 1, // 1为成功,其它为失败
"message": "success",
"data": {},
"error": ""
}