跳到主要内容

主动读数据

当连接器中配置了数据点之后, 软件会自动按照配置好的间隔时间将读取任务加入到队列里面,当数据点非常多的时候, 所有数据点全部读取一遍用时可能比较长。 如果需要马上读一次某点位,可以使用此接口。

提示

目前并不是所有协议都支持此功能,实现了写入的协议已覆盖

HTTP API 调用

接口地址

http://{ip}:{port}/api/point/value/read

将上方ip替换为 NodeSCADA 安装计算机的 ip,端口一般为 5427 参数格式为 json

  • Method: POST
  • Content-Type: application/json
  • 两个参数:
    • code 数据点ID,可在连接器列表查看 String
    • timeout 超时时间(秒)Int

下面是一个 CURL 示例

curl "http://localhost:5427/api/point/value/read" 
-H "Accept: application/json, text/plain, */*"
-H "Accept-Language: zh-CN,zh;q=0.9,en;q=0.8"
-H "Connection: keep-alive"
-H "Content-Type: application/json"
-H "Sec-Fetch-Dest: empty"
-H "Sec-Fetch-Mode: cors"
-H "Sec-Fetch-Site: same-origin"
--data-raw "{\"code\":\"DE-015_yield\",\"timeout\":2}"

下面是一个 fetch 示例

fetch("http://localhost:5427/api/point/value/read", {
"headers": {
"content-type": "application/json"
},
"body": {"code":"DE-015_yield","timeout":2 },
"method": "POST"
});