Java中关于http请求获取FlexManager某设备分组监控点
前言
上个专栏介绍了很多关于FlexManager设备云端数据的各种操作,相信大家都有看了。本专栏将就怎么使用设备云数据库的数据进行自主客户端APP开发的一些知识点做一下细致讲解。当然,自始至终,我只讲自己擅长的领域,只分享某一块自己真实应用的体验和经验。本篇讲解使用http请求获取FlexManager设备云平台上某设备监控点分组下的所有监控点。
提示:以下是本篇文章正文内容,下面案例可供参考
一、FBox 列表获取
1、接口功能
获取当前用户名下的某设备监控点分组下的所有数据监控点。
2、请求地址:
(二选一)
旧版:
URL:[apiBaseUrl]v2/box/{boxId}/dmongroup/{groupId}/dmon
新版:
URL:[Host Server]/api/v2/box/{boxId}/dmongroup/{groupId}/dmon
3、地址参数说明
参数名 | 数据类型 | 参数详情 |
---|---|---|
Host Server | string | 公有云地址为:https://fbox360.com |
boxId | Long | FBox列表获取接口中boxRegs下box下id |
groupId | string | 监控点分组Id |
4、请求方式
请求方式为GET。
请求Headers如下所示:
参数名 | 数据类型 | 参数详情 |
---|---|---|
Authorization | string | Bearer+ 空格+登录接口中获得的access_token |
请求的Body为NULL。
5、返回字段
返回查询的监控点集合JSON对象,单个对象属性如下:
分组单元JSON对象结构
字段名 | 类型 | 描述 |
---|---|---|
id | string | 监控点Id |
name | string | 监控点名称 |
devAlias | string | 设备驱动别名 |
station | int | PLC通讯站号 |
dataType | int | 数据类型,详情见附录二 |
regId | int | 寄存器Id,与ioWidth联合使用,确定唯一寄存器 |
ioWidth | int | 寄存器位宽,与regId联合使用,确定唯一寄存器 |
regName | string 寄存器名称,能确定唯一寄存器,与上面两参数任选其一 | |
addr | int | PLC主地址 |
subAddr | int | PLC子地址 |
addrBlk | int | PLCDB块地址 |
intDigits | int | 整数位(目前无效),对位类型、二进制、十六进制、字符串类型无效 |
fracDigits | int | 小数位 |
unit | string | 单位,仅对字类型有效 |
privilege | int | 读写模式2:只写模式,4:只读模式,6:读写模式 |
trafficSaving | boolean | 是否省流量模式,true:启用,false:不启用 |
deadValue | float | 死区值,数据再±deadValue范围内数据不推送 |
label | JSON对象 | 位类型时显示标签,属性ttext:值为1时显示的文本,ftext:值为0时显示的文本 |
memo | string | 备注信息 |
encoding | int | 编码格式,字符串类型使用0:无,非字符串类型使用,1:Unicode,2:Ascii |
stringByteOrder | int | 字符串字节序,编码为Ascii格式时有效0:倒序,1:正序 |
charCount | int | 字符串个数(仅字符串类型有效) |
deviceChanged | boolean | 设备是否被移除(只有在移除时出现该参数,为true)FBox的连接设备変更后会出现该参数 |
tstate | int | 离线任务标记,0:未执行,1:执行成功,2:执行失败,3:固件不支持 |
6、返回码
参数名 | 参数描述 |
---|---|
401 | accessToken过期 |
400 | 错误信息在HTTP Header里[X-FBox-Code],详细见附录三 |
404 | 接口不存在,请检查URL |
429 | 访问接口频率过快 |
二、通讯测试
1、ApiPost7调试
使用请求地址URL:[Host Server]/api/v2/box/{boxId}/dmongroup/{groupId}/dmon,加入Host Server、boxId和groupId后,最终请求地址为https://fbox360.com/api/v2/box/4969255108963659325/dmongroup/251623588356953582/dmon,如图所示:
然后请求Headers为Bearer+ 空格+登录接口中获得的access_token,如图所示:
access_token要去登录请求里边获取,前面一篇已经讲过了,如图所示来操作:
请求一波获取最新access_token,然后粘贴或者替换到分组下所有数据监控点请求中的Authorization,然后就可以执行请求了。
2、响应成功讲解
我们抽FlexManager其中的一个设备分组监控点来看效果,FlexManager设备分组如下:
响应成功后接口返回的这个设备输送运行参数监控点列表如下所示:
{
"id": "251608640135372207",
"grpId": "251623588356953582",
"grpName": "输送运行参数",
"name": "输送手动状态",
"intDigits": 4,
"fracDigits": 0,
"privilege": 4,
"trafficSaving": true,
"deadValue": 0,
"label": {
"ttext": "打开",
"ftext": "关闭"
},
"memo": "",
"encoding": 1,
"stringByteOrder": 0,
"charCount": 1,
"deviceChanged": false,
"tagChanged": false,
"firmwareSupport": true,
"executeOnEdge": false,
"valueTransform": {
"type": 0,
"maxValue": 0,
"minValue": 0,
"scaleMaxValue": 0,
"scaleMinValue": 0,
"gain": 1,
"offset": 0
},
"useAddrType": 0,
"addrTagUid": "0",
"tstate": 1,
"devAlias": "SIEMENS S7-200_Ne-3",
"station": 1,
"dataType": 0,
"regId": 10,
"ioWidth": 0,
"regName": "S.B",
"addr": 0,
"subAddr": 1,
"addrBlk": 65535,
"bitIndexEnabled": false,
"bitIndex": 0,
"addrDesc": "S.B 0.1"
},
{
"id": "251608640135372209",
"grpId": "251623588356953582",
"grpName": "输送运行参数",
"name": "输送自动状态",
"intDigits": 4,
"fracDigits": 0,
"privilege": 4,
"trafficSaving": true,
"deadValue": 0,
"label": {
"ttext": "打开",
"ftext": "关闭"
},
"memo": "",
"encoding": 1,
"stringByteOrder": 0,
"charCount": 1,
"deviceChanged": false,
"tagChanged": false,
"firmwareSupport": true,
"executeOnEdge": false,
"valueTransform": {
"type": 0,
"maxValue": 0,
"minValue": 0,
"scaleMaxValue": 0,
"scaleMinValue": 0,
"gain": 1,
"offset": 0
},
"useAddrType": 0,
"addrTagUid": "0",
"tstate": 1,
"devAlias": "SIEMENS S7-200_Ne-3",
"station": 1,
"dataType": 0,
"regId": 10,
"ioWidth": 0,
"regName": "S.B",
"addr": 0,
"subAddr": 2,
"addrBlk": 65535,
"bitIndexEnabled": false,
"bitIndex": 0,
"addrDesc": "S.B 0.2"
},
{
"id": "251622487291336316",
"grpId": "251623588356953582",
"grpName": "输送运行参数",
"name": "输送EDI水箱液位",
"intDigits": 4,
"fracDigits": 1,
"unit": "cm",
"privilege": 4,
"trafficSaving": true,
"deadValue": 0.1,
"label": {
"ttext": "1",
"ftext": "0"
},
"memo": "VD1096",
"encoding": 1,
"stringByteOrder": 0,
"charCount": 1,
"deviceChanged": false,
"tagChanged": false,
"firmwareSupport": true,
"executeOnEdge": false,
"valueTransform": {
"type": 0,
"maxValue": 0,
"minValue": 0,
"scaleMaxValue": 0,
"scaleMinValue": 0,
"gain": 0,
"offset": 0
},
"useAddrType": 0,
"addrTagUid": "0",
"tstate": 1,
"devAlias": "SIEMENS S7-200_Ne-3",
"station": 1,
"dataType": 16,
"regId": 5,
"ioWidth": 4,
"regName": "VD",
"addr": 1096,
"subAddr": 0,
"addrBlk": 65535,
"bitIndexEnabled": false,
"bitIndex": 0,
"addrDesc": "VD 1096"
},
{
"id": "256050870111706871",
"grpId": "251623588356953582",
"grpName": "输送运行参数",
"name": "混床前压力1",
"intDigits": 4,
"fracDigits": 2,
"unit": "MPa",
"privilege": 4,
"trafficSaving": true,
"deadValue": 0.01,
"label": {
"ttext": "1",
"ftext": "0"
},
"memo": "VD1100",
"encoding": 1,
"stringByteOrder": 0,
"charCount": 1,
"deviceChanged": false,
"tagChanged": false,
"firmwareSupport": true,
"executeOnEdge": false,
"valueTransform": {
"type": 0,
"maxValue": 0,
"minValue": 0,
"scaleMaxValue": 0,
"scaleMinValue": 0,
"gain": 0,
"offset": 0
},
"useAddrType": 0,
"addrTagUid": "0",
"tstate": 1,
"devAlias": "SIEMENS S7-200_Ne-3",
"station": 1,
"dataType": 16,
"regId": 5,
"ioWidth": 4,
"regName": "VD",
"addr": 1100,
"subAddr": 0,
"addrBlk": 65535,
"bitIndexEnabled": false,
"bitIndex": 0,
"addrDesc": "VD 1100"
},
{
"id": "256050892302720783",
"grpId": "251623588356953582",
"grpName": "输送运行参数",
"name": "超滤前压力1",
"intDigits": 4,
"fracDigits": 2,
"unit": "MPa",
"privilege": 4,
"trafficSaving": true,
"deadValue": 0.01,
"label": {
"ttext": "1",
"ftext": "0"
},
"memo": "VD1104",
"encoding": 1,
"stringByteOrder": 0,
"charCount": 1,
"deviceChanged": false,
"tagChanged": false,
"firmwareSupport": true,
"executeOnEdge": false,
"valueTransform": {
"type": 0,
"maxValue": 0,
"minValue": 0,
"scaleMaxValue": 0,
"scaleMinValue": 0,
"gain": 0,
"offset": 0
},
"useAddrType": 0,
"addrTagUid": "0",
"tstate": 1,
"devAlias": "SIEMENS S7-200_Ne-3",
"station": 1,
"dataType": 16,
"regId": 5,
"ioWidth": 4,
"regName": "VD",
"addr": 1104,
"subAddr": 0,
"addrBlk": 65535,
"bitIndexEnabled": false,
"bitIndex": 0,
"addrDesc": "VD 1104"
},
{
"id": "251702200437316933",
"grpId": "251623588356953582",
"grpName": "输送运行参数",
"name": "超滤后压力1",
"intDigits": 4,
"fracDigits": 2,
"unit": "MPa",
"privilege": 4,
"trafficSaving": true,
"deadValue": 0.01,
"label": {
"ttext": "1",
"ftext": "0"
},
"memo": "VD1108",
"encoding": 1,
"stringByteOrder": 0,
"charCount": 1,
"deviceChanged": false,
"tagChanged": false,
"firmwareSupport": true,
"executeOnEdge": false,
"valueTransform": {
"type": 0,
"maxValue": 0,
"minValue": 0,
"scaleMaxValue": 0,
"scaleMinValue": 0,
"gain": 0,
"offset": 0
},
"useAddrType": 0,
"addrTagUid": "0",
"tstate": 1,
"devAlias": "SIEMENS S7-200_Ne-3",
"station": 1,
"dataType": 16,
"regId": 5,
"ioWidth": 4,
"regName": "VD",
"addr": 1108,
"subAddr": 0,
"addrBlk": 65535,
"bitIndexEnabled": false,
"bitIndex": 0,
"addrDesc": "VD 1108"
},
{
"id": "251702241141988995",
"grpId": "251623588356953582",
"grpName": "输送运行参数",
"name": "混床前压力2",
"intDigits": 4,
"fracDigits": 2,
"unit": "MPa",
"privilege": 4,
"trafficSaving": true,
"deadValue": 0.01,
"label": {
"ttext": "1",
"ftext": "0"
},
"memo": "VD1116",
"encoding": 1,
"stringByteOrder": 0,
"charCount": 1,
"deviceChanged": false,
"tagChanged": false,
"firmwareSupport": true,
"executeOnEdge": false,
"valueTransform": {
"type": 0,
"maxValue": 0,
"minValue": 0,
"scaleMaxValue": 0,
"scaleMinValue": 0,
"gain": 0,
"offset": 0
},
"useAddrType": 0,
"addrTagUid": "0",
"tstate": 1,
"devAlias": "SIEMENS S7-200_Ne-3",
"station": 1,
"dataType": 16,
"regId": 5,
"ioWidth": 4,
"regName": "VD",
"addr": 1116,
"subAddr": 0,
"addrBlk": 65535,
"bitIndexEnabled": false,
"bitIndex": 0,
"addrDesc": "VD 1116"
},
{
"id": "251702256326418153",
"grpId": "251623588356953582",
"grpName": "输送运行参数",
"name": "超滤前压力2",
"intDigits": 4,
"fracDigits": 2,
"unit": "MPa",
"privilege": 4,
"trafficSaving": true,
"deadValue": 0.01,
"label": {
"ttext": "1",
"ftext": "0"
},
"memo": "VD1120",
"encoding": 1,
"stringByteOrder": 0,
"charCount": 1,
"deviceChanged": false,
"tagChanged": false,
"firmwareSupport": true,
"executeOnEdge": false,
"valueTransform": {
"type": 0,
"maxValue": 0,
"minValue": 0,
"scaleMaxValue": 0,
"scaleMinValue": 0,
"gain": 0,
"offset": 0
},
"useAddrType": 0,
"addrTagUid": "0",
"tstate": 1,
"devAlias": "SIEMENS S7-200_Ne-3",
"station": 1,
"dataType": 16,
"regId": 5,
"ioWidth": 4,
"regName": "VD",
"addr": 1120,
"subAddr": 0,
"addrBlk": 65535,
"bitIndexEnabled": false,
"bitIndex": 0,
"addrDesc": "VD 1120"
},
{
"id": "251702270205370103",
"grpId": "251623588356953582",
"grpName": "输送运行参数",
"name": "超滤后压力2",
"intDigits": 4,
"fracDigits": 2,
"unit": "MPa",
"privilege": 4,
"trafficSaving": true,
"deadValue": 0.01,
"label": {
"ttext": "1",
"ftext": "0"
},
"memo": "VD1124",
"encoding": 1,
"stringByteOrder": 0,
"charCount": 1,
"deviceChanged": false,
"tagChanged": false,
"firmwareSupport": true,
"executeOnEdge": false,
"valueTransform": {
"type": 0,
"maxValue": 0,
"minValue": 0,
"scaleMaxValue": 0,
"scaleMinValue": 0,
"gain": 0,
"offset": 0
},
"useAddrType": 0,
"addrTagUid": "0",
"tstate": 1,
"devAlias": "SIEMENS S7-200_Ne-3",
"station": 1,
"dataType": 16,
"regId": 5,
"ioWidth": 4,
"regName": "VD",
"addr": 1124,
"subAddr": 0,
"addrBlk": 65535,
"bitIndexEnabled": false,
"bitIndex": 0,
"addrDesc": "VD 1124"
},
{
"id": "251608640122789225",
"grpId": "251623588356953582",
"grpName": "输送运行参数",
"name": "回水电阻1",
"intDigits": 4,
"fracDigits": 2,
"unit": "MΩ.cm",
"privilege": 4,
"trafficSaving": true,
"deadValue": 0.01,
"label": {
"ttext": "1",
"ftext": "0"
},
"memo": "VD1080",
"encoding": 1,
"stringByteOrder": 0,
"charCount": 1,
"deviceChanged": false,
"tagChanged": false,
"firmwareSupport": true,
"executeOnEdge": false,
"valueTransform": {
"type": 0,
"maxValue": 0,
"minValue": 0,
"scaleMaxValue": 0,
"scaleMinValue": 0,
"gain": 0,
"offset": 0
},
"useAddrType": 0,
"addrTagUid": "0",
"tstate": 1,
"devAlias": "SIEMENS S7-200_Ne-3",
"station": 1,
"dataType": 16,
"regId": 5,
"ioWidth": 4,
"regName": "VD",
"addr": 1080,
"subAddr": 0,
"addrBlk": 65535,
"bitIndexEnabled": false,
"bitIndex": 0,
"addrDesc": "VD 1080"
},
{
"id": "251622955687091526",
"grpId": "251623588356953582",
"grpName": "输送运行参数",
"name": "回水电阻2",
"intDigits": 4,
"fracDigits": 2,
"unit": "MΩ.cm",
"privilege": 4,
"trafficSaving": true,
"deadValue": 0.01,
"label": {
"ttext": "1",
"ftext": "0"
},
"memo": "VD1084",
"encoding": 1,
"stringByteOrder": 0,
"charCount": 1,
"deviceChanged": false,
"tagChanged": false,
"firmwareSupport": true,
"executeOnEdge": false,
"valueTransform": {
"type": 0,
"maxValue": 0,
"minValue": 0,
"scaleMaxValue": 0,
"scaleMinValue": 0,
"gain": 0,
"offset": 0
},
"useAddrType": 0,
"addrTagUid": "0",
"tstate": 1,
"devAlias": "SIEMENS S7-200_Ne-3",
"station": 1,
"dataType": 16,
"regId": 5,
"ioWidth": 4,
"regName": "VD",
"addr": 1084,
"subAddr": 0,
"addrBlk": 65535,
"bitIndexEnabled": false,
"bitIndex": 0,
"addrDesc": "VD 1084"
},
{
"id": "251700808990594345",
"grpId": "251623588356953582",
"grpName": "输送运行参数",
"name": "回水流量1",
"intDigits": 4,
"fracDigits": 2,
"unit": "L/h",
"privilege": 4,
"trafficSaving": true,
"deadValue": 0.01,
"label": {
"ttext": "1",
"ftext": "0"
},
"memo": "VD1088",
"encoding": 1,
"stringByteOrder": 0,
"charCount": 1,
"deviceChanged": false,
"tagChanged": false,
"firmwareSupport": true,
"executeOnEdge": false,
"valueTransform": {
"type": 0,
"maxValue": 0,
"minValue": 0,
"scaleMaxValue": 0,
"scaleMinValue": 0,
"gain": 0,
"offset": 0
},
"useAddrType": 0,
"addrTagUid": "0",
"tstate": 1,
"devAlias": "SIEMENS S7-200_Ne-3",
"station": 1,
"dataType": 16,
"regId": 5,
"ioWidth": 4,
"regName": "VD",
"addr": 1088,
"subAddr": 0,
"addrBlk": 65535,
"bitIndexEnabled": false,
"bitIndex": 0,
"addrDesc": "VD 1088"
},
{
"id": "251700891185321401",
"grpId": "251623588356953582",
"grpName": "输送运行参数",
"name": "回水流量2",
"intDigits": 4,
"fracDigits": 2,
"unit": "L/h",
"privilege": 4,
"trafficSaving": true,
"deadValue": 0.01,
"label": {
"ttext": "1",
"ftext": "0"
},
"memo": "VD1092",
"encoding": 1,
"stringByteOrder": 0,
"charCount": 1,
"deviceChanged": false,
"tagChanged": false,
"firmwareSupport": true,
"executeOnEdge": false,
"valueTransform": {
"type": 0,
"maxValue": 0,
"minValue": 0,
"scaleMaxValue": 0,
"scaleMinValue": 0,
"gain": 0,
"offset": 0
},
"useAddrType": 0,
"addrTagUid": "0",
"tstate": 1,
"devAlias": "SIEMENS S7-200_Ne-3",
"station": 1,
"dataType": 16,
"regId": 5,
"ioWidth": 4,
"regName": "VD",
"addr": 1092,
"subAddr": 0,
"addrBlk": 65535,
"bitIndexEnabled": false,
"bitIndex": 0,
"addrDesc": "VD 1092"
},
{
"id": "251608640129080713",
"grpId": "251623588356953582",
"grpName": "输送运行参数",
"name": "输送泵1-1报警",
"intDigits": 4,
"fracDigits": 0,
"privilege": 4,
"trafficSaving": true,
"deadValue": 0,
"label": {
"ttext": "报警",
"ftext": "正常"
},
"memo": "I.B 0.3",
"encoding": 1,
"stringByteOrder": 0,
"charCount": 1,
"deviceChanged": false,
"tagChanged": false,
"firmwareSupport": true,
"executeOnEdge": false,
"valueTransform": {
"type": 0,
"maxValue": 0,
"minValue": 0,
"scaleMaxValue": 0,
"scaleMinValue": 0,
"gain": 0,
"offset": 0
},
"useAddrType": 0,
"addrTagUid": "0",
"tstate": 1,
"devAlias": "SIEMENS S7-200_Ne-3",
"station": 1,
"dataType": 0,
"regId": 3,
"ioWidth": 0,
"regName": "I.B",
"addr": 0,
"subAddr": 3,
"addrBlk": 65535,
"bitIndexEnabled": false,
"bitIndex": 0,
"addrDesc": "I.B 0.3"
},
{
"id": "251702372229714657",
"grpId": "251623588356953582",
"grpName": "输送运行参数",
"name": "输送泵1-2报警",
"intDigits": 4,
"fracDigits": 0,
"privilege": 4,
"trafficSaving": true,
"deadValue": 0,
"label": {
"ttext": "报警",
"ftext": "正常"
},
"memo": "I.B 0.4",
"encoding": 1,
"stringByteOrder": 0,
"charCount": 1,
"deviceChanged": false,
"tagChanged": false,
"firmwareSupport": true,
"executeOnEdge": false,
"valueTransform": {
"type": 0,
"maxValue": 0,
"minValue": 0,
"scaleMaxValue": 0,
"scaleMinValue": 0,
"gain": 0,
"offset": 0
},
"useAddrType": 0,
"addrTagUid": "0",
"tstate": 1,
"devAlias": "SIEMENS S7-200_Ne-3",
"station": 1,
"dataType": 0,
"regId": 3,
"ioWidth": 0,
"regName": "I.B",
"addr": 0,
"subAddr": 4,
"addrBlk": 65535,
"bitIndexEnabled": false,
"bitIndex": 0,
"addrDesc": "I.B 0.4"
},
{
"id": "251702389355057912",
"grpId": "251623588356953582",
"grpName": "输送运行参数",
"name": "输送泵2-1报警",
"intDigits": 4,
"fracDigits": 0,
"privilege": 4,
"trafficSaving": true,
"deadValue": 0,
"label": {
"ttext": "报警",
"ftext": "正常"
},
"memo": "I.B 0.5",
"encoding": 1,
"stringByteOrder": 0,
"charCount": 1,
"deviceChanged": false,
"tagChanged": false,
"firmwareSupport": true,
"executeOnEdge": false,
"valueTransform": {
"type": 0,
"maxValue": 0,
"minValue": 0,
"scaleMaxValue": 0,
"scaleMinValue": 0,
"gain": 0,
"offset": 0
},
"useAddrType": 0,
"addrTagUid": "0",
"tstate": 1,
"devAlias": "SIEMENS S7-200_Ne-3",
"station": 1,
"dataType": 0,
"regId": 3,
"ioWidth": 0,
"regName": "I.B",
"addr": 0,
"subAddr": 5,
"addrBlk": 65535,
"bitIndexEnabled": false,
"bitIndex": 0,
"addrDesc": "I.B 0.5"
},
{
"id": "251702403323138824",
"grpId": "251623588356953582",
"grpName": "输送运行参数",
"name": "输送泵2-2报警",
"intDigits": 4,
"fracDigits": 0,
"privilege": 4,
"trafficSaving": true,
"deadValue": 0,
"label": {
"ttext": "报警",
"ftext": "正常"
},
"memo": "I.B 0.6",
"encoding": 1,
"stringByteOrder": 0,
"charCount": 1,
"deviceChanged": false,
"tagChanged": false,
"firmwareSupport": true,
"executeOnEdge": false,
"valueTransform": {
"type": 0,
"maxValue": 0,
"minValue": 0,
"scaleMaxValue": 0,
"scaleMinValue": 0,
"gain": 0,
"offset": 0
},
"useAddrType": 0,
"addrTagUid": "0",
"tstate": 1,
"devAlias": "SIEMENS S7-200_Ne-3",
"station": 1,
"dataType": 0,
"regId": 3,
"ioWidth": 0,
"regName": "I.B",
"addr": 0,
"subAddr": 6,
"addrBlk": 65535,
"bitIndexEnabled": false,
"bitIndex": 0,
"addrDesc": "I.B 0.6"
},
{
"id": "257049702233545961",
"grpId": "251623588356953582",
"grpName": "输送运行参数",
"name": "输送APP手动",
"intDigits": 4,
"fracDigits": 0,
"privilege": 6,
"trafficSaving": true,
"deadValue": 0,
"label": {
"ttext": "打开",
"ftext": "关闭"
},
"memo": "",
"encoding": 1,
"stringByteOrder": 0,
"charCount": 1,
"deviceChanged": false,
"tagChanged": false,
"firmwareSupport": true,
"executeOnEdge": false,
"valueTransform": {
"type": 0,
"maxValue": 0,
"minValue": 0,
"scaleMaxValue": 0,
"scaleMinValue": 0,
"gain": 0,
"offset": 0
},
"useAddrType": 0,
"addrTagUid": "0",
"tstate": 1,
"devAlias": "SIEMENS S7-200_Ne-3",
"station": 1,
"dataType": 0,
"regId": 2,
"ioWidth": 0,
"regName": "M.B",
"addr": 30,
"subAddr": 0,
"addrBlk": 65535,
"bitIndexEnabled": false,
"bitIndex": 0,
"addrDesc": "M.B 30.0"
},
{
"id": "257049733768420746",
"grpId": "251623588356953582",
"grpName": "输送运行参数",
"name": "输送APP自动",
"intDigits": 4,
"fracDigits": 0,
"privilege": 6,
"trafficSaving": true,
"deadValue": 0,
"label": {
"ttext": "打开",
"ftext": "关闭"
},
"memo": "",
"encoding": 1,
"stringByteOrder": 0,
"charCount": 1,
"deviceChanged": false,
"tagChanged": false,
"firmwareSupport": true,
"executeOnEdge": false,
"valueTransform": {
"type": 0,
"maxValue": 0,
"minValue": 0,
"scaleMaxValue": 0,
"scaleMinValue": 0,
"gain": 0,
"offset": 0
},
"useAddrType": 0,
"addrTagUid": "0",
"tstate": 1,
"devAlias": "SIEMENS S7-200_Ne-3",
"station": 1,
"dataType": 0,
"regId": 2,
"ioWidth": 0,
"regName": "M.B",
"addr": 30,
"subAddr": 1,
"addrBlk": 65535,
"bitIndexEnabled": false,
"bitIndex": 0,
"addrDesc": "M.B 30.1"
},
{
"id": "251781819005934057",
"grpId": "251623588356953582",
"grpName": "输送运行参数",
"name": "TOC降解1开关",
"intDigits": 1,
"fracDigits": 0,
"unit": "1启用 0停用",
"privilege": 6,
"trafficSaving": true,
"deadValue": 0,
"label": {
"ttext": "1",
"ftext": "0"
},
"memo": "VW426",
"encoding": 1,
"stringByteOrder": 0,
"charCount": 1,
"deviceChanged": false,
"tagChanged": false,
"firmwareSupport": true,
"executeOnEdge": false,
"valueTransform": {
"type": 0,
"maxValue": 0,
"minValue": 0,
"scaleMaxValue": 0,
"scaleMinValue": 0,
"gain": 0,
"offset": 0
},
"useAddrType": 0,
"addrTagUid": "0",
"tstate": 1,
"devAlias": "SIEMENS S7-200_Ne-3",
"station": 1,
"dataType": 1,
"regId": 5,
"ioWidth": 2,
"regName": "VW",
"addr": 426,
"subAddr": 0,
"addrBlk": 65535,
"bitIndexEnabled": false,
"bitIndex": 0,
"addrDesc": "VW 426"
},
{
"id": "251781852648446929",
"grpId": "251623588356953582",
"grpName": "输送运行参数",
"name": "TOC降解2开关",
"intDigits": 1,
"fracDigits": 0,
"unit": "1启用 0停用",
"privilege": 6,
"trafficSaving": true,
"deadValue": 0,
"label": {
"ttext": "1",
"ftext": "0"
},
"memo": "VW428",
"encoding": 1,
"stringByteOrder": 0,
"charCount": 1,
"deviceChanged": false,
"tagChanged": false,
"firmwareSupport": true,
"executeOnEdge": false,
"valueTransform": {
"type": 0,
"maxValue": 0,
"minValue": 0,
"scaleMaxValue": 0,
"scaleMinValue": 0,
"gain": 0,
"offset": 0
},
"useAddrType": 0,
"addrTagUid": "0",
"tstate": 1,
"devAlias": "SIEMENS S7-200_Ne-3",
"station": 1,
"dataType": 1,
"regId": 5,
"ioWidth": 2,
"regName": "VW",
"addr": 428,
"subAddr": 0,
"addrBlk": 65535,
"bitIndexEnabled": false,
"bitIndex": 0,
"addrDesc": "VW 428"
},
{
"id": "251781154967919305",
"grpId": "251623588356953582",
"grpName": "输送运行参数",
"name": "循环输送1开关",
"intDigits": 1,
"fracDigits": 0,
"unit": "0启用 1停用",
"privilege": 6,
"trafficSaving": true,
"deadValue": 0,
"label": {
"ttext": "1",
"ftext": "0"
},
"memo": "VW400",
"encoding": 1,
"stringByteOrder": 0,
"charCount": 1,
"deviceChanged": false,
"tagChanged": false,
"firmwareSupport": true,
"executeOnEdge": false,
"valueTransform": {
"type": 0,
"maxValue": 0,
"minValue": 0,
"scaleMaxValue": 0,
"scaleMinValue": 0,
"gain": 0,
"offset": 0
},
"useAddrType": 0,
"addrTagUid": "0",
"tstate": 1,
"devAlias": "SIEMENS S7-200_Ne-3",
"station": 1,
"dataType": 1,
"regId": 5,
"ioWidth": 2,
"regName": "VW",
"addr": 400,
"subAddr": 0,
"addrBlk": 65535,
"bitIndexEnabled": false,
"bitIndex": 0,
"addrDesc": "VW 400"
},
{
"id": "251781366849477033",
"grpId": "251623588356953582",
"grpName": "输送运行参数",
"name": "循环输送2开关",
"intDigits": 1,
"fracDigits": 0,
"unit": "0启用 1停用",
"privilege": 6,
"trafficSaving": true,
"deadValue": 0,
"label": {
"ttext": "1",
"ftext": "0"
},
"memo": "VW402",
"encoding": 1,
"stringByteOrder": 0,
"charCount": 1,
"deviceChanged": false,
"tagChanged": false,
"firmwareSupport": true,
"executeOnEdge": false,
"valueTransform": {
"type": 0,
"maxValue": 0,
"minValue": 0,
"scaleMaxValue": 0,
"scaleMinValue": 0,
"gain": 0,
"offset": 0
},
"useAddrType": 0,
"addrTagUid": "0",
"tstate": 1,
"devAlias": "SIEMENS S7-200_Ne-3",
"station": 1,
"dataType": 1,
"regId": 5,
"ioWidth": 2,
"regName": "VW",
"addr": 402,
"subAddr": 0,
"addrBlk": 65535,
"bitIndexEnabled": false,
"bitIndex": 0,
"addrDesc": "VW 402"
}
三、通讯代码编写
1、HTTP/1.1请求
GET /api/client/box/reg/boxno/(FBox系列号) HTTP/1.1
GET /api/v2/box/4969255108963659325/dmongroup/251623588356953582/dmon HTTP/1.1
Authorization: Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6Ijg2QzQ2RTIxQTc0MTUxNTFCOTQ0MTY4MzhEMERGODU1OTZENkM2RTgiLCJ0eXAiOiJhdCtqd3QiLCJ4NXQiOiJoc1J1SWFkQlVWRzVSQmFEalEzNFZaYld4dWcifQ.eyJuYmYiOjE2NjUyNjk3NDksImV4cCI6MTY2NTI3Njk0OSwiaXNzIjoiaHR0cHM6Ly9hY2NvdW50LmZsZXhlbS5jb20vY29yZSIsImF1ZCI6Imlkc3ZyMyIsImNsaWVudF9pZCI6IjYxZGM5MzgyYTNlMTQ2ZjY4ZmNlODU3MGNhNjhmYmRhIiwic3ViIjoiMWE3ZTI2ZmQtNzE0Zi00YjM3LWExODMtZmI5NmVhMGQyODBmIiwic2NvcGUiOlsiZmJveCJdfQ.hS6-GPNu39ebsXQmkw1mmrchKmj8SxebNjHA-Dmpl_2EdBcG2AvdESVYxucH6KGugsef-7VTcDHceIqIXjf7hs1QZHPvxM7ND6fqED1wOxGK40yV6bO5r3tbHsTCiN8Q0R4nx4t2HhBwm8oZenJSDqWOMno3kj16HE7epcbZK78qIFc2OJWC1_Zj0qWJwmsb6KzDGJqXeJaSgbobSPjCFMgwEVCh3Ucd1O2_fW6rOqXAThI8L9pVtrZEZUdSYn_843hssB7PRxL72YT8k73hhK7vVD_AUBXm28YK27kTwN3DrxvG_tisEDcLdLGvqjEhEkqmh4GLuTgDcXd-247DKw
X-Fbox-Clientid:
Host: fbox360.com
Content-Length: 4
2、AsyncHttp请求
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "https://fbox360.com/api/v2/box/4969255108963659325/dmongroup/251623588356953582/dmon")
.setHeader("Authorization", "Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6Ijg2QzQ2RTIxQTc0MTUxNTFCOTQ0MTY4MzhEMERGODU1OTZENkM2RTgiLCJ0eXAiOiJhdCtqd3QiLCJ4NXQiOiJoc1J1SWFkQlVWRzVSQmFEalEzNFZaYld4dWcifQ.eyJuYmYiOjE2NjUyNjk3NDksImV4cCI6MTY2NTI3Njk0OSwiaXNzIjoiaHR0cHM6Ly9hY2NvdW50LmZsZXhlbS5jb20vY29yZSIsImF1ZCI6Imlkc3ZyMyIsImNsaWVudF9pZCI6IjYxZGM5MzgyYTNlMTQ2ZjY4ZmNlODU3MGNhNjhmYmRhIiwic3ViIjoiMWE3ZTI2ZmQtNzE0Zi00YjM3LWExODMtZmI5NmVhMGQyODBmIiwic2NvcGUiOlsiZmJveCJdfQ.hS6-GPNu39ebsXQmkw1mmrchKmj8SxebNjHA-Dmpl_2EdBcG2AvdESVYxucH6KGugsef-7VTcDHceIqIXjf7hs1QZHPvxM7ND6fqED1wOxGK40yV6bO5r3tbHsTCiN8Q0R4nx4t2HhBwm8oZenJSDqWOMno3kj16HE7epcbZK78qIFc2OJWC1_Zj0qWJwmsb6KzDGJqXeJaSgbobSPjCFMgwEVCh3Ucd1O2_fW6rOqXAThI8L9pVtrZEZUdSYn_843hssB7PRxL72YT8k73hhK7vVD_AUBXm28YK27kTwN3DrxvG_tisEDcLdLGvqjEhEkqmh4GLuTgDcXd-247DKw")
.setHeader("X-FBox-ClientId", "")
.setBody("null")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
3、nethttp请求
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://fbox360.com/api/v2/box/4969255108963659325/dmongroup/251623588356953582/dmon"))
.header("Authorization", "Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6Ijg2QzQ2RTIxQTc0MTUxNTFCOTQ0MTY4MzhEMERGODU1OTZENkM2RTgiLCJ0eXAiOiJhdCtqd3QiLCJ4NXQiOiJoc1J1SWFkQlVWRzVSQmFEalEzNFZaYld4dWcifQ.eyJuYmYiOjE2NjUyNjk3NDksImV4cCI6MTY2NTI3Njk0OSwiaXNzIjoiaHR0cHM6Ly9hY2NvdW50LmZsZXhlbS5jb20vY29yZSIsImF1ZCI6Imlkc3ZyMyIsImNsaWVudF9pZCI6IjYxZGM5MzgyYTNlMTQ2ZjY4ZmNlODU3MGNhNjhmYmRhIiwic3ViIjoiMWE3ZTI2ZmQtNzE0Zi00YjM3LWExODMtZmI5NmVhMGQyODBmIiwic2NvcGUiOlsiZmJveCJdfQ.hS6-GPNu39ebsXQmkw1mmrchKmj8SxebNjHA-Dmpl_2EdBcG2AvdESVYxucH6KGugsef-7VTcDHceIqIXjf7hs1QZHPvxM7ND6fqED1wOxGK40yV6bO5r3tbHsTCiN8Q0R4nx4t2HhBwm8oZenJSDqWOMno3kj16HE7epcbZK78qIFc2OJWC1_Zj0qWJwmsb6KzDGJqXeJaSgbobSPjCFMgwEVCh3Ucd1O2_fW6rOqXAThI8L9pVtrZEZUdSYn_843hssB7PRxL72YT8k73hhK7vVD_AUBXm28YK27kTwN3DrxvG_tisEDcLdLGvqjEhEkqmh4GLuTgDcXd-247DKw")
.header("X-FBox-ClientId", "")
.method("GET", HttpRequest.BodyPublishers.ofString("null"))
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
4、OkHttp请求
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "null");
Request request = new Request.Builder()
.url("https://fbox360.com/api/v2/box/4969255108963659325/dmongroup/251623588356953582/dmon")
.get()
.addHeader("Authorization", "Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6Ijg2QzQ2RTIxQTc0MTUxNTFCOTQ0MTY4MzhEMERGODU1OTZENkM2RTgiLCJ0eXAiOiJhdCtqd3QiLCJ4NXQiOiJoc1J1SWFkQlVWRzVSQmFEalEzNFZaYld4dWcifQ.eyJuYmYiOjE2NjUyNjk3NDksImV4cCI6MTY2NTI3Njk0OSwiaXNzIjoiaHR0cHM6Ly9hY2NvdW50LmZsZXhlbS5jb20vY29yZSIsImF1ZCI6Imlkc3ZyMyIsImNsaWVudF9pZCI6IjYxZGM5MzgyYTNlMTQ2ZjY4ZmNlODU3MGNhNjhmYmRhIiwic3ViIjoiMWE3ZTI2ZmQtNzE0Zi00YjM3LWExODMtZmI5NmVhMGQyODBmIiwic2NvcGUiOlsiZmJveCJdfQ.hS6-GPNu39ebsXQmkw1mmrchKmj8SxebNjHA-Dmpl_2EdBcG2AvdESVYxucH6KGugsef-7VTcDHceIqIXjf7hs1QZHPvxM7ND6fqED1wOxGK40yV6bO5r3tbHsTCiN8Q0R4nx4t2HhBwm8oZenJSDqWOMno3kj16HE7epcbZK78qIFc2OJWC1_Zj0qWJwmsb6KzDGJqXeJaSgbobSPjCFMgwEVCh3Ucd1O2_fW6rOqXAThI8L9pVtrZEZUdSYn_843hssB7PRxL72YT8k73hhK7vVD_AUBXm28YK27kTwN3DrxvG_tisEDcLdLGvqjEhEkqmh4GLuTgDcXd-247DKw")
.addHeader("X-FBox-ClientId", "")
.build();
Response response = client.newCall(request).execute();
5、Unirest请求
HttpResponse<String> response = Unirest.get("https://fbox360.com/api/v2/box/4969255108963659325/dmongroup/251623588356953582/dmon")
.header("Authorization", "Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6Ijg2QzQ2RTIxQTc0MTUxNTFCOTQ0MTY4MzhEMERGODU1OTZENkM2RTgiLCJ0eXAiOiJhdCtqd3QiLCJ4NXQiOiJoc1J1SWFkQlVWRzVSQmFEalEzNFZaYld4dWcifQ.eyJuYmYiOjE2NjUyNjk3NDksImV4cCI6MTY2NTI3Njk0OSwiaXNzIjoiaHR0cHM6Ly9hY2NvdW50LmZsZXhlbS5jb20vY29yZSIsImF1ZCI6Imlkc3ZyMyIsImNsaWVudF9pZCI6IjYxZGM5MzgyYTNlMTQ2ZjY4ZmNlODU3MGNhNjhmYmRhIiwic3ViIjoiMWE3ZTI2ZmQtNzE0Zi00YjM3LWExODMtZmI5NmVhMGQyODBmIiwic2NvcGUiOlsiZmJveCJdfQ.hS6-GPNu39ebsXQmkw1mmrchKmj8SxebNjHA-Dmpl_2EdBcG2AvdESVYxucH6KGugsef-7VTcDHceIqIXjf7hs1QZHPvxM7ND6fqED1wOxGK40yV6bO5r3tbHsTCiN8Q0R4nx4t2HhBwm8oZenJSDqWOMno3kj16HE7epcbZK78qIFc2OJWC1_Zj0qWJwmsb6KzDGJqXeJaSgbobSPjCFMgwEVCh3Ucd1O2_fW6rOqXAThI8L9pVtrZEZUdSYn_843hssB7PRxL72YT8k73hhK7vVD_AUBXm28YK27kTwN3DrxvG_tisEDcLdLGvqjEhEkqmh4GLuTgDcXd-247DKw")
.header("X-FBox-ClientId", "")
.body("null")
.asString();
总结
以上就是今天要讲的内容,本文仅仅介绍了使用http请求获取FlexManager平台某个FBox盒子即某设备的监控点分组的分组下的所有监控点信息,而FlexManager提供了大量供我们API调用读取,同学们可以再继续深入了解一下本篇以后的内容。
到此这篇关于Java中关于http请求获取FlexManager某设备分组监控点的文章就介绍到这了,更多相关http请求获取FlexManager内容请搜索编程网以前的文章或继续浏览下面的相关文章希望大家以后多多支持编程网!
免责声明:
① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。
② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341