# API 功能服务

Neuron将为IIoT平台提供一系列的API服务,以查询基本信息,控制网关行为或设置轮询配置。IIoT平台必须通过发送请求消息的方式发给Neuron。通过返回,Neuron将返回所需的信息或执行相应的动作。如果有错,就会返回一个错误代码来说明失败的原因。

Neuron平台的MQTT主题

订阅(Subscribe): Neuron/Request/%UUID%

发布(Publish): Neuro/Response/%UUID%

IIoT平台的MQTT主题

订阅(Subscribe): Neuron/Response/%UUID%

发布(Publish): Neuron/Request/%UUID%

api-services-on-mqtt

api-services-on-websockets

# Function 10 登录

HTTP API Header

(GET)

Resource Path: /api/v1/funcno10

Content-Type: application/json

HTTP API 或者 Websockets 或者 MQTT 通信

请求body的句式

{
  "func": 10,
  "wtrm": "DEMO-Neuron-1001_1532421778824_1",
  "name": "admin",
  "pass": "0000"
}
1
2
3
4
5
6

响应body的句式

{
  "func": 10,
  "wtrm": "DEMO-Neuron-1001_1532421778824_1",
  "errc": 0,
  "tout": 15,
  "defl": -1,
  "nalw": 3,
  "alwl": [
    {
      "atxt": "VIEW",
      "anum": 0
    },
    {
      "atxt": "MANAGER",
      "anum": 1
    },
    {
      "atxt": "ALL",
      "anum": -1
    }
  ]
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
请求字段说明
func功能代码 10
wtrm复制到响应信息的水印信息
name用户名
pass用户密码
响应字段说明
func功能代码 10
wtrm从请求信息中复制的水印
errc编译器错误代码
tout超时时间(分钟)
defl默认登录级别
nalw允许的级别数
alwl允许的等级
atxt允许的文本
ALL(-1)
VIEW(0)
OPERATOR(1)
FOREMAN(2)
MAINTENANCE(3)
SUPERVISOR(4)
ENGINEER(5)
DESIGNER(6)
MANAGER(7)
anum允许序号
-1
0
1
2
3
4
5
6
7
功能允许的等级
退出4,5,7
重启/重新启动/关机2,3,4,5,6,7
登录/注销0,1,2,3,4,5,6,7
新密码0,1,2,3,4,5,6,7
用户管理4,5,7
浏览系统ID4,5,7
状态控制2,3,4,5,7
向对象写入值4,5,7
读取实例列表4,5,7
设置配置4,5,7
读取配置4,5,7
读取全局变量4,5,7
列出所有子程序4,5,7
读取一个子程序4,5,7
创建一个子程序4,5,7
删除一个子程序4,5,7
编译一个子程序4,5,7
在子程序中搜索字符串4,5,7
检查报警状态1,2,3,4,5,7
报警确认2,3,4,5,7
改变报警模式2,3,4,5,7
报警日志报告4,5,7
读取趋势数据2,3,4,5,7
读取对象屏幕2,3,4,5,7
读取许可证信息4,5,7

# Function 11 注销

HTTP API Header

(GET)

Resource Path: /api/v1/funcno11

Content-Type: application/json

Authorization: Bearer <token>

HTTP API 或者 Websockets 或者 MQTT 通信

请求body的句式

{
  "func": 11,
  "wtrm": "DEMO-Neuron-1001_1532419775357_240",
  "name": "admin"
}
1
2
3
4
5

响应body的句式

{
  "func": 11,
  "wtrm": "DEMO-Neuron-1001_1532419775357_240",
  "errc": 0
}
1
2
3
4
5
请求字段说明
func功能代码 11
wtrm复制到响应信息的水印信息
name用户名
响应字段说明
func功能代码 11
wtrm从请求信息中复制的水印
errc编译器错误代码

# Function 12 新密码

HTTP API Header

(POST)

Resource Path: /api/v1/funcno12

Content-Type: application/json

Authorization: Bearer <token>

HTTP状态代码说明
200操作成功
400无效操作

HTTP API 或者 Websockets 或者 MQTT 通信

请求body的句式

{
  "func": 12,
  "wtrm": "DEMO-Neuron-1001_1532419775357_240",
  "name": "admin",
  "pass": "0000",
  "npwd": "1234"
}
1
2
3
4
5
6
7

响应body的句式

{
  "func": 12,
  "wtrm": "DEMO-Neuron-1001_1532419775357_240",
  "errc": 0
}
1
2
3
4
5
请求字段说明
func功能代码 12
wtrm复制到响应信息的水印信息
name用户名
pass用户密码
npwd新密码
响应字段说明
func功能代码 12
wtrm从请求信息中复制的水印
errc编译器错误代码

# Function 13 读用户列表

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno13

Content-Type: application/json

Authorization: Bearer <token>

HTTP状态代码说明
200操作成功
400无效操作

HTTP API 或者 Websockets 或者 MQTT 通信

请求body的句式

{
  "func": 13,
  "wtrm": "DEMO-Neuron-1001_1532419775357_240"
}
1
2
3
4

请求body的句式

{
  "func": 13,
  "wtrm": "DEMO-Neuron-1001_1532419775357_240",
  "errc": 0,
  "nusr": 3,
  "user": [
    "joey",
    "peter",
    "ruby"
  ]
}
1
2
3
4
5
6
7
8
9
10
11
请求字段说明
func功能代码 13
wtrm复制到响应信息的水印信息
响应字段说明
func功能代码 13
wtrm从请求信息中复制的水印
errc编译器错误代码
nusr用户数
user用户名称列表

# Function 14 读用户信息

HTTP API header

(PUT)

Resource Path: /api/v1/funcno14

Content-Type: application/json

Authorization: Bearer <token>

HTTP状态代码说明
200操作成功
400无效操作

HTTP API 或者 Websockets 或者 MQTT 通信

请求body的句式

{
  "func": 14,
  "wtrm": "DEMO-Neuron-1001_1532421778824_1",
  "name": "joey"
}
1
2
3
4
5

响应body的句式

{
  "func": 14,
  "wtrm": "DEMO-Neuron-1001_1532421778824_1",
  "errc": 0,
  "usrn": "joey",
  "tout": 15,
  "defl": -1,
  "nalw": 3,
  "alwl": [
    {
      "atxt": "VIEW",
      "anum": 0
    },
    {
      "atxt": "MANAGER",
      "anum": 1
    },
    {
      "atxt": "ALL",
      "anum": -1
    }
  ]
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
请求字段说明
func功能代码 14
wtrm复制到响应信息的水印信息
name用户名
响应字段说明
func功能代码 14
wtrm从请求信息中复制的水印
errc编译器错误代码
usrn用户名
tout超时时间(分钟)
defl默认登录级别
nalw允许的级别数
alwl允许的等级
atxt允许的文本
ALL(-1)
VIEW(0)
OPERATOR(1)
FOREMAN(2)
MAINTENANCE(3)
SUPERVISOR(4)
ENGINEER(5)
DESIGNER(6)
MANAGER(7)
anum允许序号
-1
0
1
2
3
4
5
6
7

# Function 15 保存用户信息

HTTP API Header

(POST)

Resource Path: /api/v1/funcno15

Content-Type: application/json

Authorization: Bearer <token>

HTTP状态代码说明
200操作成功
400无效操作

HTTP API 或者 Websockets 或者 MQTT 通信

请求body的句式

{
  "func": 15,
  "wtrm": "DEMO-Neuron-1001_1532419775357_240",
  "cusr": 1,
  "name": "joey",
  "pass": "0000",
  "tout": 15,
  "defl": 7,
  "nalw": 3,
  "alwl": [
    0,
    6,
    7
  ]
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

响应body的句式

{
  "func": 15,
  "wtrm": "DEMO-Neuron-1001_1532419775357_240",
  "errc": 0
}
1
2
3
4
5
请求字段说明
func功能代码 15
wtrm复制到响应信息的水印信息
cusr检查用户是否已经存在,如果存在,返回错误
name用户名 User name
pass新密码 New password
tout超时时间 (0-999(分钟),0表示永不超时
defl默认登录级别
nalw允许等级数
alwl允许等级的序号
响应字段说明
func功能代码 15
wtrm从请求信息中复制的水印
errc编译器错误代码

# Function 16 移除用户

HTTP API Header

(DELETE)

Resource Path: /api/v1/funcno16

Content-Type: application/json

Authorization: Bearer <token>

HTTP状态代码说明
200操作成功
400无效操作

HTTP API 或者 Websockets 或者 MQTT 通信

请求body的句式

{
  "func": 16,
  "wtrm": "DEMO-Neuron-1001_1532419775357_240",
  "name": "user"
}
1
2
3
4
5

响应body的句式

{
  "func": 16,
  "wtrm": "DEMO-Neuron-1001_1532419775357_240",
  "errc": 0
}
1
2
3
4
5
请求字段说明
func功能代码 16
wtrm复制到响应信息的水印信息
name用户名
响应字段说明
func功能代码 16
wtrm从请求信息中复制的水印
errc编译器错误代码

# Function 21 配置

HTTP API Header

(POST)

Resource Path: /api/v1/funcno21

Content-Type: application/json

Authorization: Bearer <token>

HTTP状态代码说明
200操作成功
400无效操作

HTTP API 或者 Websockets 或者 MQTT 通信

Request boy syntax

{
  "func":21,
  "wtrm":"neuron",
  "chnl":[
    {
      "chdv":"mbstcp",
      "tcph":"192.168.50.177",
      "tcpp":502,
      "ttyc":"",
      "ttyb":0,
      "ttyd":0,
      "ttys":"",
      "ttyp":"N",
      "parm":[
        {
          "vars":"TCPSERVER",
          "pars":"0"
        },
        {
          "vars":"BYTEORDER",
          "pars":"1"
        },
        {
          "vars":"DLYCRESOCKAFTCLOSE",
          "pars":"50"
        },
        {
          "vars":"TORECEIVETCP",
          "pars":"1000"
        },
        {
          "vars":"NAPTIMEREAD",
          "pars":"10"
        },
        {
          "vars":"NAPTIMEWRITE",
          "pars":"10"
        }
      ]
    },
    {
      "chdv":"pahomq",
      "tcph":"broker.emqx.io",
      "tcpp":1883,
      "ttyc":"",
      "ttyb":0,
      "ttyd":0,
      "ttys":"",
      "ttyp":"N",
      "parm":[
        {
          "vars":"TOPICHEADER",
          "pars":"Neuron"
        },
        {
          "vars":"USERNAME",
          "pars":""
        },
        {
          "vars":"PASSWORD",
          "pars":""
        },
        {
          "vars":"CLIENTID",
          "pars":""
        },
        {
          "vars":"TOPIC",
          "pars":""
        },
        {
          "vars":"CERTIFICATE",
          "pars":""
        },
        {
          "vars":"KEYFILE",
          "pars":""
        }
      ]
    }
  ],
  "objd":[
    {
      "objn":"test",
      "obsz":1,
      "updt":10,
      "logt":1,
      "disp":1,
      "logs":1,
      "tstd":1,
      "oatt":[
        {
          "attn":"t",
          "attt":"word",
          "deci":3,
          "attr":"R",
          "rtim":10,
          "achg":1,
          "adis":1,
          "aadd":[
            {
              "obix":0,
              "pref":"",
              "suff":"",
              "addr":"1!400001"
            }
          ]
        },
        {
          "attn":"t2",
          "attt":"word",
          "deci":0,
          "attr":"R",
          "rtim":10,
          "achg":1,
          "adis":1,
          "aadd":[
          {
            "obix":0,
            "pref":"",
            "suff":"",
            "addr":"1!400005"
          }
        ]
      }
    ]
  },
  {
    "objn":"my",
    "obsz":1,
    "updt":10,
    "logt":1,
    "disp":1,
    "logs":1,
    "tstd":1,
    "oatt":[
      {
        "attn":"m",
        "attt":"word",
        "deci":0,
        "attr":"R",
        "rtim":10,
        "achg":1,
        "adis":1,
        "aadd":[
          {
            "obix":0,
            "pref":"",
            "suff":"",
            "addr":"1!400010"
          }
        ]
      }
    ]
  }
],
"msgd":[
  {
    "subr":0,
    "sobj":"test",
    "satt":"t",
    "msgt":">",
    "cobj":"test",
    "catt":"t2",
    "acat":"alarm"
  }
]
}
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168

响应body的句式

{
  "func": 21,
  "wtrm": "neuron",
  "errc": 0
}
1
2
3
4
5
请求字段说明
func功能代码 21
wtrm复制到响应信息的水印信息
chnl通道信息
chdv通道驱动程序名称
tcphPLC/硬件设备的主机名或IP地址
tcpp设备端口号
ttycLinux设备文件名(ttyS0, ttyS1)
ttyb波特率
4800
9600
19200
38400
57600
115200
ttyd数据位
5
6
7
8
ttys停止位(string)
1
1.5
2
ttyp奇偶校验位(char)
E - Even
O - Odd
N - None
parm参数列表详细信息
vars变量名称
pars参数值
objd一个对象的详情
objn对象名称
obsz相同对象的数量
updt数据传输到云平台的时间间隔
logt数据被记录到文件的时间
disp是否需要显示所有对象属性
0 (不显示)
1 (显示)
logs是否需要记录一次连续下降的情况
0 (不需要)
1 (需要)
tstd是否需要显示时间戳
0 (不显示)
1 (显示))
oatt对象属性列表详情
attn属性名称
attt属性值的类型:
word
uword
dword
udword
float
double
bit
deci小数点位数
attr属性读/写标志
R
W
R/W
S
SW
rtim读的时间间隔 (只针对读属性)
achg属性是否可以被改变
0 (不允许)
1 (允许)
adis属性是否需要被传到平台
0 (不需要)
1 (需要)
aadd属性地址详情
obix从0开始的索引号
pref对象名称前缀
suff对象名称后缀
addr标签地址 (设备地址)
注意:对于内部寄存器tagaddr和tagattr都用"-"
msgd报警信息详情
subr子程序编号 (1-999)
sobj源对象名称
satt源属性名称
msgt信息比较类型
<
<=
>
>=
==
!=
&
^
|
cobj被比较对象的名称
catt被比较属性名称
acat报警类型
critical
alarm
warning
event
view
响应字段说明
func功能代码 21
wtrm从请求信息中复制的水印
errc编译器错误代码

# Function 22 读配置

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno22

Content-Type: application/json

Authorization: Bearer <token>

HTTP状态代码说明
200操作成功
400无效操作

HTTP API 或者 Websockets 或者 MQTT 通信

请求body的句式

{
  "func": 22,
  "wtrm": "DEMO-Neuron-1001_1532419775357_240"
}
1
2
3
4

请求body的句式

{
  "func": 22,
  "wtrm": "DEMO-Neuron-1001_1532419775357_240",
  "errc": 0
//  The structure is same as Function 21 request message
//   Not repeat here
}
1
2
3
4
5
6
7

# Function 23 读驱动程序

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno23

Content-Type: application/json

Authorization: Bearer <token>

HTTP状态代码说明
200操作成功
400无效操作

HTTP API 或者 Websockets 或者 MQTT 通信

请求body的句式

{
  "func": 23,
  "wtrm": "DEMO-Neuron-1001_1532421778824_1",
  "type": 1
}
1
2
3
4
5

响应body的句式

{
  "func": 23,
  "wtrm": "DEMO-Neuron-1001_1532421778824_1",
  "errc": 0,
  "nrow": 3,
  "rows": [
    {
      "name": "mbsrtu",
      "desc": "Modbus RTU",
      "type": "tty",
      "attr": [
        "R",
        "W",
        "RW"
      ]
    },
    {
      "name": "mbstcp",
      "desc": "Modbus TCP",
      "type": "tcp",
      "attr": [
        "R",
        "W",
        "RW"
      ]
    },
    {
      "name": "mbsrot",
      "desc": "Modbus RTU over TCP",
      "type": "tcp",
      "attr": [
        "R",
        "W",
        "RW"
      ]
    },
    {
      "name": "opcua",
      "desc": "OPC UA",
      "type": "tcp",
      "attr": [
        "R",
        "W",
        "RW"
        "S",
        "SW"
      ]
    }
  ]
}
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
请求字段说明
func功能代码 23
wtrm复制到响应信息的水印信息
type1: 驱动程序通道
2: 服务器通道
响应字段说明
func功能代码 23
wtrm从请求信息中复制的水印
errc编译器错误代码
nrow行数
name驱动程序的缩写
desc驱动程序的完整描述
type驱动程序的类型
tty表示串行驱动
tcp表示网络驱动
attr属性读/写指示器
R
W
RW
S
SW

# Function 24 读驱动程序参数

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno24

Content-Type: application/json

Authorization: Bearer <token>

HTTP状态代码说明
200操作成功
400无效操作

HTTP API 或者 Websockets 或者 MQTT 通信

请求body的句式

{
  "func": 24,
  "wtrm": "DEMO-Neuron-1001_1532421778824_1",
  "drvn": "i61850"
}
1
2
3
4
5

响应body的句式

{
  "func": 24,
  "wtrm": "DEMO-Neuron-1001_1532421778824_1",
  "errc": 0,
  "drvn": "i61850",
  "parm": [
    {
      "vars": "DLYCRESOCKAFTCLOSE",
      "pars": "300"
    },
    {
      "vars": "TORECEIVETCP",
      "pars": "300"
    },
    {
      "vars": "NAPTIMEREAD",
      "pars": "40"
    },
    {
      "vars": "NAPTIMEWRITE",
      "pars": "20"
    },
    {
      "vars": "USERNAME",
      "pars": ""
    },
    {
      "vars": "PASSWORD",
      "pars": ""
    },
    {
      "vars": "CERTIFICATE",
      "pars": ""
    },
    {
      "vars": "KEYFILE",
      "pars": ""
    },
    {
      "vars": "ADDRSUFFIX",
      "pars": ""
    }
  ]
}
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
请求字段说明
func功能代码 24
wtrm从请求信息中复制的水印
drvn驱动器名称
响应字段说明
func功能代码 24
wtrm从请求信息中复制的水印
errc编译器错误代码
drvn驱动器名称
parm参数数组
vars变量名称
pars参数值

# Function 25 检查PLC地址

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno25

Content-Type: application/json

Authorization: Bearer <token>

HTTP状态代码说明
200操作成功
400无效操作

HTTP API 或者 Websockets 或者 MQTT 通信

请求body的句式

{
  "func": 25,
  "wtrm": "d0fdb943-cff1-44bc-887d-0a3b3ba856b0",
  "chdv": "mbtcp",
  "attt": "word",
  "deci": 0,
  "attr": "R",
  "addr": "1!400002"
}
1
2
3
4
5
6
7
8
9

响应body的句式

{
  "func": 25,
  "wtrm": "d0fdb943-cff1-44bc-887d-0a3b3ba856b0",
  "errc": 0
}
1
2
3
4
5
请求字段说明
func功能代码 25
wtrm从请求信息中复制的水印
chdv通道驱动器名称 Channel driver name
attt属性值的数据类型,允许的数据类型:
word
uword
dword
udword
float
double
bit
deci小数位数
attr属性读/写指示器,允许的标志:
R
W
R/W
addr标签地址(设备地址)
注:对于内部寄存器,tagaddr和tagattr都用"-"
响应字段说明
func功能代码 25
wtrm从请求信息中复制的水印
errc编译器错误代码

# Function 26 读设备列表

HTTP API Header

(GET)

Resource Path: /api/v1/funcno25

Content-Type: application/json

Authorization: Bearer <token>

HTTP API 或者 Websockets 或者 MQTT 通信

请求body的句式

{
  "func": 26,
  "wtrm": "d0fdb943-cff1-44bc-887d-0a3b3ba856b0"
}
1
2
3
4

响应body的句式

{
  "func": 26,
  "wtrm": "d0fdb943-cff1-44bc-887d-0a3b3ba856b0",
  "rows": [
    {
      "name": "/dev/tty",
      "fdrw": 0
    },
    {
      "name": "/dev/ttyS0",
      "fdrw": 0
    },
    {
      "name": "/dev/ttyS1",
      "fdrw": -1
    },
    {
      "name": "/dev/ttyUSB0",
      "fdrw": -1
    }
  ],
  "errc": 0
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
请求字段说明
func功能代码 26
wtrm从请求信息中复制的水印
响应字段说明
func功能代码 26
wtrm从请求信息中复制的水印
rows设备列表
name设备名称
fdrw文件描述符的读写权限
0: 获得许可,
-1: 没有许可
errc编译器错误代码

# Function 30 读全局变量

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno30

Content-Type: application/json

Authorization: Bearer <token>

HTTP状态代码说明
200操作成功
400无效操作

HTTP API 或者 Websockets 或者 MQTT 通信

请求body的句式

{
  "func": 30,
  "wtrm": "DEMO-Neuron-1001_1532421778824_1"
}
1
2
3
4

响应body的句式

{
  "func": 30,
  "wtrm": "DEMO-Neuron-1001_1532421778824_1",
  "errc": 0,
  "nrow": 7,
  "rows": [
    {
      "glov": "time",
      "leng": 1,
      "comt": "unix timestamp"
    },
    {
      "glov": "year",
      "leng": 1,
      "comt": "current year"
    },
    {
      "glov": "month",
      "leng": 1,
      "comt": "current month"
    },
    {
      "glov": "day",
      "leng": 1,
      "comt": "day of the month"
    },
    {
      "glov": "hour",
      "leng": 1,
      "comt": "hour of the day"
    },
    {
      "glov": "min",
      "leng": 1,
      "comt": "minute of the hour"
    },
    {
      "glov": "dayofweek",
      "leng": 1,
      "comt": "day of the week"
    }
  ]
}
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
请求字段说明
func功能代码 30
wtrm复制到响应信息的水印信息
响应字段说明
func功能代码 30
wtrm从请求信息中复制的水印
errc编译器错误代码
nrow行数
rows行数组
glov全局变量名称
leng变量大小
comt注释

# Function 31 保存全局变量

HTTP API Header

(POST)

Resource Path: /api/v1/funcno31

Content-Type: application/json

Authorization: Bearer <token>

HTTP状态代码说明
200操作成功
400无效操作

HTTP API 或者 Websockets 或者 MQTT 通信

请求body的句式

{
  "func": 31,
  "wtrm": "DEMO-Neuron-1001_1532421778824_1",
  "nrow": 7,
  "rows": [
    {
      "glov": "time",
      "leng": 1,
      "comt": "unix timestamp"
    },
    {
      "glov": "year",
      "leng": 1,
      "comt": "current year"
    },
    {
      "glov": "month",
      "leng": 1,
      "comt": "current month"
    },
    {
      "glov": "day",
      "leng": 1,
      "comt": "day of the month"
    },
    {
      "glov": "hour",
      "leng": 1,
      "comt": "hour of the day"
    },
    {
      "glov": "min",
      "leng": 1,
      "comt": "minute of the hour"
    },
    {
      "glov": "dayofweek",
      "leng": 1,
      "comt": "day of the week"
    }
  ]
}
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

响应body的句式

{
  "func": 31,
  "wtrm": "DEMO-Neuron-1001_1532421778824_1",
  "errc": 0
}
1
2
3
4
5
请求字段说明
func功能代码 31
wtrm复制到响应信息的水印信息
nrow行数
glov全局变量名称
leng变量大小
comt注释
响应字段说明
func功能代码 31
wtrm从请求信息中复制的水印
errc编译器错误代码

# Function 32 读子程序列表

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno32

Content-Type: application/json

Authorization: Bearer <token>

HTTP状态代码说明
200操作成功
400无效操作

HTTP API 或者 Websockets 或者 MQTT 通信

请求body的句式

{
  "func": 32,
  "wtrm": "DEMO-Neuron-1001_1532421778823_1"
}
1
2
3
4

响应body的句式

{
  "func": 32,
  "wtrm": "DEMO-Neuron-1001_1532421778823_1",
  "errc": 0,
  "nsub": 3,
  "msub": 999,
  "rows": [
    {
      "subr": 200,
      "name": "SR200 TEMPERATURE ALARM HANDLER"
    },
    {
      "subr": 201,
      "name": "SR201 TEMPERATURE ALARM HANDLER"
    },
    {
      "subr": 202,
      "name": "SR202 TEMPERATURE ALARM HANDLER"
    }
  ]
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
请求字段说明
func功能代码 32
wtrm复制到响应信息的水印信息
响应字段说明
func功能代码 32
wtrm从请求信息中复制的水印
errc编译器错误代码
nsub子程序的数量
msub子程序数最大值
subr子程序编号
name子程序名称

# Function 33 读子程序

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno33

Content-Type: application/json

Authorization: Bearer <token>

HTTP状态代码说明
200操作成功
400无效操作

HTTP API 或者 Websockets 或者 MQTT 通信

请求body的句式

{
  "func": 33,
  "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  "subr": 200
}
1
2
3
4
5

响应body的句式

{
  "func": 33,
  "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  "errc": 0,
  "subr": 200,
  "name": "SR200 TEMPERATURE ALARM TIRGGER HANDLER",
  "nrow": 5,
  "rows": [
    {
      "stmt": "COMMENT",
      "expr": "TEMPERATURE HANDLER"
    },
    {
      "stmt": "",
      "expr": ""
    },
    {
      "stmt": "IF",
      "expr": "Tank[0].buzzer == 0"
    },
    {
      "stmt": "THEN",
      "expr": "Tank[0].buzzer = 1;"
    },
    {
      "stmt": "",
      "expr": ""
    }
  ]
}
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
请求字段说明
func功能代码 33
wtrm复制到响应信息的水印信息
subr子程序编号
响应字段说明
func功能代码 33
wtrm从请求信息中复制的水印
errc编译器错误代码
subr子程序编号
MAIN是-10
MANUAL是-20
AUTO是-22
name子程序名称
nrow行数
stmt语句
expr表达式

# Function 34 保存子程序

HTTP API Header

(POST)

Resource Path: /api/v1/funcno34

Content-Type: application/json

Authorization: Bearer <token>

HTTP状态代码说明
200操作成功
400无效操作

HTTP API 或者 Websockets 或者 MQTT 通信

请求body的句式

{
  "func": 34,
  "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  "csub": 0,
  "subr": 200,
  "name": "SR200 TEMPERATURE ALARM TIRGGER HANDLER",
  "nrow": 5,
  "rows": [
    {
      "stmt": "COMMENT",
      "expr": "TEMPERATURE HANDLER"
    },
    {
      "stmt": "",
      "expr": ""
    },
    {
      "stmt": "IF",
      "expr": "Tank[0].buzzer == 0"
    },
    {
      "stmt": "THEN",
      "expr": "Tank[0].buzzer = 1;"
    },
    {
      "stmt": "",
      "expr": ""
    }
  ]
}
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

响应body的句式

{
  "func": 34,
  "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  "errc": 0
}
1
2
3
4
5
请求字段说明
func功能代码 34
wtrm复制到响应信息的水印信息
csub保存前检查子程序是否存在 (0:不检查,1:检查)
subr子程序编号
MAIN是-10
MANUAL是-20
AUTO是-22
或者是任何数字(1-999)的子程序编号
name子程序名称
nrow行数
stmt语句
expr表达式
响应字段说明
func功能代码 34
wtrm从请求信息中复制的水印
errc编译器错误代码

# Function 35 移除子程序

HTTP API Header

(DELETE)

Resource Path: /api/v1/funcno35

Content-Type: application/json

Authorization: Bearer <token>

HTTP状态代码说明
200操作成功
400无效操作

HTTP API 或者 Websockets 或者 MQTT 通信

请求body的句式

{
  "func": 35,
  "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  "subr": 200
}
1
2
3
4
5

响应body的句式

{
  "func": 35,
  "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  "errc": 0
}
1
2
3
4
5
请求字段说明
func功能代码 35
wtrm复制到响应信息的水印信息
subr子程序编号
响应字段说明
func功能代码 35
wtrm从请求信息中复制的水印
errc编译器错误代码

# Function 36 测试子程序

HTTP API Header

(POST)

Resource Path: /api/v1/funcno36

Content-Type: application/json

Authorization: Bearer <token>

HTTP状态代码说明
200操作成功
400无效操作

HTTP API 或者 Websockets 或者 MQTT 通信

请求body的句式

{
  "func": 36,
  "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  "nrow": 5,
  "rows": [
    {
      "stmt": "COMMENT",
      "expr": "TEMPERATURE HANDLER"
    },
    {
      "stmt": "",
      "expr": ""
    },
    {
      "stmt": "IF",
      "expr": "Tank[0].buzzer == 0"
    },
    {
      "stmt": "THEN",
      "expr": "Tank[0].buzzer = 1;"
    },
    {
      "stmt": "",
      "expr": ""
    }
  ]
}
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

响应body的句式

{
  "func": 36,
  "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  "errc": 0
}
1
2
3
4
5
请求字段说明
func功能代码 36
wtrm复制到响应信息的水印信息
nrow行数
stmt语句
expr表达式
响应字段说明
func功能代码 36
wtrm从请求信息中复制的水印
errc编译器错误代码

# Function 37 在子程序中搜索

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno37

Content-Type: application/json

Authorization: Bearer <token>

HTTP状态代码说明
200操作成功
400无效操作

HTTP API 或者 Websockets 或者 MQTT 通信

请求body的句式

{
  "func": 37,
  "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  "srhm": "main",
  "upca": 0,
  "wwrd": 0,
  "srhs": "temperature"
}
1
2
3
4
5
6
7
8

响应body的句式

{
  "func": 37,
  "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  "errc": 0,
  "rows": [
    {
      "modu": "main",
      "line": 1,
      "chnu": 8,
      "desc": "COMMENT MAIN - TEMPERATURE CONTROL"
    },
    {
      "modu": "main",
      "line": 7,
      "chnu": 9,
      "desc": "IF Tank[i].temperature > Temp[0].high && Tank[i].switch == 1"
    },
    {
      "modu": "main",
      "line": 9,
      "chnu": 9,
      "desc": "ELSE IF Tank[i].temperature < Temp[0].low && Tank[i].switch == 0"
    }
  ]
}
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
请求字段说明
func功能代码 37
wtrm复制到响应信息的水印信息
srhm以全局变量模式搜索子程序
main
man
auto
upca是否需要匹配大小写 (1:匹配, 0:不匹配)
wwrd是否需要匹配整个单词(1:匹配整体, 0:匹配部分)
srhs搜索字符串
响应字段说明
func功能代码 37
wtrm从请求信息中复制的水印
errc编译器错误代码
rows行号索引
modu全局变量子程序模块
main
man
auto
subr子程序编号
line行号
chnu字符开始位置
desc描述

# Function 38 执行脚本

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno38

Content-Type: application/json

Authorization: Bearer <token>

HTTP状态代码说明
200操作成功
400无效操作

HTTP API 或者 Websockets 或者 MQTT 通信

请求body的句式

{
  "func": 38,
  "wtrm": "d0fdb943-cff1-44bc-887d-0a3b3ba856b0",
  "subr": 200
}
1
2
3
4
5

响应body的句式

{
  "func": 38,
  "wtrm": "d0fdb943-cff1-44bc-887d-0a3b3ba856b0",
  "errc": 0
}
1
2
3
4
5
请求字段说明
func功能代码 38
wtrm从请求信息中复制的水印
subr子程序编号 (1-999)
响应字段说明
func功能代码 38
wtrm从请求信息中复制的水印
errc编译器错误代码

# Function 50 读寄存器

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno50

Content-Type: application/json

Authorization: Bearer <token>

HTTP状态代码说明
200操作成功
400无效操作

HTTP API 或者 Websockets 或者 MQTT 通信

请求body的句式

{
  "func": 50,
  "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  "srcn": "Tank[0]"
} 
1
2
3
4
5

请求body的句式

{
  "func": 50,
  "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  "errc": 0,
  "tele": [
    {
      "objn": "Tank_1",
      "tstp": 1552532233,
      "temperature": 81.2,
      "energy": 2181.8,
      "switch": 1,
      "buzzer": 0
    },
    {
      "objn": "Tank_2",
      "tstp": 1552532233,
      "temperature": 79.1,
      "energy": 3176.2,
      "switch": 1,
      "buzzer": 0
    },
    {
      "objn": "Tank_3",
      "tstp": 1552532233,
      "temperature": 86.4,
      "energy": 1146.3,
      "switch": 0,
      "buzzer": 1
    }
  ]
}
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
请求字段说呢
func功能代码 50
wtrm复制到响应信息的水印信息
srcn带有前缀和后缀的对象名称
响应字段说明
func功能代码 50
wtrm从请求信息中复制的水印
errc错误编码
tele遥测阵列
objn对象名称
tstp时间戳

# Function 51 写寄存器

HTTP API Header

(POST)

Resource Path: /api/v1/funcno51

Content-Type: application/json

Authorization: Bearer <token>

HTTP状态代码说明
200操作成功
400无效操作

HTTP API 或者 Websockets 或者 MQTT 通信

请求body的句式

{
  "func": 51,
  "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  "srcn": "Temp",
  "attn": "high",
  "valn": 860
}
1
2
3
4
5
6
7

请求body的句式

{
  "func": 51,
  "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  "errc": 0
}
1
2
3
4
5
请求字段说明
func功能代码 51
wtrm复制到响应信息的水印信息
srcn带有前缀和后缀的对象名称
attn属性名称
valn
响应字段说明
func功能代码 51
wtrm从请求信息中复制的水印
errc编译器错误代码

# Function 60 对象列表

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno60

Content-Type: application/json

Authorization: Bearer <token>

HTTP状态代码说明
200操作成功
400无效操作

HTTP API 或者 Websockets 或者 MQTT 通信

请求body的句式

{
  "func": 60,
  "wtrm": "DEMO-Neuron-1001_1532421778827_1"
}
1
2
3
4

响应body的句式

{
  "func": 60,
  "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  "errc": 0,
  "tele": [
    {
      "objn": "Tank_1",
      "logs": 0,
      "temperature": 0,
      "energy": 0,
      "switch": 1,
      "buzzer": 1
    },
    {
      "objn": "Tank_2",
      "logs": 0,
      "temperature": 0,
      "energy": 0,
      "switch": 1,
      "buzzer": 1
    },
    {
      "objn": "Tank_3",
      "logs": 0,
      "temperature": 0,
      "energy": 0,
      "switch": 1,
      "buzzer": 1
    },
    {
      "objn": "Temp",
      "logs": 1,
      "high": 1,
      "temp1": 0,
      "temp2": 0,
      "temp3": 0,
      "low": 1
    },
    {
      "objn": "Energy",
      "logs": 1,
      "energy1": 0,
      "energy2": 0,
      "energy3": 0
    }
  ]
}
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
请求字段说明
func功能代码 60
wtrm复制到响应信息的水印信息
响应字段说明
func功能代码 60
wtrm从请求信息中复制的水印
errc错误编码
tele遥测对象屏幕描述
objn对象名称
logs是否记录 (Y/N)

# Function 61 系统状态

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno61

Content-Type: application/json

Authorization: Bearer <token>

HTTP状态代码说明
200操作成功
400无效操作

HTTP API 或者 Websockets 或者 MQTT 通信

请求body的句式

{
  "func": 61,
  "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  "actn": "act_en"
}
1
2
3
4
5

响应body的句式

{
  "func": 61,
  "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  "errc": 0,
  "tstp": 1581515618,
  "comm": "UP",
  "mach": "MANU",
  "mode": "ACTIVE",
  "mqcn": "MQCONNECT",
  "dalm": "NON-EXIST",
  "galm": "UNACKNOWLEDGE",
  "ngal": 4,
  "grow": [
    {
      "acat": "alarm",
      "astt": "OFF",
      "amod": "UNACKALARM",
      "atim": 1581513580,
      "alid": 1,
      "comt": "temp1@Temp (812) < low@Temp (800)"
    },
    {
      "acat": "alarm",
      "astt": "ON",
      "amod": "UNACKALARM",
      "atim": 1581515415,
      "alid": 3,
      "comt": "temp2@Temp (791) < low@Temp (800)"
    },
    {
      "acat": "critical",
      "astt": "ON",
      "amod": "UNACKALARM",
      "atim": 1581515415,
      "alid": 4,
      "comt": "temp3@Temp (864) > high@Temp (850)"
    },
    {
      "acat": "alarm",
      "astt": "OFF",
      "amod": "UNACKALARM",
      "atim": 1581513592,
      "alid": 5,
      "comt": "temp3@Temp (864) < low@Temp (800)"
    }
  ]
}
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
请求字段说明
func功能代码 61
wtrm复制到响应信息的水印信息
actn可以执行一下任何一种操作:

act_en:主动启用的警报
act_unack:主动撤消警报
act_all:激活所有警报
all_alm:所有警报
all_en:所有启用的警报器
all_dis:所有禁用的警报 |

响应字段说明
func功能代码 61
wtrm从请求信息中复制的水印
errc错误编码
tstp时间戳
commPLC或者硬件设备通信状态
UP
DOWN
mach机器模式
AUTO
MANU
SERV
mode请参考部分状态模式:
Inactive Mode(不活动模式)
Standby Mode / Semi-Standby Mode(待机/半待机模式)
Active Mode / Semi-Active Mode(活动/半活动模式)
mqcnMQTT代理连接状态
MQCONNECT(已连接)
MQDISCONNECT(未连接)
dalm设备报警,指定哪个设备有通信问题
galm用户可以定义自己的一般报警和触发器
ngal一般报警的数量
grow一般报警的行数
acat报警类别
critical
alarm
warning
event
view
astt报警状态
ON
OFF
amod报警模式
UNACKALARM(撤消报警)
DISABLE(禁用报警)
atim报警时间戳
alid当用户使用80接口功能确认报警时,报警ID必须被复制下来
comt报警条件描述
ndal设备报警的数量
drow设备报警的行数
chnl设备的通道数
addr设备地址

# Function 62 Ping

HTTP API Header

(GET)

Resource Path: /api/v1/funcno62

Content-Type: application/json

Authorization: Bearer <token>

# Function 70 网关控制

HTTP API header

(POST)

Resource Path: /api/v1/funcno70

Content-Type: application/json

Authorization: Bearer <token>

HTTP状态代码说明
200操作成功
400无效操作

HTTP API 或者 Websockets 或者 MQTT 通信

请求body的句式

{
  "func": 70,
  "wtrm": "DEMO-Neuron-1001_1532419775357_240",
  "acts": "restartnew"
}
1
2
3
4
5

响应body的句式

{
  "func": 70,
  "wtrm": "DEMO-Neuron-1001_1532419775357_240",
  "errc": 0
}
1
2
3
4
5
请求字段说明
func功能代码 70
wtrm复制到响应信息的水印信息
acts请求的行为:
restart:重新启动网关y
restartnew:用新的配置重新启动网关
shutdown:关闭网关
响应字段说明
func功能代码 70
wtrm从请求信息中复制的水印
errc编译器错误代码

# Function 71 状态控制

HTTP API Header

(POST)

Resource Path: /api/v1/funcno71

Content-Type: application/json

Authorization: Bearer <token>

HTTP状态代码说明
200操作成功
400无效操作

HTTP API 或者 Websockets 或者 MQTT 通信

请求body的句式

{
  "func": 71,
  "wtrm": "DEMO-Neuron-1001_1532419775357_240",
  "stat": "standby"
}
1
2
3
4
5

响应body的句式

{
  "func": 71,
  "wtrm": "DEMO-Neuron-1001_1532419775357_240",
  "errc": 0
}
1
2
3
4
5
请求字段说明
func功能代码 71
wtrm复制到响应信息的水印信息
stat请求的行为:
standby:待机模式(遥测将停止)
active:主动模式
响应字段说明
func功能代码 71
wtrm从请求信息中复制的水印
errc编译器错误代码

# Function 73 实例信息

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno73

Content-Type: application/json

Authorization: Bearer <token>

HTTP状态代码说明
200操作成功
400无效操作

HTTP API 或者 Websockets 或者 MQTT 通信

请求body的句式

{
  "func": 73,
  "wtrm": "DEMO-Neuron-1001_1532419775357_240"
}
1
2
3
4

响应body的句式

{
  "func": 73,
  "wtrm": "DEMO-Neuron-1001_1532419775357_240",
  "errc": 0,
  "agts": [
    {
      "uuid": "16538d28-4592-11e9-a787-00e067109f12",
      "time": "2019/11/10 13:42:17",
      "expd": "2070/01/01 08:00:00",
      "rest": "00:00:00:00",
      "data": "2.113112",
      "natt": "34",
      "nalr": "10",
      "tatt": "50",
      "talr": "102",
      "tusg": "10.3426",
      "matt": "100",
      "malr": "500",
      "musg": "1000",
      "self": "Y"
    },
    {
      "uuid": "87244d28-4592-11e9-a787-00e097109f12",
      "time": "2019/11/10 13:42:17",
      "expd": "2070/01/01 08:00:00",
      "rest": "00:00:00:00",
      "data": "0.1276532",
      "natt": "19",
      "nalr": "13",
      "tatt": "50",
      "talr": "102",
      "tusg": "10.3426",
      "matt": "100",
      "malr": "500",
      "musg": "1000",
      "self": "N"
    },
    {
      "uuid": "11133d28-4592-11e9-a787-00e077109f12",
      "time": "2019/11/10 13:42:17",
      "expd": "2070/01/01 08:00:00",
      "rest": "00:00:00:00",
      "data": "1.2367209",
      "natt": "21",
      "nalr": "8",
      "tatt": "50",
      "talr": "102",
      "tusg": "10.3426",
      "matt": "100",
      "malr": "500",
      "musg": "1000",
      "self": "N"
    }
  ],
  "nagt": 3
}
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
52
53
54
55
56
请求字段说明
func功能代码 73
wtrm复制到响应信息的水印信息
响应字段说明
func功能代码 73
wtrm从请求信息中复制的水印
errc编译器错误代码
agtsNeuron实例列表
uuidUUID
time最后信息更新的时间
expd系统过期时间
rest系统不活动的时间间隔
data数据使用情况
natt属性的数量
nalr报警点的数量
tatt总的属性数
talr总的报警数
tusg总的数据使用量
matt最大的属性数
malr最大的报警数
musg最大的数据使用量
self自身标志 (Y/N)
nagt实例的数量 Number of instances

# Function 74 关于信息

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno74

Content-Type: application/json

Authorization: Bearer <token>

HTTP状态代码说明
200操作成功
400无效操作

HTTP API 或者 Websockets 或者 MQTT 通信

请求body的句式

{
  "func": 74,
  "wtrm": "DEMO-Neuron-1001_1532419775357_240"
}
1
2
3
4

响应body的句式

{
  "func": 74,
  "wtrm": "DEMO-Neuron-1001_1532419775357_240",
  "errc": 0,
  "sysn": "NEURON SYSTEM v1.1.1",
  "cpyr": "Copyright (C) 2020, EMQ Technologies Co., Ltd. All rights</br>reserved.",
  "modl": "ENT-x86_64-1-0101",
  "srno": "SN010101200227",
  "bver": " 1.1.1",
  "pver": 1,
  "host": "Instance 0",
  "expd": "2020/12/30 11:59:00",
  "rest": "306:23:03:07",
  "tatt": 2,
  "matt": 10000,
  "talr": 2,
  "malr": 1600,
  "tusg": 0.00010799,
  "musg": 100000000,
  "cont": "Joey Cheung (joey@emqx.io)",
  "uuid": "16538d28-4592-11e9-a787-00e067109f12"
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
请求字段说明
func功能代码 74
wtrm复制到响应信息的水印信息
响应字段说明
func功能代码 74
wtrm从请求信息中复制的水印
errc编译器错误代码
sysn系统名称
cpyr版权信息
modl系统型号
modl系统序列号
srno序列号
bver软件构建版本
pver协议号
host主机名
expd过期时间
rest剩余可用时间
tatt使用中的属性总数
matt允许的最大属性数
talr使用中的报警总数
malr允许的最大报警数
tusg总的数据使用量
musg允许使用的最大数据使用量
cont联系信息
uuidUUID

# Function 79 显示报警

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno79

Content-Type: application/json

Authorization: Bearer <token>

HTTP状态代码说明
200操作成功
400无效操作

HTTP API 或者 Websockets 或者 MQTT 通信

请求body的句式

{
  "func": 79,
  "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  "actn": "act_en"
}
1
2
3
4
5

响应body的句式

{
  "func": 79,
  "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  "errc": 0
}
1
2
3
4
5
请求字段说明
func功能代码 79
wtrm复制到响应信息的水印信息
actn可以是以下任意一种操作:
act_en:主动启用警报
act_unack:主动解除警报
act_all:激活所有警报
all_alm:所有警报
all_en:所有启用的警报
all_dis:
响应字段说明
func功能代码 79
wtrm从请求信息中复制的水印
errc编译器错误代码

# Function 80 报警确认

HTTP API Header

(POST)

Resource Path: /api/v1/funcno80

Content-Type: application/json

Authorization: Bearer <token>

HTTP状态代码说明
200操作成功
400无效操作

HTTP API 或者 Websockets 或者 MQTT 通信

请求body的句式

{
  "func": 80,
  "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  "alid": 0,
  "actn": "acknowledge"
}
1
2
3
4
5
6

响应body的句式

{
  "func": 80,
  "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  "errc": 0
}
1
2
3
4
5
请求字段说明
func功能代码 80
wtrm复制到响应信息的水印信息
alid这个ID是由网关在心跳信息中给出的。复制正在确认的报警的ID。
actn可以是以下任意一种操作:
acknowledge(确认)
enable(启用)
disable(禁用)
响应字段说明
func功能代码 80
wtrm从请求信息中复制的水印
errc编译器错误代码

# Function 81 读历史报警

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno81

Content-Type: application/json

Authorization: Bearer <token>

HTTP状态代码说明
200操作成功
400无效操作

HTTP API 或者 Websockets 或者 MQTT 通信

请求body的句式

{
  "func": 81,
  "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  "srch": "FromFirst",
  "sett": "",
  "tokn": "",
  "ofst": 0,
  "frti": 1607335939,
  "toti": 1607335950,
  "cate": "alarm",
  "patn": "Temp"
}
1
2
3
4
5
6
7
8
9
10
11
12

响应body的句式

{
  "func": 81,
  "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  "errc": 0,
  "frti": 1577930400,
  "toti": 1582552859,
  "nalm": 10,
  "ordr": "ascending",
  "rows": [
    {
      "anum": 1,
      "tstp": 1581482963,
      "uack": "",
      "cate": "alarm",
      "stat": "on",
      "comt": "temp2@Temp (791) < low@Temp (800)"
    },
    {
      "anum": 2,
      "tstp": 1581484493,
      "uack": "",
      "cate": "alarm",
      "stat": "off",
      "comt": "temp2@Temp (0) < low@Temp (0)"
    },
    {
      "anum": 3,
      "tstp": 1581485070,
      "uack": "",
      "cate": "alarm",
      "stat": "ack",
      "comt": "temp2@Temp (791) < low@Temp (790)"
    },
    {
      "anum": 4,
      "tstp": 1581513521,
      "uack": "",
      "cate": "alarm",
      "stat": "on",
      "comt": "temp1@Temp (0) < low@Temp (790)"
    },
    {
      "anum": 5,
      "tstp": 1581513521,
      "uack": "",
      "cate": "alarm",
      "stat": "on",
      "comt": "temp2@Temp (0) < low@Temp (790)"
    },
    {
      "anum": 6,
      "tstp": 1581513521,
      "uack": "",
      "cate": "alarm",
      "stat": "on",
      "comt": "temp3@Temp (0) < low@Temp (790)"
    },
    {
      "anum": 7,
      "tstp": 1581513580,
      "uack": "",
      "cate": "alarm",
      "stat": "off",
      "comt": "temp1@Temp (0) < low@Temp (0)"
    },
    {
      "anum": 8,
      "tstp": 1581513584,
      "uack": "",
      "cate": "alarm",
      "stat": "off",
      "comt": "temp2@Temp (0) < low@Temp (0)"
    },
    {
      "anum": 9,
      "tstp": 1581513592,
      "uack": "",
      "cate": "alarm",
      "stat": "off",
      "comt": "temp3@Temp (0) < low@Temp (0)"
    },
    {
      "anum": 10,
      "tstp": 1581515415,
      "uack": "",
      "cate": "alarm",
      "stat": "on",
      "comt": "temp2@Temp (791) < low@Temp (800)"
    }
  ],
  "tokn": "5e44029700000003"
}
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
请求字段说明
func功能代码 81
wtrm复制到响应信息的水印信息
srch搜索方法 Search Method
FromFirst -- 表示向前搜索
FromLast -- 表示向后搜索
UseID -- 用于连续搜索
Blank -- 表示使用FromYear
settToday
Yesterday
ThisWeek
LastWeek
ThisMonth
LastMonth
如果使用下面的FromYear或者是ToYear,则为空,且只能与UseID的搜索方法一起使用,或在上面的搜索方法中的第一个为空
tokn前一次请求的ID字符串,用于下次搜索。(仅与UseID的搜索方法一起使用)
ofst下次搜索的偏移量。正向或者负向,仅与UseID的搜索方法一起使用,仍使用下面的搜索模式
frti开始日期(时间戳)
toti结束日期(时间戳)
cate报警类别
patn搜索模式-在报警文本的任何地方检查匹配字符串。
响应字段说明
func功能代码 81
wtrm从请求信息复制的水印A string that copied from the request message
errc编译器错误代码
frti开始日期 (时间戳)
toti结束日期 (时间戳)
nalmTotal number of alarms found
ordrOrder
ascending
descending
anumAlarm index number
tstpAlarm happening time
uackUser who acknowledge this alarm
cateAlarm Category
statStatus
on -- alarm on time
off -- alarm off time
ack -- alarm ack time
comtAlarm message
toknID string for next search

# Function 82 读历史趋势

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno82

Content-Type: application/json

Authorization: Bearer <token>

HTTP状态代码说明
200操作成功
400无效操作

HTTP API 或者 Websockets 或者 MQTT 通信

请求body的句式

{
  "func": 82,
  "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  "scrn": "test",
  "attn": "data1",
  "fend": 0,
  "tokn": -1,
  "frti": 1632978564,
  "toti": 1632982164
}
1
2
3
4
5
6
7
8
9
10

响应body的句式

{
  "func": 82,
  "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  "errc": 0,
  "frti": 1632978564,
  "toti": 1632982164,
  "npts": 500,
  "itvl": 1,
  "tokn": 500,
  "ntps": 500,
  "tele": [
        {
            "objn": "test",
            "tstp": 1632980285,
            "t": 1
        },
        {
            "objn": "test",
            "tstp": 1632980286,
            "t": 1
        },
        {
            "objn": "test",
            "tstp": 1632980287,
            "t": 1
        }
  ]
}
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
请求字段说明
func功能代码 82
wtrm复制到响应信息的水印信息
srcn带前缀和后缀的对象名称
attn属性名称(空着表示所有属性)
fend是否包含最后一个点
1 -- 包含
0 -- 不包含
tokn用于下次搜索的文件索引号
frti开始时间(时间戳)
toti结束时间(时间戳)
响应字段说明
func功能代码 82
wtrm从请求信息中复制的水印
errc编译器错误代码
frti开始时间(时间戳)
toti结束时间(时间戳)
itvl趋势点之间的时间间隔
npts找到趋势点的数量
tokn根据Token去实现下一次的搜索
tele遥测数组
objn对象名称
tstp时间戳

# Function 83 读日志

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno83

Content-Type: application/json

Authorization: Bearer <token>

HTTP API 或者 Websockets 或者 MQTT 通信

请求body的句式

{
  "func": 83,
  "wtrm": "DEMO-Neuron-1001_1532419775357_240",
  "logl": "all",
  "srtt": 1604311512,
  "stpt": 1604311517,
  "srtl": 0,
  "proc": "all"
}
1
2
3
4
5
6
7
8
9

响应body的句式

{
  "func": 83,
  "wtrm": "DEMO-Neuron-1001_1532419775357_240",
  "nrow": 500,
  "rows": [
    {
      "tstp": 1532419775,
      "logl": "warning",
      "proc": "CORE",
      "data": "extractlicense: loading certificate into memory"
    },
    {
      "tstp": 1532419775,
      "logl": "debug",
      "proc": "DRVR",
      "data": "debuglog: Cannot connect"
    },
    {
      "tstp": 1532419775,
      "logl": "err",
      "proc": "SERV",
      "data": "serverdisconnect: send disconnection request failed return code -3"
    },
    {
      "tstp": 1532419775,
      "logl": "warning",
      "proc": "CORE",
      "data": "update_process: process /home/neuron/ /bin/neuron_o_mbstcp was killed by uncaught signal 9 "
    }
  ],
  "last": 400,
  "errc": 0
}
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
请求字段说明
func功能代码 83
wtrm复制到响应信息的水印信息
logl日志等级,
允许等级 :
all,
debug,
info,
warning,
err
srtt开始的时间戳,默认为无。 Sart timestamp(s), default none
stpt结束的时间戳,默认为无。如果"stpt"设置了值,则必须有一个非空的"srtt"。
srtl日志文件的起始行号,也可以从响应信息的 "last "中获取,默认为0。
proc进程名称
响应字段说明
func功能代码 83
wtrm从请求信息中复制的水印
nrow行数, 值 <= 500
rows日志内容的行数,json数组
tstp日志时间戳(s)
logl日志等级
proc进程名称
data日志字符串数组
last最后的行号,对请求信息的"strl"很有用
errc编译器错误代码

# Function 84 日志切换

Websockets or MQTT Communication

请求body的句式

{
  "func": 84,
  "wtrm": "DEMO-Neuron-1002_1532419775357_240",
  "logn": "SCRIPTLOG",
  "vars": 100
} 
1
2
3
4
5
6

响应body的句式

{
  "func": 84,
  "wtrm": "DEMO-Neuron-1002_1532419775357_240",
  "errc": 0
}
1
2
3
4
5
请求字段说明
func功能代码 84
wtrm复制到响应信息的水印信息
logn日志名称:
SCRIPTLOG
DRIVERLOG
SERVICELOG
vars可报告的最大日志行数的变量
响应字段说明
func功能代码 84
wtrm从请求信息中复制的水印
errc编译器错误代码

# 仅限文件更新HTTP API

(POST)

Resource Path: /api/v1/{NAME}

Content-Type: multipart/form-data

Authorization: Bearer <token>

名称描述
许可证neuron 许可证文件
标志neuron 前端标志文件
HTTP状态代码说明
200操作成功
400无效操作

# 错误响应

The above gateway responses are assumed the request function are successfully handled. In case of failure to process the request, the gateway will return the following error message to the response topic.

Error 响应body的句式

{
  "func": 14,
  "wtrm": "DEMO-Neuron-1001_1532419203896_239",
  "errc": 1001,
  "emsg": " Statement expected for this row "
}
1
2
3
4
5
6
Response Compiler Error
func功能代码
wtrm从请求信息复制的字符串
errc编译器错误代码
emsg错误代码 Error text
0 , "No Error"
2 , "Function no has not found!"
3 , "Missing JSON item"
4 , "Invalid JSON structure"
10 , "Object locked"
11 , "Object not found"
12 , "Attribute locked"
13 , "Attribute not found"
14 , "Object number invalid"
15 , "Modification not allowed"
16 , "Attribute type invalid"
20 , "Operation not allowed"
21 , "Wrong password"
22 , "Wrong user name"
23 , "Not super user account"
24 , "System function error"
25 , "User not found"
26 , "Time out"
27 , "Default level"
28 , "Wrong number of levels"
29 , "User already exist"
30 , "Too many users"
40 , "Alarm not found"
41 , "Report empty"
42 , "Data format error"
43 , "Wrong revision"
44 , "Need rebuild file"
50 , "Too many global variables"
51 , "Global variable name length exceed"
52 , "Duplicated Global variables found"
53 , "Subroutine number not found"
54 , "Subroutine already exist"
55 , "No disk space for subroutine"
56 , "Search program number error"
57 , "No search string"
70 , "Wrong status change request"
71 , "Wrong gateway control request"
72 , "Wrong key"
73 , "Function not allowed in SEMI mode"
80 , "Attribute read only"
81 , "Object name error"
82 , "Data range error"
502 , "Too many channels"
503 , "Channel driver length size exceed maximum"
504 , "Channel driver invalid"
505 , "Channel driver type invalid"
506 , "Too many dummy variables"
507 , "Hostname length exceed maximum"
508 , "Port number is invalid"
509 , "Device file length too long"
510 , "Baud rate number is invalid"
511 , "Data bit invalid"
512 , "Stop bit invalid"
513 , "Parity bit invalid"
514 , "Too many objects"
515 , "Object ID length exceed maximum"
516 , "Object name length exceed maximum"
517 , "Duplicated object ID found"
518 , "Duplicated object name found"
519 , "Object size incorrect"
520 , "Update time incorrect"
521 , "Logging time incorrect"
522 , "Object status invalid"
523 , "Too many attributes"
524 , "Attribute status invalid"
525 , "Attribute type incorrect"
526 , "Attribute ID length exceed maximum"
527 , "Attribute name length exceed maximum"
528 , "Duplicated attribute ID found"
529 , "Duplicated attribute name found"
530 , "Decimal value invalid"
531 , "Attribute R/W length exceed maximum"
532 , "Attribute object number is not match"
533 , "Attribute object index is not match"
534 , "Prefix length exceed maximum"
535 , "Suffix length exceed maximum"
536 , "Prefix and Suffix string empty"
537 , "Tag address length exceed maximum"
538 , "Tag address invalid"
539 , "Tag address delimiter invalid"
540 , "Dummy sign invalid"
541 , "Tag address overlap"
542 , "Tag RW direction invalid"
543 , "Tag attribute is not match"
544 , "Tag bit type is not match"
545 , "Tag bit type error"
546 , "Tag ix exceed limit"
547 , "Tag array member invalid"
548 , "Alarm object name length exceed"
549 , "Alarm attribute name length exceed"
550 , "Alarm subroutine number not found"
551 , "Alarm category not found"
552 , "Alarm attribute not match"
553 , "Alarm ID not found"
554 , "Alarm type not found"
555 , "Alarm object name not found"
556 , "Tag name length exceed maximum"
557 , "Tag name invalid"
558 , "Duplicated tag name found"
559 , "Attribute tag length exceed"
560 , "Attribute tag not found"
561 , "Attribute tag index invalid"
562 , "Tag array invalid"
563 , "Tag type invalid"
564 , "Tag R/W direction invalid"
1001, "Statement expected for this row"
1002, "Statement does not exist"
1003, "INIT follows a normal statement (except REM, INIT)"
1004, "THEN expected after test statement"
1005, "Unexpected THEN, not a test above"
1006, "Unexpected ELIF/ELSE, not a THEN above"
1007, "Unknown statement"
1008, "GOTO undefined position (POSxxx)"
1009, "Error in POSxxx statement"
1010, "FATAL! Cannot solve all jump instruction"
2001, "Too many local variables in one file"
2002, "Syntax error in INIT (only assign local vars)"
2003, "INIT: assign (=) expected"
2004, "INIT: assign value expected"
2005, "INIT: expression delimiter (;) expected"
2006, "Syntax error in token"
2007, "Too long local variable name"
2008, "Syntax error in local variable"
2009, "Syntax error in constant"
2010, "Too long DB variable name"
2011, "Syntax error in [..] construction"
2012, "Syntax error in DB variable"
2013, "Syntax error in object variable"
2014, "Illegal label number"
2015, "Illegal subroutine number"
2016, "Too long global variable name"
2017, "Syntax error in global variable"
2018, "Syntax error in [index] construction"
2019, "Too long [index] name"
2020, "Syntax error in GOTO POSxxx instruction"
2021, "Syntax error in CALL SRxxx instruction"
2023, "Declaring a control variable"
2024, "Declaring too many local variables"
2025, "Local variable not declared/not a control variable"
2029, "Too long object name"
2030, "Too long field name"
2101, "Not an executable instruction/variable"
2102, "; expected after instruction"
2103, "No statement should follow RETURN/GOTO"
2104, "= expected after variable for assign"
2105, "; not allowed in test or inside parenthesis"
2106, "Instruction not allowed in test or inside parenthesis"
2107, "Operand expected"
2108, "Instruction should be first token in expression"
2109, "Operand/expression not expected"
2110, "Assign not allowed after test"
2111, "Assign variable is read-only"
2112, ") unexpected"
2113, "Object variable does not exist"
2114, "Index of Object variable not inside array"
2115, "Tag variable does not exist"
2116, "Index of Tag variable not inside array"
2117, "Unary used twice on same operand"
2118, "Unrecognized operator"
2119, "Application part for station does not exist"
2120, "Global variable does not exist"
2121, "Index of global variable not inside array"
2122, ", expected after variable declaration"
2123, "Index must be used on variable array"
2124, "Index cannot be used on single variable"
2125, "Operator is not allowed in double calculation"
2132, "Local variable as index is not used before"
2201, "Expression not completed"
2202, "Expression ended before resolving last parenthesis"
2300, "Global variable name too long"
2301, "Global variable name have capital letter"
2302, "Global variable length too large < 1000"
2303, "Global variable comment too long"