IoT Gateway即Internet of Things Gateway物联网网关。
Kepware以插件的形式提供了4种网关:
- MQTT客户端
- REST客户端
- REST服务器
- ThingWorx网关
各种网关形式的区别及说明就不聊了!!!
----------------------------------------------------------------------------------
编制:雲飛兄
===============================================
欢迎大家加入交流讨论QQ群: 905485143

===============================================
---------------------------------------------------------------------------------
# 测试示例
使用lot Gateway REST 服务端 API 方式开放 第三方操作读写 Tag
-------------------------------
# 配置说明
KEPWare插件 : lot Gateway Trpe : REST Server API 方式: POST
-------------------------------
# URL 格式说明
- 127.0.0.1:39320/iotgateway/ -- API 说明主页
- 127.0.0.1:39320/iotgateway/browse --API 浏览 Tag
- 127.0.0.1:39320/iotgateway/read --API 读 TagID的值
- 127.0.0.1:39320/iotgateway/write --API 写 TagID的值
后面有格式详细说明
-------------------------------
# URL 前缀说明(HTTPS)(HTTP) 的设置
-------------------------------
-
KEPServerEX 6.6 lot Gateway 配置方式:
-
Lot Gateway Agent -常规
- Lot Gateway Agent -Server
- Lot Gateway Agent - 添加开放的Tag
-------------------------------
2. 启动测试(浏览) REST-S-R-POST JSON数组格式,测试OK
网页访问:
URL格式:
http://127.0.0.1:39320/iotgateway/browse
返回格式:
{"browseResults":[{"id":"Simulator.T2.5S"},{"id":"Simulator.T2.K0"}],"succeeded":true,"reason":""}
API 第三方工具 访问:
3. 启动测试(读) REST-S-R-POST JSON数组格式,测试OK
网页访问:
URL格式:
http://127.0.0.1:39320/iotgateway/read?ids=Simulator.T2.K0
返回格式:
{"readResults":[{"id":"Simulator.T2.K0","s":true,"r":"","v":1,"t":1608117831416}]}
API 第三方工具 访问:
4. 启动测试(写) REST-S-R-POST JSON数组格式,测试OK
-----------------------------------------------------------------------
5. 127.0.0.1:39320/iotgateway 访问说明
IoT Gateway: Agent-REST-S (REST服务器)
以下是可与此IoT网关REST服务器一起使用的命令:
- browse
- read
- write*
REST Server代理支持读取和写入除只能读取的字符串数组以外的所有数据类型。
物联网网关产品手册
(IoT Gateway Product Manual Click here for the IoT Gateway documentation.
----------------------
REST API
Name |
browse |
URL |
|
Format |
json |
Method |
GET |
Returns |
200 OK if successful. A JSON object in the response body containing a list of groups. |
cURL example:
curl -H "Content-Type: application/json" -v https://127.0.0.1:39320/iotgateway/browse
JSON return value:
{
"browseResults": [
{
"id": "Channel1.Device1.tag1"
},
{
"id": "Channel1.Device1.tag2"
}
],
"succeeded": true,
"reason": ""
}
--------------read---------------------
Name |
read |
URL |
|
Format |
json |
Method |
GET |
Returns |
200 OK if successful. A JSON object in the response body containing the tags that the user is authorized to browse. |
Example |
https://127.0.0.1:39320/iotgateway/read?ids=Channel1.Device1.tag1&ids=Channel1.Device1.tag2 |
cURL example:
curl -H "Content-Type: application/json" -v https://127.0.0.1:39320/iotgateway/read?ids=Channel1.Device1.tag1
JSON return value:
{
"readResults": [
{
"id": "Channel1.Device1.tag1",
"s": true,
"r": "",
"v": 263,
"t": 1442606724647
}
]
}
--------------read---------------------
Name |
read |
URL |
|
Format |
json |
Method |
POST |
Returns |
200 OK if successful. A JSON object in the response body containing a list of read results. |
cURL example:
curl -H "Content-Type: application/json" -vX POST -d "[\"Channel1.Device1.tag1\"]" https://127.0.0.1:39320/iotgateway/read
JSON return value:
{
"readResults": [
{
"id": "Channel1.Device1.tag1",
"s": true,
"r": "",
"v": 557,
"t": 1442607022758
}
]
}
--------------write---------------------
Name |
write |
URL |
|
Format |
json |
Method |
POST |
Returns |
200 OK if successful. A JSON object in the response body containing a list of write results. |
cURL example:
curl -H "Content-Type: application/json" -vX POST -d "[{ \"id\": \"Channel1.Device1.tag1\", \"v\": 42},{ \"id\": \"Channel1.Device1.tag2\", \"v\": 17},{ \"id\": \"Channel1.Device1.tag3\", \"v\": 36}]" https://127.0.0.1:39320/iotgateway/write
JSON return value:
{
"writeResults": [
{
"id": "Channel1.Device1.tag1",
"s": true,
"r": ""
},
{
"id": "Channel1.Device1.tag2",
"s": true,
"r": ""
},
{
"id": "Channel1.Device1.tag3",
"s": true,
"r": ""
}
]
}
上面示例中的标记名称必须与Browse命令返回的标记名称匹配。
*仅当在REST Server界面中启用并且与可写标签一起使用时,写操作才可用。