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%

MQTT topic string list

Neuron/Broadcast

Neuron/Heartbeat/%UUID%

Neuron/Telemetry/%UUID%

Neuron/Request/%UUID%

Neuron/Response/%UUID%

where %UUID% is a 36 characters UUID string of Neuron.

Neuron gateways subscribe topics

Neuron/Broadcast

Neuron/Request/%UUID%

Neuron gateway publish topics

Neuron/Broadcast

Neuron/Heartbeat/%UUID%

Neuron/Telemetry/%UUID%

Neuron/Request/%UUID%

Neuron/Response/%UUID%

IIoT Platform subscribe topics

Neuron/Broadcast

Neuron/Heartbeat/%UUID%

Neuron/Telemetry/%UUID%

Neuron/Response/%UUID%

IIoT Platform publish topics

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

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

Response body syntax

  1. {
  2. "func": 10,
  3. "wtrm": "DEMO-Neuron-1001_1532421778824_1",
  4. "errc": 0,
  5. "tout": 15,
  6. "defl": -1,
  7. "nalw": 3,
  8. "alwl": [
  9. {
  10. "atxt": "VIEW",
  11. "anum": 0
  12. },
  13. {
  14. "atxt": "MANAGER",
  15. "anum": 1
  16. },
  17. {
  18. "atxt": "ALL",
  19. "anum": -1
  20. }
  21. ]
  22. }
Request
func Function code 10
wtrm A water mark that copied to the response message
name Username
pass User password
Response
func Function code 10
wtrm A water mark that copied from the request message
errc Compiler error code
tout Time out
defl Default level
nalw No of allowed levels
alwl Allowed level
atxt Allowed text
ALL -1
VIEW
OPERATOR
FOREMAN
MAINTENANCE
SUPERVISOR
ENGINEER
DESIGNER
MANAGER 7
anum Allowed number
-1
0
1
2
3
4
5
6
7
Functions Allowed Level
Exit to shell 4,5,7
Restart/Newrestart/Shutdown 2,3,4,5,6,7
Login/Logout 0,1,2,3,4,5,6,7
New password 0,1,2,3,4,5,6,7
User administration 4,5,7
Browse system ID 4,5,7
Status control 2,3,4,5,7
Write value to object 4,5,7
Read instance list 4,5,7
Setup configuration 4,5,7
Read configuration 4,5,7
Read global variable 4,5,7
List all subroutine 4,5,7
Read a subroutine 4,5,7
Create a subroutine 4,5,7
Delete a subroutine 4,5,7
Compiler a subroutine 4,5,7
Search string in a subroutine 4,5,7
Check alarm status 1,2,3,4,5,7
Alarm acknowledge 2,3,4,5,7
Change alarm mode 2,3,4,5,7
Alarm Log report 4,5,7
Read trend data 2,3,4,5,7
Read object screen 2,3,4,5,7
Read License Information 4,5,7

Function 11 Logout

HTTP API Header

(GET)

Resource Path: /api/v1/funcno11

Content-Type: application/json

Authorization: Bearer

HTTP API or Websockets or MQTT Communication

Request body syntax

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

Response body syntax

  1. {
  2. "func": 11,
  3. "wtrm": "DEMO-Neuron-1001_1532419775357_240",
  4. "errc": 0
  5. }
Request
func Function code 11
wtrm A water mark that copied to the response message
name Username
Response
func Function code 11
wtrm A water mark that copied from the request message
errc Compiler error code

Function 12 New Password

HTTP API Header

(POST)

Resource Path: /api/v1/funcno12

Content-Type: application/json

Authorization: Bearer

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

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

Response body syntax

  1. {
  2. "func": 12,
  3. "wtrm": "DEMO-Neuron-1001_1532419775357_240",
  4. "errc": 0
  5. }
Request
func Function code 12
wtrm A water mark that copied to the response message
name Username
pass Password
npwd New Password
Response
func Function code 12
wtrm A water mark that copied from the request message
errc Compiler error code

Function 13 Read User List

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno13

Content-Type: application/json

Authorization: Bearer

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

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

Response body syntax

  1. {
  2. "func": 13,
  3. "wtrm": "DEMO-Neuron-1001_1532419775357_240",
  4. "errc": 0,
  5. "nusr": 3,
  6. "user": [
  7. "joey",
  8. "peter",
  9. "ruby"
  10. ]
  11. }
Request
func Function code 13
wtrm A water mark that copied to the response message
Response
func Function code 13
wtrm A water mark that copied from the request message
errc Compiler error code
nusr No of users
user A list of users name

Function 14 Read User Information

HTTP API header

(PUT)

Resource Path: /api/v1/funcno14

Content-Type: application/json

Authorization: Bearer

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

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

Response body syntax

  1. {
  2. "func": 14,
  3. "wtrm": "DEMO-Neuron-1001_1532421778824_1",
  4. "errc": 0,
  5. "usrn": "joey",
  6. "tout": 15,
  7. "defl": -1,
  8. "nalw": 3,
  9. "alwl": [
  10. {
  11. "atxt": "VIEW",
  12. "anum": 0
  13. },
  14. {
  15. "atxt": "MANAGER",
  16. "anum": 1
  17. },
  18. {
  19. "atxt": "ALL",
  20. "anum": -1
  21. }
  22. ]
  23. }
Request
func Function code 14
wtrm A water mark that copied to the response message
name Username
Response
func Function code 14
wtrm A water mark that copied from the request message
errc Compiler error code
usrn User name
tout Time out
defl Default level
nalw No of allowed levels
alwl Allowed level
atxt Allowed text ALL
VIEW
OPERATOR
FOREMAN
MAINTENANCE
SUPERVISOR
ENGINEER
DESIGNER
MANAGER
anum Allowed 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

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

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

Response body syntax

  1. {
  2. "func": 15,
  3. "wtrm": "DEMO-Neuron-1001_1532419775357_240",
  4. "errc": 0
  5. }
Request
func Function code 15
wtrm A water mark that copied to the response message
cusr Check user already exist if exist, return error
name User name
pass New password
tout Timeout (0-999 in minutes, 0 means never time-out)
defl Default level (0-9)
nalw No of allowed level
alwl Array of allowed level
Response
func Function code 15
wtrm A water mark that copied from the request message
errc Compiler error code

Function 16 Remove User

HTTP API Header

(DELETE)

Resource Path: /api/v1/funcno16

Content-Type: application/json

Authorization: Bearer

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

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

Response body syntax

  1. {
  2. "func": 16,
  3. "wtrm": "DEMO-Neuron-1001_1532419775357_240",
  4. "errc": 0
  5. }
Request
func Function code 16
wtrm A water mark that copied to the response message
name Username
Response
func Function code 16
wtrm A water mark that copied from the request message
errc Compiler error code

Function 21 Configuration

HTTP API Header

(POST)

Resource Path: /api/v1/funcno21

Content-Type: application/json

Authorization: Bearer

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request boy syntax

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

Response body syntax

  1. {
  2. "func": 21,
  3. "wtrm": "DEMO-Neuron-1001_1532419775357_240",
  4. "errc": 0
  5. }
Request
func Function code 21
wtrm A water mark that copied to the response message
chnl Channel Details
chdv Channel driver name
tcph Hostname or IP address of PLC/hardware device
tcpp Port number of a device
ttyc Linux device file name (ttyS0, ttyS1)
ttyb Baud rate
4800
9600
19200
38400
57600
115200
ttyd Data bit
5
6
7
8
ttys Stop bit (string)
1
1.5
2
ttyp Parity bit (char)
E - Even
O - Odd
N - None
parm Parameter array Details
vars Variables name
pars Parameters
objd Object Details
objn Object name
obsz Number of same objects
updt Time interval for data transfer to platform cloud
logt Time interval for data to be logged on file
tstd Timestamp display
0 (no display)
1 (display)
disp All object attributes need to be displayed
0 (no display)
1 (display)
logs Need logging once connection drop
0 (no need)
1 (need)
oatt Object Attribute Details
attn Attribute name
attt Attribute value type:
word
uword
dword
udword
float
double
bit
datetime
deci No of decimal place
adis Attribute transferred to platform
0 (no need)
1 (need)
achg Attribute can be changed
0 (not allow)
1 (allow)
attr Attribute Read/Write indicator
R
W
R/W
S
SW
rtim Read time (for only attr: R)
aadd Attribute Address Details
obix Start from 0 index number
pref Object name prefix
suff Object name suffix
addr Tag address (device address)
Note: For internal register, both tagaddr and tagattr use “-“
msgd Message Details
msgt Message type
<
<=
>
>=
==
!=
&
^
sobj Source object name
satt Source attribute name
cobj Compared object name
catt Compared attribute name
acat Alarm Category
critical
alarm
warning
event
view
subr Subroutine number (1-999)
Response
func Function code 21
wtrm A water mark that copied from the request message
errc Compiler error code

Function 22 Read Configuration

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno22

Content-Type: application/json

Authorization: Bearer

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

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

Response body syntax

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

Function 23 Read Drivers

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno23

Content-Type: application/json

Authorization: Bearer

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

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

Response body syntax

  1. {
  2. "func": 23,
  3. "wtrm": "DEMO-Neuron-1001_1532421778824_1",
  4. "errc": 0,
  5. "nrow": 3,
  6. "rows": [
  7. {
  8. "name": "mbsrtu",
  9. "desc": "Modbus RTU",
  10. "type": "tty",
  11. "attr": [
  12. "R",
  13. "W",
  14. "RW"
  15. ]
  16. },
  17. {
  18. "name": "mbstcp",
  19. "desc": "Modbus TCP",
  20. "type": "tcp",
  21. "attr": [
  22. "R",
  23. "W",
  24. "RW"
  25. ]
  26. },
  27. {
  28. "name": "mbsrot",
  29. "desc": "Modbus RTU over TCP",
  30. "type": "tcp",
  31. "attr": [
  32. "R",
  33. "W",
  34. "RW"
  35. ]
  36. },
  37. {
  38. "name": "opcua",
  39. "desc": "OPC UA",
  40. "type": "tcp",
  41. "attr": [
  42. "R",
  43. "W",
  44. "RW"
  45. "S",
  46. "SW"
  47. ]
  48. }
  49. ]
  50. }
Request
func Function code 23
wtrm A water mark that copied to the response message
type 1: Driver Channel
2: Server Channel
Response
func Function code 23
wtrm A water mark that copied from the request message
errc Compiler error code
nrow Number of rows
name Short name of driver
desc Full description of driver
type Type of driver
tty Serial driver
tcp Network driver
attr Attribute 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

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

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

Response body syntax

  1. {
  2. "func": 24,
  3. "wtrm": "DEMO-Neuron-1001_1532421778824_1",
  4. "errc": 0,
  5. "drvn": "i61850",
  6. "parm": [
  7. {
  8. "vars": "DLYCRESOCKAFTCLOSE",
  9. "pars": "300"
  10. },
  11. {
  12. "vars": "TORECEIVETCP",
  13. "pars": "300"
  14. },
  15. {
  16. "vars": "NAPTIMEREAD",
  17. "pars": "40"
  18. },
  19. {
  20. "vars": "NAPTIMEWRITE",
  21. "pars": "20"
  22. },
  23. {
  24. "vars": "USERNAME",
  25. "pars": ""
  26. },
  27. {
  28. "vars": "PASSWORD",
  29. "pars": ""
  30. },
  31. {
  32. "vars": "CERTIFICATE",
  33. "pars": ""
  34. },
  35. {
  36. "vars": "KEYFILE",
  37. "pars": ""
  38. },
  39. {
  40. "vars": "ADDRSUFFIX",
  41. "pars": ""
  42. }
  43. ]
  44. }
Request
func Function code 24
wtrm A water mark that copied from the request message
drvn driver name
Response
func Function code 24
wtrm A water mark that copied from the request message
errc Compiler error code
drvn driver name
parm parameter array

Function 25 Check PLC Addresses

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno25

Content-Type: application/json

Authorization: Bearer

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

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

Response body syntax

  1. {
  2. "func": 25,
  3. "wtrm": "d0fdb943-cff1-44bc-887d-0a3b3ba856b0",
  4. "errc": 0
  5. }
Request
func Function code 25
wtrm A water mark that copied from the request message
chdv Channel driver name
attt Attribute value type, allow text:
word
uword
dword
udword
float
double
bit
datetime
deci No of decimal place
attr Attribute Read/Write indicator, allow text:
R
W
R/W
addr Tag address (device address)
Note: For internal register, both tagaddr and tagattr use “-“
Response
func Function code 25
wtrm A water mark that copied from the request message
errc Compiler error code

Function 26 Read Device List

HTTP API Header

(GET)

Resource Path: /api/v1/funcno25

Content-Type: application/json

Authorization: Bearer

HTTP API or Websockets or MQTT Communication

Request body syntax

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

Response body syntax

  1. {
  2. "func": 26,
  3. "wtrm": "d0fdb943-cff1-44bc-887d-0a3b3ba856b0",
  4. "rows": [
  5. {
  6. "name": "/dev/tty",
  7. "fdrw": 0
  8. },
  9. {
  10. "name": "/dev/ttyS0",
  11. "fdrw": 0
  12. },
  13. {
  14. "name": "/dev/ttyS1",
  15. "fdrw": -1
  16. },
  17. {
  18. "name": "/dev/ttyUSB0",
  19. "fdrw": -1
  20. }
  21. ],
  22. "errc": 0
  23. }
Request
func Function code 26
wtrm A water mark that copied from the request message
Response
func Function code 26
wtrm A water mark that copied from the request message
rows Device list
name Device name
fdrw File descriptor read and write permission,
0: Got permission,
-1: No permission
errc Compiler error code

Function 30 Read Global Variable

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno30

Content-Type: application/json

Authorization: Bearer

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

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

Response body syntax

  1. {
  2. "func": 30,
  3. "wtrm": "DEMO-Neuron-1001_1532421778824_1",
  4. "errc": 0,
  5. "nrow": 7,
  6. "rows": [
  7. {
  8. "glov": "time",
  9. "leng": 1,
  10. "comt": "unix timestamp"
  11. },
  12. {
  13. "glov": "year",
  14. "leng": 1,
  15. "comt": "current year"
  16. },
  17. {
  18. "glov": "month",
  19. "leng": 1,
  20. "comt": "current month"
  21. },
  22. {
  23. "glov": "day",
  24. "leng": 1,
  25. "comt": "day of the month"
  26. },
  27. {
  28. "glov": "hour",
  29. "leng": 1,
  30. "comt": "hour of the day"
  31. },
  32. {
  33. "glov": "min",
  34. "leng": 1,
  35. "comt": "minute of the hour"
  36. },
  37. {
  38. "glov": "dayofweek",
  39. "leng": 1,
  40. "comt": "day of the week"
  41. }
  42. ]
  43. }
Request
func Function code 30
wtrm A water mark that copied to the response message
Response
func Function code 30
wtrm A water mark that copied from the request message
errc Compiler error code
nrow Number of rows
glov Global variable name
leng Variable size
comt Comments

Function 31 Save Global Variable

HTTP API Header

(POST)

Resource Path: /api/v1/funcno31

Content-Type: application/json

Authorization: Bearer

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

  1. {
  2. "func": 31,
  3. "wtrm": "DEMO-Neuron-1001_1532421778824_1",
  4. "nrow": 7,
  5. "rows": [
  6. {
  7. "glov": "time",
  8. "leng": 1,
  9. "comt": "unix timestamp"
  10. },
  11. {
  12. "glov": "year",
  13. "leng": 1,
  14. "comt": "current year"
  15. },
  16. {
  17. "glov": "month",
  18. "leng": 1,
  19. "comt": "current month"
  20. },
  21. {
  22. "glov": "day",
  23. "leng": 1,
  24. "comt": "day of the month"
  25. },
  26. {
  27. "glov": "hour",
  28. "leng": 1,
  29. "comt": "hour of the day"
  30. },
  31. {
  32. "glov": "min",
  33. "leng": 1,
  34. "comt": "minute of the hour"
  35. },
  36. {
  37. "glov": "dayofweek",
  38. "leng": 1,
  39. "comt": "day of the week"
  40. }
  41. ]
  42. }

Response body syntax

  1. {
  2. "func": 31,
  3. "wtrm": "DEMO-Neuron-1001_1532421778824_1",
  4. "errc": 0
  5. }
Request
func Function code 31
wtrm A water mark that copied to the response message
nrow Number of rows
glov Global variable name
leng Variable size
comt Comments
Response
func Function code 31
wtrm A water mark that copied from the request message
errc Compiler error code

Function 32 Read Subroutine List

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno32

Content-Type: application/json

Authorization: Bearer

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

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

Response body syntax

  1. {
  2. "func": 32,
  3. "wtrm": "DEMO-Neuron-1001_1532421778823_1",
  4. "errc": 0,
  5. "nsub": 3,
  6. "msub": 999,
  7. "rows": [
  8. {
  9. "subr": 200,
  10. "name": "SR200 TEMPERATURE ALARM HANDLER"
  11. },
  12. {
  13. "subr": 201,
  14. "name": "SR201 TEMPERATURE ALARM HANDLER"
  15. },
  16. {
  17. "subr": 202,
  18. "name": "SR202 TEMPERATURE ALARM HANDLER"
  19. }
  20. ]
  21. }
Request
func Function code 32
wtrm A water mark that copied to the response message
Response
func Function code 32
wtrm A water mark that copied from the request message
errc Compiler error code
nsub Number of subroutines
msub Maximum number of subroutines
subr Subroutine number
name Subroutine name

Function 33 Read Subroutine

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno33

Content-Type: application/json

Authorization: Bearer

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

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

Response body syntax

  1. {
  2. "func": 33,
  3. "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  4. "errc": 0,
  5. "subr": 200,
  6. "name": "SR200 TEMPERATURE ALARM TIRGGER HANDLER",
  7. "nrow": 5,
  8. "rows": [
  9. {
  10. "stmt": "COMMENT",
  11. "expr": "TEMPERATURE HANDLER"
  12. },
  13. {
  14. "stmt": "",
  15. "expr": ""
  16. },
  17. {
  18. "stmt": "IF",
  19. "expr": "Tank[0].buzzer == 0"
  20. },
  21. {
  22. "stmt": "THEN",
  23. "expr": "Tank[0].buzzer = 1;"
  24. },
  25. {
  26. "stmt": "",
  27. "expr": ""
  28. }
  29. ]
  30. }
Request
func Function code 33
wtrm A water mark that copied to the response message
subr Subroutine number
Response
func Function code 33
wtrm A water mark that copied from the request message
errc Compiler error code
subr Subroutine number
MAIN is -10
MANUAL is -20
AUTO is -22
name Subroutine name
nrow Number of rows
stmt Statement
expr Expression

Function 34 Save Subroutine

HTTP API Header

(POST)

Resource Path: /api/v1/funcno34

Content-Type: application/json

Authorization: Bearer

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

  1. {
  2. "func": 34,
  3. "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  4. "csub": 0,
  5. "subr": 200,
  6. "name": "SR200 TEMPERATURE ALARM TIRGGER HANDLER",
  7. "nrow": 5,
  8. "rows": [
  9. {
  10. "stmt": "COMMENT",
  11. "expr": "TEMPERATURE HANDLER"
  12. },
  13. {
  14. "stmt": "",
  15. "expr": ""
  16. },
  17. {
  18. "stmt": "IF",
  19. "expr": "Tank[0].buzzer == 0"
  20. },
  21. {
  22. "stmt": "THEN",
  23. "expr": "Tank[0].buzzer = 1;"
  24. },
  25. {
  26. "stmt": "",
  27. "expr": ""
  28. }
  29. ]
  30. }

Response body syntax

  1. {
  2. "func": 34,
  3. "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  4. "errc": 0
  5. }
Request
func Function code 34
wtrm A string that copied to the response message
csub Check Subroutine Exist before save (0 — don’t check, 1 — check)
subr Routine Number
MAIN is -10
MANUAL is -20
AUTO is -22
Or any number (1-999) for subroutine
name Subroutine Name
nrow No of Lines
stmt Statement
expr Expression
Response
func Function code 34
wtrm A water mark that copied from the request message
errc Compiler error code

Function 35 Remove Subroutine

HTTP API Header

(DELETE)

Resource Path: /api/v1/funcno35

Content-Type: application/json

Authorization: Bearer

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

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

Response body syntax

  1. {
  2. "func": 35,
  3. "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  4. "errc": 0
  5. }
Request
func Function code 35
wtrm A water mark that copied to the response message
subr Subroutine Number
Response
func Function code 35
wtrm A water mark that copied from the request message
errc Compiler error code

Function 36 Test Subroutine

HTTP API Header

(POST)

Resource Path: /api/v1/funcno36

Content-Type: application/json

Authorization: Bearer

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

  1. {
  2. "func": 36,
  3. "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  4. "nrow": 5,
  5. "rows": [
  6. {
  7. "stmt": "COMMENT",
  8. "expr": "TEMPERATURE HANDLER"
  9. },
  10. {
  11. "stmt": "",
  12. "expr": ""
  13. },
  14. {
  15. "stmt": "IF",
  16. "expr": "Tank[0].buzzer == 0"
  17. },
  18. {
  19. "stmt": "THEN",
  20. "expr": "Tank[0].buzzer = 1;"
  21. },
  22. {
  23. "stmt": "",
  24. "expr": ""
  25. }
  26. ]
  27. }

Response body syntax

  1. {
  2. "func": 36,
  3. "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  4. "errc": 0
  5. }
Request
func Function code 36
wtrm A water mark that copied to the response message
subr Subroutine Number
nrow No of Lines
stmt Statement
expr Expression
Response
func Function code 36
wtrm A water mark that copied from the request message
errc Compiler error code

Function 37 Search in Subroutine

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno37

Content-Type: application/json

Authorization: Bearer

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

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

Response body syntax

  1. {
  2. "func": 37,
  3. "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  4. "errc": 0,
  5. "rows": [
  6. {
  7. "modu": "main",
  8. "line": 1,
  9. "chnu": 8,
  10. "desc": "COMMENT MAIN - TEMPERATURE CONTROL"
  11. },
  12. {
  13. "modu": "main",
  14. "line": 7,
  15. "chnu": 9,
  16. "desc": "IF Tank[i].temperature > Temp[0].high && Tank[i].switch == 1"
  17. },
  18. {
  19. "modu": "main",
  20. "line": 9,
  21. "chnu": 9,
  22. "desc": "ELSE IF Tank[i].temperature < Temp[0].low && Tank[i].switch == 0"
  23. }
  24. ]
  25. }
Request
func Function code 37
wtrm A water mark that copied to the response message
srhm Search mode globalvar
main
man
auto
subroutine
upca Match upper lower case (1 match, 0 no need)
wwrd Match whole word (1 match whole, 0 match part)
srhs Search string
Response
func Function code 37
wtrm A water mark that copied from the request message
errc Compiler error code
rows Row number index
modu Module globalvar
main
man
auto
subroutine
subr Subroutine number
line Line number
chnu Start at character position
desc Description

Function 38 Execute Script

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno38

Content-Type: application/json

Authorization: Bearer

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

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

Response body syntax

  1. {
  2. "func": 38,
  3. "wtrm": "d0fdb943-cff1-44bc-887d-0a3b3ba856b0",
  4. "errc": 0
  5. }
Request
func Function code 38
wtrm A water mark that copied from the request message
subr Subroutine number (1-999)
Response
func Function code 38
wtrm A water mark that copied from the request message
errc Compiler error code

Function 50 Read Register

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno50

Content-Type: application/json

Authorization: Bearer

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

  1. {
  2. "func": 50,
  3. "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  4. "srcn": "test"
  5. }

Response body syntax

  1. {
  2. "func": 50,
  3. "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  4. "erroc": 0,
  5. "tele": [
  6. {
  7. "objn": "test",
  8. "tstp": 1643180286,
  9. "data1": 123,
  10. "data2": 789,
  11. "data3": 3,
  12. "data4": 4,
  13. "data5": 5,
  14. "data6": 6,
  15. "data7": 7,
  16. "data8": 8,
  17. "data9": 9,
  18. "data10": 10
  19. }
  20. ]
  21. }
Request
func Function code 50
wtrm A water mark that copied to the response message
srcn Object Name with prefix and suffix
Response
func Function code 50
wtrm A water mark that copied from the request message
errc Error code
tele Telemetry Array
objn Object Name
tstp TimeStamp

Function 51 Write Register

HTTP API Header

(POST)

Resource Path: /api/v1/funcno51

Content-Type: application/json

Authorization: Bearer

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

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

Response body syntax

  1. {
  2. "func": 51,
  3. "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  4. "errc": 0
  5. }
Request
func Function code 51
wtrm A water mark that copied to the response message
srcn Object Name with prefix and suffix
attn Attribute Name
valn Value
Response
func Function code 51
wtrm A water mark that copied from the request message
errc Compiler error code

Function 60 Object Screen

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno60

Content-Type: application/json

Authorization: Bearer

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

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

Response body syntax

  1. {
  2. "func": 60,
  3. "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  4. "errc": 0,
  5. "tele": [
  6. {
  7. "objn": "Tank_1",
  8. "logs": 0,
  9. "temperature": 0,
  10. "energy": 0,
  11. "switch": 1,
  12. "buzzer": 1
  13. },
  14. {
  15. "objn": "Tank_2",
  16. "logs": 0,
  17. "temperature": 0,
  18. "energy": 0,
  19. "switch": 1,
  20. "buzzer": 1
  21. },
  22. {
  23. "objn": "Tank_3",
  24. "logs": 0,
  25. "temperature": 0,
  26. "energy": 0,
  27. "switch": 1,
  28. "buzzer": 1
  29. },
  30. {
  31. "objn": "Temp",
  32. "logs": 1,
  33. "high": 1,
  34. "temp1": 0,
  35. "temp2": 0,
  36. "temp3": 0,
  37. "low": 1
  38. },
  39. {
  40. "objn": "Energy",
  41. "logs": 1,
  42. "energy1": 0,
  43. "energy2": 0,
  44. "energy3": 0
  45. }
  46. ]
  47. }
Request
func Function code 60
wtrm A water mark that copied to the response message
Response
func Function code 60
wtrm A water mark that copied from the request message
errc Error code
tele Telemetry object screen description
objn Object name
logs Logging (Y/N)

Function 61 System Status

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno61

Content-Type: application/json

Authorization: Bearer

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

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

Response body syntax

  1. {
  2. "func": 61,
  3. "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  4. "errc": 0,
  5. "tstp": 1581515618,
  6. "comm": "UP",
  7. "mach": "MANU",
  8. "mode": "ACTIVE",
  9. "mqcn": "MQCONNECT",
  10. "dalm": "NON-EXIST",
  11. "galm": "UNACKNOWLEDGE",
  12. "ngal": 4,
  13. "grow": [
  14. {
  15. "acat": "alarm",
  16. "astt": "OFF",
  17. "amod": "UNACKALARM",
  18. "atim": 1581513580,
  19. "alid": 1,
  20. "comt": "temp1@Temp (812) < low@Temp (800)"
  21. },
  22. {
  23. "acat": "alarm",
  24. "astt": "ON",
  25. "amod": "UNACKALARM",
  26. "atim": 1581515415,
  27. "alid": 3,
  28. "comt": "temp2@Temp (791) < low@Temp (800)"
  29. },
  30. {
  31. "acat": "critical",
  32. "astt": "ON",
  33. "amod": "UNACKALARM",
  34. "atim": 1581515415,
  35. "alid": 4,
  36. "comt": "temp3@Temp (864) > high@Temp (850)"
  37. },
  38. {
  39. "acat": "alarm",
  40. "astt": "OFF",
  41. "amod": "UNACKALARM",
  42. "atim": 1581513592,
  43. "alid": 5,
  44. "comt": "temp3@Temp (864) < low@Temp (800)"
  45. }
  46. ]
  47. }
Request
func Function code 61
wtrm A water mark that copied to the response message
actn Action 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
func Function code 61
wtrm A water mark that copied from the request message
errc Error code
tstp TimeStamp
comm PLC or hardware communication status
UP
DOWN
mach Machine Mode
AUTO
MANU
SERV
mode Please refer to Status Mode section.
Inactive Mode
Standby Mode / Semi-Standby Mode
Active Mode / Semi-Active Mode
mqcn MQ broker connection status
MQCONNECT
MQDISCONNECT
dalm Device Alarm which specify which device has
communication problem.
ndal Number of device alarms
drow Device alarm rows
chnl Channel number of devices
addr Address of devices
galm General Alarm which user define their own alarms and
triggers
ngal Number of general alarms
grow General alarm rows
acat Alarm Category
critical
alarm
warning
event
view
astt Alarm Status
ON
OFF
amod Alarm Mode
UNACKALARM
DISABLE
atim Alarm TimeStamp
alid Alarm ID
must be copied this ID when user acknowledge function 80
comt Alarm Comments

Function 62 Ping

HTTP API Header

(GET)

Resource Path: /api/v1/funcno62

Content-Type: application/json

Authorization: Bearer

Function 70 Gateway Control

HTTP API header

(POST)

Resource Path: /api/v1/funcno70

Content-Type: application/json

Authorization: Bearer

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

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

Response body syntax

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

Function 71 Status Control

HTTP API Header

(POST)

Resource Path: /api/v1/funcno71

Content-Type: application/json

Authorization: Bearer

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

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

Response body syntax

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

Function 73 Instance Information

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno73

Content-Type: application/json

Authorization: Bearer

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

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

Response body syntax

  1. {
  2. "func": 73,
  3. "wtrm": "DEMO-Neuron-1001_1532419775357_240",
  4. "errc": 0,
  5. "agts": [
  6. {
  7. "uuid": "16538d28-4592-11e9-a787-00e067109f12",
  8. "time": "2019/11/10 13:42:17",
  9. "expd": "2070/01/01 08:00:00",
  10. "rest": "00:00:00:00",
  11. "data": "2.113112",
  12. "natt": "34",
  13. "nalr": "10",
  14. "tatt": "50",
  15. "talr": "102",
  16. "tusg": "10.3426",
  17. "matt": "100",
  18. "malr": "500",
  19. "musg": "1000",
  20. "self": "Y"
  21. },
  22. {
  23. "uuid": "87244d28-4592-11e9-a787-00e097109f12",
  24. "time": "2019/11/10 13:42:17",
  25. "expd": "2070/01/01 08:00:00",
  26. "rest": "00:00:00:00",
  27. "data": "0.1276532",
  28. "natt": "19",
  29. "nalr": "13",
  30. "tatt": "50",
  31. "talr": "102",
  32. "tusg": "10.3426",
  33. "matt": "100",
  34. "malr": "500",
  35. "musg": "1000",
  36. "self": "N"
  37. },
  38. {
  39. "uuid": "11133d28-4592-11e9-a787-00e077109f12",
  40. "time": "2019/11/10 13:42:17",
  41. "expd": "2070/01/01 08:00:00",
  42. "rest": "00:00:00:00",
  43. "data": "1.2367209",
  44. "natt": "21",
  45. "nalr": "8",
  46. "tatt": "50",
  47. "talr": "102",
  48. "tusg": "10.3426",
  49. "matt": "100",
  50. "malr": "500",
  51. "musg": "1000",
  52. "self": "N"
  53. }
  54. ]
  55. }
Request
func Function code 73
wtrm A water mark that copied to the response message
Response
func Function code 73
wtrm A water mark that copied from the request message
errc Compiler error code
nagt Number of instances
agts Neuron instance list
uuid UUID
time Last information update time
expd System expired date
rest Time left for the system inactive
data Data usage
natt No of attributes
nalr No of alarm points
tatt Total no. of attributes
talr Total no. of alarm points
tusg Total data usage amount
matt Maximum no. of attributes
malr Maximum no. of alarm points
musg Maximum data usage amount
self Self Flag (Y/N)

Function 74 About Information

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno74

Content-Type: application/json

Authorization: Bearer

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

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

Response body syntax

  1. {
  2. "func": 74,
  3. "wtrm": "DEMO-Neuron-1001_1532419775357_240",
  4. "errc": 0,
  5. "sysn": "NEURON SYSTEM v1.1.1",
  6. "cpyr": "Copyright (C) 2020, EMQ Technologies Co., Ltd. All rights</br>reserved.",
  7. "modl": "ENT-x86_64-1-0101",
  8. "srno": "SN010101200227",
  9. "bver": " 1.1.1",
  10. "pver": 1,
  11. "host": "Instance 0",
  12. "expd": "2020/12/30 11:59:00",
  13. "rest": "306:23:03:07",
  14. "tatt": 2,
  15. "matt": 10000,
  16. "talr": 2,
  17. "malr": 1600,
  18. "tusg": 0.00010799,
  19. "musg": 100000000,
  20. "cont": "Joey Cheung (joey@emqx.io)",
  21. "uuid": "16538d28-4592-11e9-a787-00e067109f12"
  22. }
Request
func Function code 74
wtrm A water mark that copied to the response message
Response
func Function code 74
wtrm A water mark that copied from the request message
errc Compiler error code
sysn System Name
cpyr Copyright message
modl System model number
modl System serial number
srno Serial no
bver Software build version
pver Protocol number
host Hostname
expd Expired date
rest Remaining available time
tatt Total no. of attributes in use
matt Max no. of attributes allowed
talr Total no. of alarms in use
malr Max no. of alarms allowed
tusg Total data usage
tusg Max data usage
cont Contact information
uuid UUID

Function 79 Show Alarms

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno79

Content-Type: application/json

Authorization: Bearer

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

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

Response body syntax

  1. {
  2. "func": 79,
  3. "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  4. "errc": 0
  5. }
Request
func Function code 79
wtrm A water mark that copied to the response message
actn Action 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
func Function code 79
wtrm A water mark that copied from the request message
errc Compiler error code

Function 80 Alarm Acknowledge

HTTP API Header

(POST)

Resource Path: /api/v1/funcno80

Content-Type: application/json

Authorization: Bearer

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

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

Response body syntax

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

Function 81 Read Historical Alarm

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno81

Content-Type: application/json

Authorization: Bearer

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

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

Response body syntax

  1. {
  2. "func": 81,
  3. "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  4. "errc": 0,
  5. "frti": 1577930400,
  6. "toti": 1582552859,
  7. "nalm": 10,
  8. "ordr": "ascending",
  9. "rows": [
  10. {
  11. "anum": 1,
  12. "tstp": 1581482963,
  13. "uack": "",
  14. "cate": "alarm",
  15. "stat": "on",
  16. "comt": "temp2@Temp (791) < low@Temp (800)"
  17. },
  18. {
  19. "anum": 2,
  20. "tstp": 1581484493,
  21. "uack": "",
  22. "cate": "alarm",
  23. "stat": "off",
  24. "comt": "temp2@Temp (0) < low@Temp (0)"
  25. },
  26. {
  27. "anum": 3,
  28. "tstp": 1581485070,
  29. "uack": "",
  30. "cate": "alarm",
  31. "stat": "ack",
  32. "comt": "temp2@Temp (791) < low@Temp (790)"
  33. },
  34. {
  35. "anum": 4,
  36. "tstp": 1581513521,
  37. "uack": "",
  38. "cate": "alarm",
  39. "stat": "on",
  40. "comt": "temp1@Temp (0) < low@Temp (790)"
  41. },
  42. {
  43. "anum": 5,
  44. "tstp": 1581513521,
  45. "uack": "",
  46. "cate": "alarm",
  47. "stat": "on",
  48. "comt": "temp2@Temp (0) < low@Temp (790)"
  49. },
  50. {
  51. "anum": 6,
  52. "tstp": 1581513521,
  53. "uack": "",
  54. "cate": "alarm",
  55. "stat": "on",
  56. "comt": "temp3@Temp (0) < low@Temp (790)"
  57. },
  58. {
  59. "anum": 7,
  60. "tstp": 1581513580,
  61. "uack": "",
  62. "cate": "alarm",
  63. "stat": "off",
  64. "comt": "temp1@Temp (0) < low@Temp (0)"
  65. },
  66. {
  67. "anum": 8,
  68. "tstp": 1581513584,
  69. "uack": "",
  70. "cate": "alarm",
  71. "stat": "off",
  72. "comt": "temp2@Temp (0) < low@Temp (0)"
  73. },
  74. {
  75. "anum": 9,
  76. "tstp": 1581513592,
  77. "uack": "",
  78. "cate": "alarm",
  79. "stat": "off",
  80. "comt": "temp3@Temp (0) < low@Temp (0)"
  81. },
  82. {
  83. "anum": 10,
  84. "tstp": 1581515415,
  85. "uack": "",
  86. "cate": "alarm",
  87. "stat": "on",
  88. "comt": "temp2@Temp (791) < low@Temp (800)"
  89. }
  90. ],
  91. "tokn": "5e44029700000003"
  92. }
Request
func Function code 81
wtrm A string that copied to the response message
srch Search Method
FromFirst — means forwards
FromLast — means backwards
UseID — use for consecutive search
Blank — means use FromYear
sett Today
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
tokn ID string from previous request for next search. (only
together with UseID above)
ofst Offset for next search. positive or negative, only
together with UseID above, still using the search
pattern below
frti From Datetime (timestamp)
toti To Datetime (timestamp)
cate Alarm Category
patn Search Pattern - check matching string anywhere in the
alarm text.
Response
func Function code 81
wtrm A string that copied from the request message
errc Compiler error code
frti From Datetime (timestamp)
toti To Datetime (timestamp)
nalm Total number of alarms found
ordr Order
ascending
descending
anum Alarm index number
tstp Alarm happening time
uack User who acknowledge this alarm
cate Alarm Category
stat Status
on — alarm on time
off — alarm off time
ack — alarm ack time
comt Alarm message
tokn ID string for next search

Function 82 Read Historical Trend

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno82

Content-Type: application/json

Authorization: Bearer

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

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

Response body syntax

  1. {
  2. "func": 82,
  3. "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  4. "errc": 0,
  5. "frti": 1632978564,
  6. "toti": 1632982164,
  7. "npts": 500,
  8. "itvl": 1,
  9. "tokn": 500,
  10. "ntps": 500,
  11. "tele": [
  12. {
  13. "objn": "test",
  14. "tstp": 1632980285,
  15. "t": 1
  16. },
  17. {
  18. "objn": "test",
  19. "tstp": 1632980286,
  20. "t": 1
  21. },
  22. {
  23. "objn": "test",
  24. "tstp": 1632980287,
  25. "t": 1
  26. }
  27. ]
  28. }
Request
func Function code 82
wtrm A water mark that copied to the response message
srcn Object name with prefix and suffix
attn Attribute name (empty means all attributes)
fend Include the last point
1 — include
0 — not include
tokn File index number for next search
frti From Datetime (timestamp)
toti To Datetime (timestamp)
Response
func Function code 82
wtrm A water mark that copied from the request message
errc Compiler error code
frti From Datetime (timestamp)
toti To Datetime (timestamp)
itvl Time Interval between trend points
npts Number of trend points found
tokn Token to implement next search
tele Telemetry array
objn Object name
tstp TimeStamp

Function 83 Read Log

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno83

Content-Type: application/json

Authorization: Bearer

HTTP API or Websockets or MQTT Communication

Request body syntax

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

Response body syntax

  1. {
  2. "func": 83,
  3. "wtrm": "DEMO-Neuron-1001_1532419775357_240",
  4. "nrow": 500,
  5. "rows": [
  6. {
  7. "tstp": 1532419775,
  8. "logl": "warning",
  9. "proc": "CORE",
  10. "data": "extractlicense: loading certificate into memory"
  11. },
  12. {
  13. "tstp": 1532419775,
  14. "logl": "debug",
  15. "proc": "DRVR",
  16. "data": "debuglog: Cannot connect"
  17. },
  18. {
  19. "tstp": 1532419775,
  20. "logl": "err",
  21. "proc": "SERV",
  22. "data": "serverdisconnect: send disconnection request failed return code -3"
  23. },
  24. {
  25. "tstp": 1532419775,
  26. "logl": "warning",
  27. "proc": "CORE",
  28. "data": "update_process: process /home/neuron/ /bin/neuron_o_mbstcp was killed by uncaught signal 9 "
  29. }
  30. ],
  31. "last": 400,
  32. "errc": 0
  33. }
Request
func Function code 83
wtrm A water mark that copied to the response message
logl Log level,
allow text :
all,
debug,
info,
warning,
err
srtt Sart timestamp(s), default none
stpt End timestamp(s), default none, must with a nonempty
“srtt” if set value for “stpt”
srtl Start line number of the log file, also can be got from
“last” of response message,default 0
proc Process name
Response
func Function code 83
wtrm A water mark that copied from the request message
nrow Number of rows, <= 500
rows Rows of Log content, json array
tstp log timestamp (s)
logl Log level
proc Process name
data Log string data
last Last line number , useful for “strl” of request message
errc Compiler error code

Function 84 Log Switch

Websockets or MQTT Communication

Request body syntax

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

Response body syntax

  1. {
  2. "func": 84,
  3. "wtrm": "DEMO-Neuron-1002_1532419775357_240",
  4. "errc": 0
  5. }
Request
func Function code 84
wtrm A water mark that copied to the response message
logn Log name:
SCRIPTLOG
DRIVERLOG
SERVICELOG
vars Variable for maximum of log lines can be reported
Response
func Function code 84
wtrm A water mark that copied from the request message
errc Compiler error code

Function 93 Read Attribute

HTTP API Header

(PUT)

Resource Path: /api/v1/funcno93

Content-Type: application/json

Authorization: Bearer

HTTP status code Description
200 Successful operation
400 Invalid Operation

HTTP API or Websockets or MQTT Communication

Request body syntax

  1. {
  2. "func": 93,
  3. "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  4. "srcn": "object1",
  5. "attn": "data1"
  6. }

Response body syntax

  1. {
  2. "func": 93,
  3. "wtrm": "DEMO-Neuron-1001_1532421778827_1",
  4. "erroc": 0,
  5. "tele": [
  6. {
  7. "objn": "object1",
  8. "tstp": 1643177359,
  9. "data1": 0
  10. }
  11. ]
  12. }
Request
func Function code 93
wtrm A water mark that copied to the response message
srcn Object Name with prefix and suffix
Response
func Function code 93
wtrm A water mark that copied from the request message
errc Error code
tele Telemetry Array
objn Object Name
tstp TimeStamp

File Update HTTP API only

(POST)

Resource Path: /api/v1/{NAME}

Content-Type: multipart/form-data

Authorization: Bearer

NAME Description
license neuron license file
logo neuron dashboard logo file
HTTP status code Description
200 Successful operation
400 Invalid 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

  1. {
  2. "func": 14,
  3. "wtrm": "DEMO-Neuron-1001_1532419203896_239",
  4. "errc": 1001,
  5. "emsg": " Statement expected for this row "
  6. }
Response Compiler Error
func Function code
wtrm A string that copied from the request message
errc Compiler error code
emsg Error 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”