# Functional Services

Neuron would provide a series of API services for IIoT platform, to query the basic information, to control gateway behaviors or to setup the polling configuration. IIoT platform must initiate the communication by sending request message to Neuron. By return, Neuron would send back the required information or execute the deserved action. If there is error, a error code would be returned to tell the reason of failure.

MQTT Topics for Neuron

Subscribe: Neuron/Request/%UUID%

Publish: Neuro/Response/%UUID%

MQTT Topics for IIoT platform

Subscribe: Neuron/Response/%UUID%

Publish: Neuron/Request/%UUID%

# Function 10 Login

HTTP API Header

(GET)

Resource Path: /api/v1/funcno10

Content-Type: application/json

HTTP API or Websockets or MQTT Communication

Request body syntax

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

Response body syntax

{
  "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
Request
funcFunction code 10
wtrmA water mark that copied to the response message
nameUsername
passUser password
Response
funcFunction code 10
wtrmA water mark that copied from the request message
errcCompiler error code
toutTime out
deflDefault level
nalwNo of allowed levels
alwlAllowed level
atxtAllowed text
ALL -1
VIEW
OPERATOR
FOREMAN
MAINTENANCE
SUPERVISOR
ENGINEER
DESIGNER
MANAGER 7
anumAllowed number
-1
0
1
2
3
4
5
6
7
FunctionsAllowed Level
Exit to shell4,5,7
Restart/Newrestart/Shutdown2,3,4,5,6,7
Login/Logout0,1,2,3,4,5,6,7
New password0,1,2,3,4,5,6,7
User administration4,5,7
Browse system ID4,5,7
Status control2,3,4,5,7
Write value to object4,5,7
Read instance list4,5,7
Setup configuration4,5,7
Read configuration4,5,7
Read global variable4,5,7
List all subroutine4,5,7
Read a subroutine4,5,7
Create a subroutine4,5,7
Delete a subroutine4,5,7
Compiler a subroutine4,5,7
Search string in a subroutine4,5,7
Check alarm status1,2,3,4,5,7
Alarm acknowledge2,3,4,5,7
Change alarm mode2,3,4,5,7
Alarm Log report4,5,7
Read trend data2,3,4,5,7
Read object screen2,3,4,5,7
Read License Information4,5,7

# Function 11 Logout

HTTP API Header

(GET)

Resource Path: /api/v1/funcno11

Content-Type: application/json

Authorization: Bearer <token>

HTTP API or Websockets or MQTT Communication

Request body syntax

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

Response body syntax

{
  "func": 11,
  "wtrm": "DEMO-Neuron-1001_1532419775357_240",
  "errc": 0
}
1
2
3
4
5
Request
funcFunction code 11
wtrmA water mark that copied to the response message
nameUsername
Response
funcFunction code 11
wtrmA water mark that copied from the request message
errcCompiler error code

# Function 12 New Password

HTTP API Header

(POST)

Resource Path: /api/v1/funcno12

Content-Type: application/json

Authorization: Bearer <token>

HTTP status codeDescription
200Successful operation
400Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

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

Response body syntax

{
  "func": 12,
  "wtrm": "DEMO-Neuron-1001_1532419775357_240",
  "errc": 0
}
1
2
3
4
5
Request
funcFunction code 12
wtrmA water mark that copied to the response message
nameUsername
passPassword
npwdNew Password
Response
funcFunction code 12
wtrmA water mark that copied from the request message
errcCompiler error code

# Function 13 Read User List

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno13

Content-Type: application/json

Authorization: Bearer <token>

HTTP status codeDescription
200Successful operation
400Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

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

Request body syntax

{
  "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
Request
funcFunction code 13
wtrmA water mark that copied to the response message
Response
funcFunction code 13
wtrmA water mark that copied from the request message
errcCompiler error code
nusrNo of users
userA list of users name

# Function 14 Read User Information

HTTP API header

(PUT)

Resource Path: /api/v1/funcno14

Content-Type: application/json

Authorization: Bearer <token>

HTTP status codeDescription
200Successful operation
400Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

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

Response body syntax

{
  "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
Request
funcFunction code 14
wtrmA water mark that copied to the response message
nameUsername
Response
funcFunction code 14
wtrmA water mark that copied from the request message
errcCompiler error code
usrnUser name
toutTime out
deflDefault level
nalwNo of allowed levels
alwlAllowed level
atxtAllowed text ALL
VIEW
OPERATOR
FOREMAN
MAINTENANCE
SUPERVISOR
ENGINEER
DESIGNER
MANAGER
anumAllowed number -1
0
1
2
3
4
5
6
7

# Function 15 Save User Information

HTTP API Header

(POST)

Resource Path: /api/v1/funcno15

Content-Type: application/json

Authorization: Bearer <token>

HTTP status codeDescription
200Successful operation
400Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

{
  "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

Response body syntax

{
  "func": 15,
  "wtrm": "DEMO-Neuron-1001_1532419775357_240",
  "errc": 0
}
1
2
3
4
5
Request
funcFunction code 15
wtrmA water mark that copied to the response message
cusrCheck user already exist if exist, return error
nameUser name
passNew password
toutTimeout (0-999 in minutes, 0 means never time-out)
deflDefault level (0-9)
nalwNo of allowed level
alwlArray of allowed level
Response
funcFunction code 15
wtrmA water mark that copied from the request message
errcCompiler error code

# Function 16 Remove User

HTTP API Header

(DELETE)

Resource Path: /api/v1/funcno16

Content-Type: application/json

Authorization: Bearer <token>

HTTP status codeDescription
200Successful operation
400Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

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

Response body syntax

{
  "func": 16,
  "wtrm": "DEMO-Neuron-1001_1532419775357_240",
  "errc": 0
}
1
2
3
4
5
Request
funcFunction code 16
wtrmA water mark that copied to the response message
nameUsername
Response
funcFunction code 16
wtrmA water mark that copied from the request message
errcCompiler error code

# Function 21 Configuration

HTTP API Header

(POST)

Resource Path: /api/v1/funcno21

Content-Type: application/json

Authorization: Bearer <token>

HTTP status codeDescription
200Successful operation
400Invalid Operation

HTTP API or Websockets or MQTT Communication

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

Response body syntax

{
  "func": 21,
  "wtrm": "DEMO-Neuron-1001_1532419775357_240",
  "errc": 0
}
1
2
3
4
5
Request
funcFunction code 21
wtrmA water mark that copied to the response message
chnlChannel Details
chdvChannel driver name
tcphHostname or IP address of PLC/hardware device
tcppPort number of a device
ttycLinux device file name (ttyS0, ttyS1)
ttybBaud rate
4800
9600
19200
38400
57600
115200
ttydData bit
5
6
7
8
ttysStop bit (string)
1
1.5
2
ttypParity bit (char)
E - Even
O - Odd
N - None
parmParameter array Details
varsVariables name
parsParameters
objdObject Details
objnObject name
obszNumber of same objects
updtTime interval for data transfer to platform cloud
logtTime interval for data to be logged on file
tstdTimestamp display
0 (no display)
1 (display)
dispAll object attributes need to be displayed
0 (no display)
1 (display)
logsNeed logging once connection drop
0 (no need)
1 (need)
oattObject Attribute Details
attnAttribute name
atttAttribute value type:
word
uword
dword
udword
float
double
bit
datetime
deciNo of decimal place
adisAttribute transferred to platform
0 (no need)
1 (need)
achgAttribute can be changed
0 (not allow)
1 (allow)
attrAttribute Read/Write indicator
R
W
R/W
S
SW
rtimRead time (for only attr: R)
aaddAttribute Address Details
obixStart from 0 index number
prefObject name prefix
suffObject name suffix
addrTag address (device address)
Note: For internal register, both tagaddr and tagattr use "-"
msgdMessage Details
msgtMessage type
<
<=
>
>=
==
!=
&
^
|
sobjSource object name
sattSource attribute name
cobjCompared object name
cattCompared attribute name
acatAlarm Category
critical
alarm
warning
event
view
subrSubroutine number (1-999)
Response
funcFunction code 21
wtrmA water mark that copied from the request message
errcCompiler error code

# Function 22 Read Configuration

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno22

Content-Type: application/json

Authorization: Bearer <token>

HTTP status codeDescription
200Successful operation
400Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

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

Request body syntax

{
  "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 Read Drivers

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno23

Content-Type: application/json

Authorization: Bearer <token>

HTTP status codeDescription
200Successful operation
400Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

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

Response body syntax

{
  "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
Request
funcFunction code 23
wtrmA water mark that copied to the response message
type1: Driver Channel
2: Server Channel
Response
funcFunction code 23
wtrmA water mark that copied from the request message
errcCompiler error code
nrowNumber of rows
nameShort name of driver
descFull description of driver
typeType of driver
tty Serial driver
tcp Network driver
attrAttribute Read/Write indicator
R
W
RW
S
SW

# Function 24 Read Driver Parameters

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno24

Content-Type: application/json

Authorization: Bearer <token>

HTTP status codeDescription
200Successful operation
400Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

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

Response body syntax

{
  "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
Request
funcFunction code 24
wtrmA water mark that copied from the request message
drvndriver name
Response
funcFunction code 24
wtrmA water mark that copied from the request message
errcCompiler error code
drvndriver name
parmparameter array

# Function 25 Check PLC Addresses

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno25

Content-Type: application/json

Authorization: Bearer <token>

HTTP status codeDescription
200Successful operation
400Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

{
  "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

Response body syntax

{
  "func": 25,
  "wtrm": "d0fdb943-cff1-44bc-887d-0a3b3ba856b0",
  "errc": 0
}
1
2
3
4
5
Request
funcFunction code 25
wtrmA water mark that copied from the request message
chdvChannel driver name
atttAttribute value type, allow text:
word
uword
dword
udword
float
double
bit
datetime
deciNo of decimal place
attrAttribute Read/Write indicator, allow text:
R
W
R/W
addrTag address (device address)
Note: For internal register, both tagaddr and tagattr use "-"
Response
funcFunction code 25
wtrmA water mark that copied from the request message
errcCompiler error code

# Function 26 Read Device List

HTTP API Header

(GET)

Resource Path: /api/v1/funcno25

Content-Type: application/json

Authorization: Bearer <token>

HTTP API or Websockets or MQTT Communication

Request body syntax

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

Response body syntax

{
  "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
Request
funcFunction code 26
wtrmA water mark that copied from the request message
Response
funcFunction code 26
wtrmA water mark that copied from the request message
rowsDevice list
nameDevice name
fdrwFile descriptor read and write permission,
0: Got permission,
-1: No permission
errcCompiler error code

# Function 30 Read Global Variable

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno30

Content-Type: application/json

Authorization: Bearer <token>

HTTP status codeDescription
200Successful operation
400Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

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

Response body syntax

{
  "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
Request
funcFunction code 30
wtrmA water mark that copied to the response message
Response
funcFunction code 30
wtrmA water mark that copied from the request message
errcCompiler error code
nrowNumber of rows
glovGlobal variable name
lengVariable size
comtComments

# Function 31 Save Global Variable

HTTP API Header

(POST)

Resource Path: /api/v1/funcno31

Content-Type: application/json

Authorization: Bearer <token>

HTTP status codeDescription
200Successful operation
400Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

{
  "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

Response body syntax

{
  "func": 31,
  "wtrm": "DEMO-Neuron-1001_1532421778824_1",
  "errc": 0
}
1
2
3
4
5
Request
funcFunction code 31
wtrmA water mark that copied to the response message
nrowNumber of rows
glovGlobal variable name
lengVariable size
comtComments
Response
funcFunction code 31
wtrmA water mark that copied from the request message
errcCompiler error code

# Function 32 Read Subroutine List

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno32

Content-Type: application/json

Authorization: Bearer <token>

HTTP status codeDescription
200Successful operation
400Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

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

Response body syntax

{
  "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
Request
funcFunction code 32
wtrmA water mark that copied to the response message
Response
funcFunction code 32
wtrmA water mark that copied from the request message
errcCompiler error code
nsubNumber of subroutines
msubMaximum number of subroutines
subrSubroutine number
nameSubroutine name

# Function 33 Read Subroutine

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno33

Content-Type: application/json

Authorization: Bearer <token>

HTTP status codeDescription
200Successful operation
400Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

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

Response body syntax

{
  "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
Request
funcFunction code 33
wtrmA water mark that copied to the response message
subrSubroutine number
Response
funcFunction code 33
wtrmA water mark that copied from the request message
errcCompiler error code
subrSubroutine number
MAIN is -10
MANUAL is -20
AUTO is -22
nameSubroutine name
nrowNumber of rows
stmtStatement
exprExpression

# Function 34 Save Subroutine

HTTP API Header

(POST)

Resource Path: /api/v1/funcno34

Content-Type: application/json

Authorization: Bearer <token>

HTTP status codeDescription
200Successful operation
400Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

{
  "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

Response body syntax

{
  "func": 34,
  "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  "errc": 0
}
1
2
3
4
5
Request
funcFunction code 34
wtrmA string that copied to the response message
csubCheck Subroutine Exist before save (0 -- don't check, 1 -- check)
subrRoutine Number
MAIN is -10
MANUAL is -20
AUTO is -22
Or any number (1-999) for subroutine
nameSubroutine Name
nrowNo of Lines
stmtStatement
exprExpression
Response
funcFunction code 34
wtrmA water mark that copied from the request message
errcCompiler error code

# Function 35 Remove Subroutine

HTTP API Header

(DELETE)

Resource Path: /api/v1/funcno35

Content-Type: application/json

Authorization: Bearer <token>

HTTP status codeDescription
200Successful operation
400Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

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

Response body syntax

{
  "func": 35,
  "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  "errc": 0
}
1
2
3
4
5
Request
funcFunction code 35
wtrmA water mark that copied to the response message
subrSubroutine Number
Response
funcFunction code 35
wtrmA water mark that copied from the request message
errcCompiler error code

# Function 36 Test Subroutine

HTTP API Header

(POST)

Resource Path: /api/v1/funcno36

Content-Type: application/json

Authorization: Bearer <token>

HTTP status codeDescription
200Successful operation
400Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

{
  "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

Response body syntax

{
  "func": 36,
  "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  "errc": 0
}
1
2
3
4
5
Request
funcFunction code 36
wtrmA water mark that copied to the response message
subrSubroutine Number
nrowNo of Lines
stmtStatement
exprExpression
Response
funcFunction code 36
wtrmA water mark that copied from the request message
errcCompiler error code

# Function 37 Search in Subroutine

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno37

Content-Type: application/json

Authorization: Bearer <token>

HTTP status codeDescription
200Successful operation
400Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

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

Response body syntax

{
  "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
Request
funcFunction code 37
wtrmA water mark that copied to the response message
srhmSearch mode globalvar
main
man
auto
subroutine
upcaMatch upper lower case (1 match, 0 no need)
wwrdMatch whole word (1 match whole, 0 match part)
srhsSearch string
Response
funcFunction code 37
wtrmA water mark that copied from the request message
errcCompiler error code
rowsRow number index
moduModule globalvar
main
man
auto
subroutine
subrSubroutine number
lineLine number
chnuStart at character position
descDescription

# Function 38 Execute Script

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno38

Content-Type: application/json

Authorization: Bearer <token>

HTTP status codeDescription
200Successful operation
400Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

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

Response body syntax

{
  "func": 38,
  "wtrm": "d0fdb943-cff1-44bc-887d-0a3b3ba856b0",
  "errc": 0
}
1
2
3
4
5
Request
funcFunction code 38
wtrmA water mark that copied from the request message
subrSubroutine number (1-999)
Response
funcFunction code 38
wtrmA water mark that copied from the request message
errcCompiler error code

# Function 50 Read Register

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno50

Content-Type: application/json

Authorization: Bearer <token>

HTTP status codeDescription
200Successful operation
400Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

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

Request body syntax

{
  "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
Request
funcFunction code 50
wtrmA water mark that copied to the response message
srcnObject Name with prefix and suffix
Response
funcFunction code 50
wtrmA water mark that copied from the request message
errcError code
teleTelemetry Array
objnObject Name
tstpTimeStamp

# Function 51 Write Register

HTTP API Header

(POST)

Resource Path: /api/v1/funcno51

Content-Type: application/json

Authorization: Bearer <token>

HTTP status codeDescription
200Successful operation
400Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

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

Request body syntax

{
  "func": 51,
  "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  "errc": 0
}
1
2
3
4
5
Request
funcFunction code 51
wtrmA water mark that copied to the response message
srcnObject Name with prefix and suffix
attnAttribute Name
valnValue
Response
funcFunction code 51
wtrmA water mark that copied from the request message
errcCompiler error code

# Function 60 Object Screen

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno60

Content-Type: application/json

Authorization: Bearer <token>

HTTP status codeDescription
200Successful operation
400Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

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

Response body syntax

{
  "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
Request
funcFunction code 60
wtrmA water mark that copied to the response message
Response
funcFunction code 60
wtrmA water mark that copied from the request message
errcError code
teleTelemetry object screen description
objnObject name
logsLogging (Y/N)

# Function 61 System Status

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno61

Content-Type: application/json

Authorization: Bearer <token>

HTTP status codeDescription
200Successful operation
400Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

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

Response body syntax

{
  "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
Request
funcFunction code 61
wtrmA water mark that copied to the response message
actnAction can be anyone of following
act_en Active enabled alarms
act_unack Active Unack alarms
act_all Active all alarms
all_alm All alarms
all_en All enabled alarms
all_dis All disabled alarms
Response
funcFunction code 61
wtrmA water mark that copied from the request message
errcError code
tstpTimeStamp
commPLC or hardware communication status
UP
DOWN
machMachine Mode
AUTO
MANU
SERV
modePlease refer to Status Mode section.
Inactive Mode
Standby Mode / Semi-Standby Mode
Active Mode / Semi-Active Mode
mqcnMQ broker connection status
MQCONNECT
MQDISCONNECT
dalmDevice Alarm which specify which device has
communication problem.
ndalNumber of device alarms
drowDevice alarm rows
chnlChannel number of devices
addrAddress of devices
galmGeneral Alarm which user define their own alarms and
triggers
ngalNumber of general alarms
growGeneral alarm rows
acatAlarm Category
critical
alarm
warning
event
view
asttAlarm Status
ON
OFF
amodAlarm Mode
UNACKALARM
DISABLE
atimAlarm TimeStamp
alidAlarm ID
must be copied this ID when user acknowledge function 80
comtAlarm Comments

# Function 62 Ping

HTTP API Header

(GET)

Resource Path: /api/v1/funcno62

Content-Type: application/json

Authorization: Bearer <token>

# Function 70 Gateway Control

HTTP API header

(POST)

Resource Path: /api/v1/funcno70

Content-Type: application/json

Authorization: Bearer <token>

HTTP status codeDescription
200Successful operation
400Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

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

Response body syntax

{
  "func": 70,
  "wtrm": "DEMO-Neuron-1001_1532419775357_240",
  "errc": 0
}
1
2
3
4
5
Request
funcFunction code 70
wtrmA water mark that copied to the response message
actsRequest action
restart - restart gateway
restartnew - restart gateway with new configuration
shutdown - shutdown gateway
Response
funcFunction code 70
wtrmA water mark that copied from the request message
errcCompiler error code

# Function 71 Status Control

HTTP API Header

(POST)

Resource Path: /api/v1/funcno71

Content-Type: application/json

Authorization: Bearer <token>

HTTP status codeDescription
200Successful operation
400Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

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

Response body syntax

{
  "func": 71,
  "wtrm": "DEMO-Neuron-1001_1532419775357_240",
  "errc": 0
}
1
2
3
4
5
Request
funcFunction code 71
wtrmA water mark that copied to the response message
statRequest action
standby - standby mode (telemetry will stop)
active - active mode
Response
funcFunction code 71
wtrmA water mark that copied from the request message
errcCompiler error code

# Function 73 Instance Information

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno73

Content-Type: application/json

Authorization: Bearer <token>

HTTP status codeDescription
200Successful operation
400Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

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

Response body syntax

{
  "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"
    }
  ]
}
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
Request
funcFunction code 73
wtrmA water mark that copied to the response message
Response
funcFunction code 73
wtrmA water mark that copied from the request message
errcCompiler error code
nagtNumber of instances
agtsNeuron instance list
uuidUUID
timeLast information update time
expdSystem expired date
restTime left for the system inactive
dataData usage
nattNo of attributes
nalrNo of alarm points
tattTotal no. of attributes
talrTotal no. of alarm points
tusgTotal data usage amount
mattMaximum no. of attributes
malrMaximum no. of alarm points
musgMaximum data usage amount
selfSelf Flag (Y/N)

# Function 74 About Information

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno74

Content-Type: application/json

Authorization: Bearer <token>

HTTP status codeDescription
200Successful operation
400Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

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

Response body syntax

{
  "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
Request
funcFunction code 74
wtrmA water mark that copied to the response message
Response
funcFunction code 74
wtrmA water mark that copied from the request message
errcCompiler error code
sysnSystem Name
cpyrCopyright message
modlSystem model number
modlSystem serial number
srnoSerial no
bverSoftware build version
pverProtocol number
hostHostname
expdExpired date
restRemaining available time
tattTotal no. of attributes in use
mattMax no. of attributes allowed
talrTotal no. of alarms in use
malrMax no. of alarms allowed
tusgTotal data usage
tusgMax data usage
contContact information
uuidUUID

# Function 79 Show Alarms

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno79

Content-Type: application/json

Authorization: Bearer <token>

HTTP status codeDescription
200Successful operation
400Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

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

Response body syntax

{
  "func": 79,
  "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  "errc": 0
}
1
2
3
4
5
Request
funcFunction code 79
wtrmA water mark that copied to the response message
actnAction can be anyone of following
act_en Active enabled alarms
act_unack Active Unack alarms
act_all Active all alarms
all_alm All alarms
all_en All enabled alarms
all_dis All disabled alarms
Response
funcFunction code 79
wtrmA water mark that copied from the request message
errcCompiler error code

# Function 80 Alarm Acknowledge

HTTP API Header

(POST)

Resource Path: /api/v1/funcno80

Content-Type: application/json

Authorization: Bearer <token>

HTTP status codeDescription
200Successful operation
400Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

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

Response body syntax

{
  "func": 80,
  "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  "errc": 0
}
1
2
3
4
5
Request
funcFunction code 80
wtrmA water mark that copied to the response message
alidThis ID is given out by the gateway in the heartbeat message. Copy the one which is being acknowledge.
actnAction can be anyone of following
acknowledge
enable
disable
Response
funcFunction code 80
wtrmA water mark that copied from the request message
errcCompiler error code

# Function 81 Read Historical Alarm

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno81

Content-Type: application/json

Authorization: Bearer <token>

HTTP status codeDescription
200Successful operation
400Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

{
  "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

Response body syntax

{
  "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
Request
funcFunction code 81
wtrmA string that copied to the response message
srchSearch Method
FromFirst -- means forwards
FromLast -- means backwards
UseID -- use for consecutive search
Blank -- means use FromYear
settToday
Yesterday
ThisWeek
LastWeek
ThisMonth
LastMonth
Blank if using FromYear or ToYear below, can only be
combined with UseID or blank for first in SearchMethod
above
toknID string from previous request for next search. (only
together with UseID above)
ofstOffset for next search. positive or negative, only
together with UseID above, still using the search
pattern below
frtiFrom Datetime (timestamp)
totiTo Datetime (timestamp)
cateAlarm Category
patnSearch Pattern - check matching string anywhere in the
alarm text.
Response
funcFunction code 81
wtrmA string that copied from the request message
errcCompiler error code
frtiFrom Datetime (timestamp)
totiTo Datetime (timestamp)
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 Read Historical Trend

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno82

Content-Type: application/json

Authorization: Bearer <token>

HTTP status codeDescription
200Successful operation
400Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

{
  "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

Response body syntax

{
  "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
Request
funcFunction code 82
wtrmA water mark that copied to the response message
srcnObject name with prefix and suffix
attnAttribute name (empty means all attributes)
fendInclude the last point
1 -- include
0 -- not include
toknFile index number for next search
frtiFrom Datetime (timestamp)
totiTo Datetime (timestamp)
Response
funcFunction code 82
wtrmA water mark that copied from the request message
errcCompiler error code
frtiFrom Datetime (timestamp)
totiTo Datetime (timestamp)
itvlTime Interval between trend points
nptsNumber of trend points found
toknToken to implement next search
teleTelemetry array
objnObject name
tstpTimeStamp

# Function 83 Read Log

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno83

Content-Type: application/json

Authorization: Bearer <token>

HTTP API or Websockets or MQTT Communication

Request body syntax

{
  "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

Response body syntax

{
  "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
Request
funcFunction code 83
wtrmA water mark that copied to the response message
loglLog level,
allow text :
all,
debug,
info,
warning,
err
srttSart timestamp(s), default none
stptEnd timestamp(s), default none, must with a nonempty
"srtt" if set value for "stpt"
srtlStart line number of the log file, also can be got from
"last" of response message,default 0
procProcess name
Response
funcFunction code 83
wtrmA water mark that copied from the request message
nrowNumber of rows, <= 500
rowsRows of Log content, json array
tstplog timestamp (s)
loglLog level
procProcess name
dataLog string data
lastLast line number , useful for "strl" of request message
errcCompiler error code

# Function 84 Log Switch

Websockets or MQTT Communication

Request body syntax

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

Response body syntax

{
  "func": 84,
  "wtrm": "DEMO-Neuron-1002_1532419775357_240",
  "errc": 0
}
1
2
3
4
5
Request
funcFunction code 84
wtrmA water mark that copied to the response message
lognLog name:
SCRIPTLOG
DRIVERLOG
SERVICELOG
varsVariable for maximum of log lines can be reported
Response
funcFunction code 84
wtrmA water mark that copied from the request message
errcCompiler error code

# File Update HTTP API only

(POST)

Resource Path: /api/v1/{NAME}

Content-Type: multipart/form-data

Authorization: Bearer <token>

NAMEDescription
licenseneuron license file
logoneuron dashboard logo file
HTTP status codeDescription
200Successful operation
400Invalid Operation

# Error Response

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 response body syntax

{
  "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
funcFunction code
wtrmA string that copied from the request message
errcCompiler error code
emsgError code 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"