Skip to main content
Version: 2.2.0

Core (2.2.0)

Download OpenAPI specification:Download

Authentication

bearerAuth

Security Scheme Type HTTP
HTTP Authorization Scheme bearer
Bearer format "JWT"

systems

Export configurations

Authorizations:
query Parameters
action
required
string
Default: "download"
Enum: "download" "get-profile"

action to be executed

encryption
boolean
Default: true

Use password to encryption (default:true)

password
string

If encryption is true, use this field as password (default:serial number), which should contain a number and a special char. For example, the query parameter will be like ?action=download&encryption=true&password=1234567*

select
any <string>
Example: select=[{"app":"modbusmaster"},{"app":"cloud"}]

select configurations by profiles. If no value is given, it will select all.

filter
any <string>
Example: filter=[{"labels":["credential"]},{"labels":["network"]}]

filter configurations by profiles. It will do select first, then do filter.

Responses

Response samples

Content type
{
  • "count": 21,
  • "data": [
    ]
}

Upload configurations

Authorizations:
Request Body schema: multipart/form-data
apply
boolean
Default: false

Apply configuration and will check if model name or version has conflict.

encryption
boolean
Default: true

Use password to encryption (default:true)

file
string <binary>

configuration file

password
string

password (default:serial number)

Responses

Response samples

Content type
application/json
Example
{
  • "data": {
    }
}

Apply configuration

Apply configuration that uploaded by PUT /system/configuration. After applying configuration, system will be rebooted in 5 seconds.

Authorizations:
path Parameters
filename
required
string

The filename value returned in the response the filename in PUT /system/configuration.

Responses

Response samples

Content type
application/json
{
  • "data": {
    }
}

Get discovery service status

Authorizations:

Responses

Response samples

Content type
application/json
{
  • "data": {
    }
}

Set discovery service configuration

Authorizations:
Request Body schema: application/json
enable
boolean

enable discovery service

Responses

Request samples

Content type
application/json
{
  • "enable": true
}

Response samples

Content type
application/json
{
  • "data": {
    }
}

Get httpserver configuration

Authorizations:

Responses

Response samples

Content type
application/json
{
  • "data": {
    }
}

Set httpserver configuration partially

Authorizations:
Request Body schema: application/json
cert
string

(JSON only) certificate content

certFile
string <binary>

(form-data only) certificate for https. The suffix of filename must be one of .crt, .cer or .pem with PEM format which the content starts with ----- BEGIN CERTIFICATE -----

certFilename
string

(JSON only) filename of client authentication certificate

httpEnable
boolean
httpPort
integer

listen port for http

httpsEnable
boolean
httpsPort
integer

listen port for https

key
string

(JSON only) key content

keyFile
string <binary>

(form-data only) key for https. The suffix of filename must be one of .key, .pk or .pem with PEM format which the content starts with ----- BEGIN RSA PRIVATE KEY -----

keyFilename
string

(JSON only) filename of client authentication key

Responses

Request samples

Content type
application/json
{
  • "cert": "string",
  • "certFile": "string",
  • "certFilename": "string",
  • "httpEnable": true,
  • "httpPort": 0,
  • "httpsEnable": true,
  • "httpsPort": 0,
  • "key": "string",
  • "keyFile": "string",
  • "keyFilename": "string"
}

Response samples

Content type
application/json
{
  • "data": {
    }
}

Set httpserver configuration

Authorizations:
Request Body schema: multipart/form-data
cert
string

(JSON only) certificate content

certFile
string <binary>

(form-data only) certificate for https. The suffix of filename must be one of .crt, .cer or .pem with PEM format which the content starts with ----- BEGIN CERTIFICATE -----

certFilename
string

(JSON only) filename of client authentication certificate

httpEnable
boolean
httpPort
integer

listen port for http

httpsEnable
boolean
httpsPort
integer

listen port for https

key
string

(JSON only) key content

keyFile
string <binary>

(form-data only) key for https. The suffix of filename must be one of .key, .pk or .pem with PEM format which the content starts with ----- BEGIN RSA PRIVATE KEY -----

keyFilename
string

(JSON only) filename of client authentication key

Responses

Response samples

Content type
application/json
{
  • "data": {
    }
}

Get provisioning service status

Authorizations:

Responses

Response samples

Content type
application/json
{
  • "data": {
    }
}

Set provisioning service configuration

Authorizations:
Request Body schema: application/json
enable
boolean

enable provisioning function

object

Responses

Request samples

Content type
application/json
{
  • "enable": true,
  • "schedule": {
    }
}

Response samples

Content type
application/json
{
  • "data": {
    }
}

Get configuration or download log

Authorizations:
query Parameters
download
boolean

Indicate to download log as zip file. Value is always true.

Responses

Response samples

Content type
{
  • "data": {
    }
}

Set log configuration

Authorizations:
Request Body schema: application/json
desiredDiskCacheSizeMB
string
disk
any

refer to API /device/general

enable
boolean
enableTimeToLiveSec
boolean
targetDiskName
string
timeToLiveSec
integer

unlimit if value <= 0

Responses

Request samples

Content type
application/json
{
  • "desiredDiskCacheSizeMB": 100,
  • "enable": true,
  • "enableTimeToLiveSec": false,
  • "targetDiskName": "System",
  • "timeToLiveSec": 7200
}

Response samples

Content type
{
  • "data": {
    }
}

Get reboot configuration

Authorizations:

Responses

Response samples

Content type
application/json
{
  • "data": {
    }
}

Reboot system

Authorizations:
Request Body schema: application/json
at
string

the format can be a fixed string "now", datetime in RFC3339, or crontab (https://linux.die.net/man/5/crontab)

enableScheduler
boolean
now
boolean

reboot immediately

Responses

Request samples

Content type
application/json
Example
{
  • "now": true
}

Response samples

Content type
application/json
{
  • "data": {
    }
}

get reset system capabilities

Authorizations:

Responses

Response samples

Content type
application/json
{
  • "data": {
    }
}

reset system to default configuration

Authorizations:
query Parameters
mode
string
Default: "system"
Enum: "factory" "system"
sync
boolean
Default: false

If true, do reset immediately, else wait 3 seconds

scopes
Array of strings
Items Enum: "all" "account" "appdata" "discovery" "eventlog" "httpserver" "job" "journald" "keep-network-setting" "provision" "reboot" "sshserver" "serialconsole" "upgrade"

reset scope

Responses

Get serial console status

Authorizations:

Responses

Response samples

Content type
application/json
{
  • "data": {
    }
}

Set serial console configuration

Authorizations:
Request Body schema: application/json
enable
boolean

enable serial console

Responses

Request samples

Content type
application/json
{
  • "enable": true
}

Response samples

Content type
application/json
{
  • "data": {
    }
}

Get system services

Authorizations:

Responses

Response samples

Content type
application/json
{
  • "data": {
    }
}

Disable system service

Authorizations:
path Parameters
id
required
string
Enum: "dhcpserver1" "dhcpserver2" "httpservice" "httpsservice" "sshserver" "localconsole" "lan1" "lan2" "cloud" "modbusmaster" "eipscanner" "opcuaserver" "sdcard" "ntp" "eventlog" "syslog" "wifi" "cellular" "provision" "provisionschedule"

service name

Responses

Response samples

Content type
application/json
{
  • "data": {
    }
}

Enable system service

enable system services including Web GUI edge-web, DHCP Server dhcpserverX, Discovery discovery, HTTP service httpservice and so on.

Authorizations:
path Parameters
id
required
string
Enum: "dhcpserver1" "dhcpserver2" "httpservice" "httpsservice" "sshserver" "localconsole" "lan1" "lan2" "cloud" "modbusmaster" "eipscanner" "opcuaserver" "sdcard" "ntp" "eventlog" "syslog" "wifi" "cellular" "provision" "provisionschedule"

service name

Responses

Response samples

Content type
application/json
{
  • "data": {
    }
}

Get SSH configuration

Authorizations:

Responses

Response samples

Content type
application/json
{
  • "data": {
    }
}

Set SSH configuration

Authorizations:
Request Body schema: application/json
enable
boolean

enable SSH

port
integer

port to listen

Responses

Request samples

Content type
application/json
{
  • "enable": true,
  • "port": 22
}

Response samples

Content type
application/json
{
  • "data": {
    }
}

users

Query permissions

Authorizations:

Responses

Response samples

Content type
application/json
{
  • "count": 2,
  • "data": [
    ]
}

Query roles

Authorizations:

Responses

Response samples

Content type
application/json
{
  • "count": 1,
  • "data": [
    ]
}

create a role

Authorizations:
Request Body schema: application/json
description
string
name
required
string
permissions
required
Array of strings

Responses

Request samples

Content type
application/json
{
  • "description": "",
  • "name": "myrole",
  • "permissions": [
    ]
}

Response samples

Content type
application/json
{
  • "data": {
    }
}

Delete role by ID

Authorizations:
path Parameters
id
required
integer

ID of role

Responses

get role by ID

Authorizations:
path Parameters
id
required
integer

ID of role

Responses

Response samples

Content type
application/json
{
  • "data": {
    }
}

update role by ID

Authorizations:
path Parameters
id
required
integer

ID of role

Request Body schema: application/json
description
string
name
required
string
permissions
required
Array of strings

Responses

Request samples

Content type
application/json
{
  • "description": "",
  • "name": "myrole",
  • "permissions": [
    ]
}

Response samples

Content type
application/json
{
  • "data": {
    }
}

Query users

Authorizations:

Responses

Response samples

Content type
application/json
{
  • "count": 1,
  • "data": [
    ]
}

Add user

Authorizations:
Request Body schema: application/json
email
string
expiredAfter
required
string <date-time>
isActive
required
boolean
name
required
string
password
required
string

at least 6 characters

roles
required
Array of integers[ items ]

Responses

Request samples

Content type
application/json
{
  • "expiredAfter": "2023-01-31T16:00:00.000Z",
  • "isActive": true,
  • "name": "myuser",
  • "password": "moxa1234",
  • "roles": [
    ]
}

Response samples

Content type
application/json
{
  • "data": {
    }
}

Delete user by ID

Authorizations:
path Parameters
id
required
integer

ID of user

Responses

Query user by ID

Authorizations:
path Parameters
id
required
integer

ID of user

Responses

Response samples

Content type
application/json
{
  • "data": {
    }
}

Update user by ID

Authorizations:
path Parameters
id
required
integer

ID of user

Request Body schema: application/json
email
string
expiredAfter
string <date-time>
isActive
boolean
roles
Array of integers[ items ]

Responses

Request samples

Content type
application/json
{
  • "email": "aa@aaa.aaa",
  • "expiredAfter": null,
  • "isActive": true,
  • "roles": [
    ]
}

Response samples

Content type
application/json
{
  • "data": {
    }
}

Update user's password by ID

Authorizations:
path Parameters
id
required
integer

ID of user

Request Body schema: application/json
newPassword
string
oldPassword
string

user with admin role do not need pass oldPassword

Responses

Request samples

Content type
application/json
{
  • "newPassword": "123456"
}

Response samples

Content type
application/json
{
  • "data": {
    }
}

Query who I am

Authorizations:

Responses

Response samples

Content type
application/json
{
  • "data": {
    }
}

Update current user's information

Authorizations:
Request Body schema: application/json
email
string
expiredAfter
string
isActive
boolean
roles
Array of integers[ items ]

Responses

Request samples

Content type
application/json
{
  • "email": "aa@aaa.aaa",
  • "expiredAfter": "2023-01-31T16:00:00.000Z",
  • "isActive": true,
  • "roles": [
    ]
}

Response samples

Content type
application/json
{
  • "data": {
    }
}

Update current user's password

Authorizations:
Request Body schema: application/json
newPassword
string
oldPassword
string

user with admin role do not need pass oldPassword

Responses

Request samples

Content type
application/json
{
  • "newPassword": "123456",
  • "oldPassword": "moxa1234"
}

Response samples

Content type
application/json
{
  • "data": {
    }
}

authentication

Get authentication status

This API returns wether authentication token in header is valid by HTTP status code

Authorizations:

Responses

Response samples

Content type
application/json
{
  • "data": "ok"
}

Sign in

Request Body schema: application/json
name
required
string
password
required
string

Responses

Request samples

Content type
application/json
{
  • "name": "admin",
  • "password": "moxa1234"
}

Response samples

Content type
application/json
{
  • "data": {
    }
}

Get websocket token

The token one-shot authentication for websocket only and valid in 30 seconds

Authorizations:

Responses

Response samples

Content type
application/json
{
  • "data": {
    }
}

event

Clear event logs

Authorizations:

Responses

Get events

Authorizations:
query Parameters
limit
integer

Limit the number of result (default:100).

offset
integer

Log starting from the offset (default:0).

order
string
Enum: "time" "category" "eventName"

Order by key (default:time).

sort
string
Enum: "asc" "desc"

sorting (default:desc).

categories
string

Match by category which keywords seperated by comma(,)

eventNames
string

Matcy by event name which keywords seperated by comma(,)

severities
string

Filter out by severity which keywords seperated by comma(,)

origins
Array of strings

Get the specified service of logs.

event
boolean

Enable server-sent event (Value is always true if having this field).

download
boolean

Download event as zip file (Value is always true if having this field).

Responses

Response samples

Content type
{
  • "count": 2,
  • "data": [
    ],
  • "limit": 2,
  • "offset": 0,
  • "total": 14154
}

Create log

Authorizations:
Request Body schema: application/json
category
required
string

Event category

createdAt
string

Event time in RFC3339 format (default:now).

event
required
string

Event message

message
string

Event message in detail

origin
required
string

Which service/APP publish the event

severity
string
Enum: "alert" "warning" "info"

Event severity (default:info).

user
string

Username who trigger the event

userOrigin
string

User comes from. It's normally an IP address.

Responses

Request samples

Content type
application/json
{
  • "category": "system",
  • "event": "software installation completed",
  • "message": "Installation completed. Job id: 1, software name: update-123",
  • "origin": "system",
  • "severity": "info"
}

Response samples

Content type
application/json
{
  • "data": "ok"
}

Get configuration of events

Authorizations:

Responses

Response samples

Content type
application/json
{
  • "data": {
    }
}

Set event configuration

Authorizations:
Request Body schema: application/json
desiredDiskCacheSizeMB
string
enable
boolean
enableTimeToLiveSec
boolean
reachThresholdPolicy
string
Enum: "rotate" "stop"

default to rotate

timeToLiveSec
integer

unlimit if value <= 0

Responses

Request samples

Content type
application/json
{
  • "desiredDiskCacheSizeMB": 2,
  • "enable": true,
  • "enableTimeToLiveSec": true,
  • "reachThresholdPolicy": "rotate",
  • "targetDiskName": "System",
  • "timeToLiveSec": 86400
}

Response samples

Content type
application/json
{
  • "data": {
    }
}

Event profile

Authorizations:

Responses

Response samples

Content type
application/json
{
  • "data": {
    }
}

Switch event enablement

Authorizations:
Request Body schema: application/json
any

Responses

Request samples

Content type
application/json
Example
{
  • "events": [
    ]
}

Response samples

Content type
application/json
{
  • "data": {
    }
}

apps

Return all APPs

Authorizations:

Responses

Response samples

Content type
application/json
{
  • "count": 5,
  • "data": [
    ]
}

Find APP by name

Authorizations:
path Parameters
appname
required
string

name of APP

Responses

Response samples

Content type
application/json
{
  • "data": {
    }
}

Operate an APP

Authorizations:
path Parameters
appname
required
string

name of APP

action
required
string
Enum: "start" "stop" "install" "uninstall" "restart"

Responses

Response samples

Content type
application/json
{
  • "data": {
    }
}

job

Get jobs

Authorizations:

Responses

Response samples

Content type
application/json
{
  • "count": 1,
  • "data": [
    ]
}

upgrade

Get upgrade configuration

Authorizations:

Responses

Response samples

Content type
application/json
{
  • "data": {
    }
}

Set upgrade configuration partially

Authorizations:
Request Body schema: application/json
allowOverCellular
boolean

allow upgrade over the cellular

disks
Array of objects[ items ]

disk list

enableClientAuth
boolean

use cert and key as X.509 client authentication

enableSnapshot
boolean

do snapshot during upgrade. If the device doesn’t support snapshot feature (isSnapshotSupported), the request will be rejected with an error.

isSnapshotSupported
boolean

whether supports snapshot

retryCount
integer

maximum re-try count to download upgrade package. 0 means unlimited.

retryInterval
integer

re-try interval in seconds to download upgrade package.

targetDiskName
string

disk partition name to store upgrade file

Responses

Request samples

Content type
application/json
{
  • "allowOverCellular": true,
  • "disks": [
    ],
  • "enableClientAuth": true,
  • "enableSnapshot": true,
  • "isSnapshotSupported": true,
  • "retryCount": 0,
  • "retryInterval": 0,
  • "targetDiskName": "string"
}

Response samples

Content type
application/json
{
  • "data": {
    }
}

Set upgrade configuration

Authorizations:
Request Body schema:
allowOverCellular
boolean

allow upgrade over the cellular

ca
string

CA content

caFilename
string

filename of CA

cert
string

certificate content

certFilename
string

filename of client authentication certificate

disks
Array of objects[ items ]

disk list

enableClientAuth
boolean

use cert and key as X.509 client authentication

enableSnapshot
boolean

do snapshot during upgrade. If the device doesn’t support snapshot feature (isSnapshotSupported), the request will be rejected with an error.

isSnapshotSupported
boolean

whether supports snapshot

key
string

key content

keyFilename
string

filename of client authentication key

retryCount
integer

maximum re-try count to download upgrade package. 0 means unlimited.

retryInterval
integer

re-try interval in seconds to download upgrade package.

targetDiskName
string

partition to store upgrade file

Responses

Request samples

Content type
{
  • "allowOverCellular": true,
  • "ca": "xxxxxx",
  • "caFilename": "ca.crt",
  • "cert": "xxxxxxx",
  • "certFilename": "a.crt",
  • "enableClientAuth": true,
  • "enableSnapshot": true,
  • "key": "xxxxx",
  • "keyFilename": "a.key",
  • "retryCount": 3,
  • "retryInterval": 0,
  • "targetDiskName": "System"
}

Response samples

Content type
application/json
{
  • "data": {
    }
}

Retrieve all upgrade jobs

Authorizations:

Responses

Response samples

Content type
application/json
{
  • "count": 2,
  • "data": [
    ]
}

Create upgrade job

Authorizations:
Request Body schema:
object

Run the job periodically

deleteFileAfterInstallComplete
boolean

Delete installation file after upgrade completed (default:true)

download
boolean

Indicate to request download

file
string

(form-data) file for Debian package

id
integer

Upgrade ID

install
boolean

Indicate to request install

snapshot
boolean

Do snapshot when installation. If not set, it will apply by default configuration of /system/upgrade.

url
string

URL to download

Responses

Request samples

Content type
Example

Response samples

Content type
application/json
{
  • "data": {
    }
}

Delete upgrade job

Authorizations:
path Parameters
id
required
integer

ID of upgrade job

Responses

Find upgrade job by ID

Authorizations:
path Parameters
id
required
integer

ID of upgrade job

Responses

Response samples

Content type
application/json
Example
{
  • "data": {
    }
}

Operate the upgrade

Authorizations:
path Parameters
id
required
integer

id of upgrade pack

action
required
string
Enum: "start" "cancel" "suspend" "resume"

id of upgrade pack

deleteFileAfterInstallComplete
required
boolean

Delete upgrade file after upgrade completed (default:true)

Responses

Response samples

Content type
application/json
{
  • "data": {
    }
}