NeuronEX-swagger-zh (3.3.0)

Download OpenAPI specification:Download

NeuronEX

server

Login

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

Responses

Request samples

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

Response samples

Content type
application/json
{
  • "token": "eyJhbGciOiJ....",
  • "role": "Administrator"
}

Change password

path Parameters
name
required
string
query Parameters
name
required
string
Example: name=test

username to be deleted

Request Body schema: application/json
name
required
string
new_password
required
string
old_password
required
string

Responses

Request samples

Content type
application/json
{
  • "name": "test",
  • "old_password": "0000",
  • "new_password": "1111"
}

Response samples

Content type
application/json
{ }

Creat New User

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

Responses

Request samples

Content type
application/json
{
  • "name": "test",
  • "password": "test",
  • "role": "Viewer",
  • "description": "create new user test and set him to viewer"
}

Response samples

Content type
application/json
{ }

Change role

path Parameters
name
required
string
query Parameters
name
required
string
Example: name=test

username to be deleted

Request Body schema: application/json
name
required
string
description
string
role
required
string

Responses

Request samples

Content type
application/json
{
  • "name": "test",
  • "role": "Viewer",
  • "description": "change user test's role to viewer"
}

Response samples

Content type
application/json
{ }

Delete User

path Parameters
name
required
string
query Parameters
name
required
string
Example: name=test

username to be deleted

Responses

Response samples

Content type
application/json
{ }

Get system information

Responses

Response samples

Content type
application/json
{
  • "version": "3.1.0-beta.3",
  • "systemStatus": "0",
  • "neuronRunningTime": "6332",
  • "neuronStatus": "0",
  • "neuronMemoryUsed": "8364032",
  • "neuronMemoryTotal": "4125425664",
  • "ekuiperRunningTime": "6332",
  • "ekuiperStatus": "0",
  • "ekuiperMemoryUsed": "84316160",
  • "ekuiperMemoryTotal": "4125425664",
  • "submoduleStatus": {
    },
  • "hwToken": "m/djk5abRRToVTyBBCXkUVyMumgbYmo2PdwdjnVeqn8=",
  • "os": "Debian GNU/Linux 11",
  • "kernel": "5.10.124-linuxkit",
  • "arch": "x86_64",
  • "clib": "glibc-2.31"
}

Gett NeuronEX version information

Responses

Response samples

Content type
application/json
{
  • "version": "3.1.0-beta.3"
}

Get NeuronEX Log Remote Forwarding Configuration

Responses

Response samples

Content type
application/json
{
  • "enabled": false,
  • "network": "udp4",
  • "addr": "",
  • "priority": 6,
  • "tag": "neuronex"
}

Update NeuronEX Log Remote Forwarding Configuration

Request Body schema: application/json
addr
required
string

address of log remote forwarding.

enabled
required
boolean

whether to enable log remote forwarding. true: enable; false: disable

network
required
string

now only support udp4

priority
required
string

value can be emerg/alert/crit/err/warning/notice/info/debug

tag
required
string

syslog protocol tag field, used for syslog server to identify which neuronex client send the syslog message

Responses

Request samples

Content type
application/json
{
  • "enabled": true,
  • "addr": "localhost:10514",
  • "priority": 6,
  • "tag": "neuronex"
}

Response samples

Content type
application/json
{ }

sso

Update an SSO configuration

path Parameters
serverName
required
string
Request Body schema: application/json
url
required
string
clientId
required
string
clientSecret
required
string
type
required
string
enabled
required
boolean

Responses

Request samples

Content type
application/json
{
  • "name": "sso1",
  • "clientId": "VDx2v0usxxx",
  • "clientSecret": "1uu9c5xxxx",
  • "type": "oauth2",
  • "enabled": true
}

Response samples

Content type
application/json
{ }

Get an SSO configuration

path Parameters
serverName
required
string

Responses

Response samples

Content type
application/json
{
  • "name": "sso1",
  • "clientId": "VDx2v0usxxx",
  • "clientSecret": "1uu9c5xxxx",
  • "type": "oauth2",
  • "enabled": false
}

Delete an SSO configuration

path Parameters
serverName
required
string

Responses

Response samples

Content type
application/json
{ }

Get all SSO configurations

query Parameters
enabled
string

Optional, query configurations by 'enabled' field

Responses

Response samples

Content type
application/json
[
  • {
    },
  • {
    }
]

Add a new SSO configuration

Request Body schema: application/json
name
required
string
url
required
string
clientId
required
string
clientSecret
required
string
type
required
string
enabled
boolean
Default: false

Responses

Request samples

Content type
application/json
{
  • "name": "sso1",
  • "clientId": "VDx2v0usxxx",
  • "clientSecret": "1uu9c5xxxx",
  • "type": "oauth2",
  • "enabled": false
}

Response samples

Content type
application/json
{ }

SSO Handling

path Parameters
serverName
required
string
query Parameters
code
required
string
Example: code=5068471130381875

Responses

Response samples

Content type
application/json
{
  • "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2MzcyODcxNjMsImlhdCI6MTYzNzIwMDc2MywiaXNzIjoiRU1RIFRlY2hub2xvZ2llcyBDby4sIEx0ZCBBbGwgcmlnaHRzIHJlc2VydmVkLiIsInBhc3MiOiIwMDAwIiwidXNlciI6ImFkbWluIn0.2EZzPC9djErrCeYNrK2av0smh-eKxDYeyu7cW4MyknI"
}

license

Get License Information

Responses

Response samples

Content type
application/json
{
  • "licenseType": "TRIAL",
  • "customerName": "EMQ Technologies Inc.",
  • "customerContact": "support@emqx.io",
  • "startDate": "2023-12-06 03:28:25",
  • "expiredDate": "2123-12-06 03:28:25",
  • "expired": false,
  • "totalTagCount": 30,
  • "usedTagCount": 0,
  • "enabledPlugins": [
    ],
  • "hardwareToken": "FdVCScD63F5gGcB0eO5OuwQsxg5jJoa+YOxyOub9c5g=",
  • "ekuiperOn": true,
  • "officialEmail": "support@emqx.io"
}

Upload License

Request Body schema: application/json
license
required
string
Contents of the license file to be uploaded

Responses

Request samples

Content type
application/json
{
  • "license": "CAIaFUVNUSBUZWNobm9s..."
}

Response samples

Content type
application/json
{
  • "type": "TRIAL",
  • "customerName": "EMQ Technologies Inc.",
  • "customerContact": "support@emqx.io",
  • "startDate": "2023-12-06",
  • "expiredDate": "2123-12-06",
  • "expired": false,
  • "totalTagCount": 1000,
  • "usedTagCount": 1,
  • "enabledPlugins": [
    ],
  • "hardwareToken": "",
  • "ekuiperOn": true,
  • "officialEmail": "support@emqx.io"
}

Register the activation code and automatically import the eco-license.

Request Body schema: application/json
activationCode
required
string

Responses

Request samples

Content type
application/json
{
  • "activationCode": "6YnJBVBOcL2pBQgwnPdtdtW..."
}

Response samples

Content type
application/json
{
  • "code": 0,
  • "message": "string"
}

ECP deliver floating license to NeuronEX

Request Body schema: application/json
license
required
string
contents of the virtual license generated by ECP

Responses

Request samples

Content type
application/json
{
  • "license": "CAIaFUVNUSBUZWNobm9s..."
}

Response samples

Content type
application/json
{
  • "code": 0,
  • "message": "string"
}

Get the number of tags in use

Responses

Response samples

Content type
application/json
{
  • "usedTagCount": 0
}

Deliver Tag When NeuronEx is managed by ECP.

Request Body schema: application/json
license
required
string
contents of the virtual license generated by ECP

Responses

Request samples

Content type
application/json
{
  • "license": "CAIaFUVNUSBUZWNobm9s..."
}

Response samples

Content type
application/json
{
  • "code": 0,
  • "message": "string"
}

ECP assigns 0 tags to NeuronEX or unmanages NeuronEX

Responses

Response samples

Content type
application/json
{ }

ekuiper_plugin

Create ekuiper plugin

Request Body schema: application/json
address
required
string
name
required
string
operationId
required
integer

Responses

Request samples

Content type
application/json
{}

Response samples

Content type
application/json
""

Create external service

Request Body schema: application/json
name
required
string
address
required
string
headers
required
object

Responses

Request samples

Content type
application/json
{}

Response samples

Content type
application/json
""

Delete external service

path Parameters
serviceName
required
string

Responses

Response samples

Content type
application/json
""

tunnel

Get ECP Tunnel Config info

Responses

Response samples

Content type
application/json
{
  • "enable": false,
  • "enableSSL": false,
  • "registerId": "dc3e97118e33-1115b9328bfb58948407"
}

ECP Tunnel configuration

Request Body schema: application/json
enable
required
boolean
enableSSL
required
boolean
address
required
string
username
required
string
password
required
string
description
required
string
certificationRaw
required
string
privateKeyRaw
required
string
rootCARaw
required
string
registerId
required
string

Responses

Request samples

Content type
application/json
{
  • "enable": false,
  • "enableSSL": false,
  • "address": "tcp://127.0.0.1:1883",
  • "username": "admin",
  • "password": "password",
  • "description": "test",
  • "certificationRaw": "cert_base64",
  • "privateKeyRaw": "key_base64",
  • "rootCARaw": "ca_base64",
  • "registerId": "1234567890"
}

Response samples

Content type
application/json
{ }

management

Cancel being Managed by ECP

Responses

Response samples

Content type
application/json
{ }

liveness

Query liveness info

Responses

Response samples

Content type
application/json
{
  • "endpointUrl": "",
  • "serviceId": "",
  • "interval": 0
}

Liveness configuration

Request Body schema: application/json
addr
string

address of log remote forwarding.

enabled
boolean

whether to enable log remote forwarding. true: enable; false: disable

network
string

now only support udp4

priority
string

value can be emerg/alert/crit/err/warning/notice/info/debug

tag
string

syslog protocol tag field, used for syslog server to identify which neuronex client send the syslog message

Responses

Request samples

Content type
application/json
{
  • "endpointUrl": "127.0.0.1:1456",
  • "serviceId": "123456",
  • "interval": 10
}

Response samples

Content type
application/json
{ }

log

Get NeuronEX log level configuration

Responses

Response samples

Content type
application/json
{
  • "level": "info"
}

Set NeuronEX log level configuration

Request Body schema: application/json
level
required
string

log level ,could be debug、info、notice、warn、error、fatal

Responses

Request samples

Content type
application/json
{
  • "level": "info"
}

Response samples

Content type
application/json
{ }

Download data processing engine log

Responses

Response samples

Content type
application/json
"log ..."

Download data collection engine log

Responses

Response samples

Content type
application/json
"log ..."

Download the log of data collection engine driver node

path Parameters
nodeName
required
string

Responses

Response samples

Content type
application/json
"log ..."

Download NeuronEX log

Responses

Response samples

Content type
application/json
"log ..."

template

Export Global Configuration Template

query Parameters
category
required
integer

Category 1: ekuiper, 2: neuron

nodes
string
Example: nodes=south1,south3

List of nodes to be queried

rules
string
Example: rules=rule1,rule2

List of rules to be queried

Responses

Response samples

Content type
application/json
{
  • "streams": {
    },
  • "tables": { },
  • "rules": { },
  • "nativePlugins": { },
  • "portablePlugins": { },
  • "sourceConfig": { },
  • "sinkConfig": { },
  • "connectionConfig": { },
  • "Service": { },
  • "Schema": { },
  • "uploads": { }
}

Deliver Global Configuration Template

query Parameters
category
required
integer

Category 1: ekuiper, 2: neuron

Request Body schema: application/json
template
string

optional, Node data to be deliver if category is 1, or rule data to be deliver if category is 2

ruleData
string

optional, Rule data to be deliver

NodeData
string

optional, Node data to be deliver

operationId
integer

optional,if operationId > 0, The operation will be logged and pushed

Responses

Request samples

Content type
application/json
{
  • "template": "{\n \"streams\": {\n \"neuronStream\": \"CREATE STREAM neuronStream() WITH (TYPE=\\\"neuron\\\",FORMAT=\\\"json\\\",CONF_KEY=\\\"default\\\",SHARED=\\\"TRUE\\\");\"\n },\n \"tables\": {},\n \"rules\": {},\n \"nativePlugins\": {},\n \"portablePlugins\": {},\n \"sourceConfig\": {},\n \"sinkConfig\": {},\n \"connectionConfig\": {},\n \"Service\": {},\n \"Schema\": {},\n \"uploads\": {}\n}"
}

Response samples

Content type
application/json
{ }

process_control

Start ekuiper process

Responses

Response samples

Content type
application/json
{ }

Stop ekuiper process

Responses

Response samples

Content type
application/json
{ }

The status of ekuiper and Neuron process

Responses

Response samples

Content type
application/json
{ }

status

Get NeuronEX liveness status

Responses

Response samples

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

Get NeuronEX syslog status

Responses

Response samples

Content type
application/json
{
  • "server": {
    },
  • "outSend": {
    },
  • "sse": {
    }
}

Get ecp tunnel status

Get ecp tunnel status

Responses

Response samples

Content type
application/json
{
  • "status": "init"
}

sse

Get NeuronEX streaming log

query Parameters
type
string
Example: type=0
priority
string
Example: priority=10

Responses

Response samples

Content type
text/event-stream
2023-12-20T07:55:49Z neuronex[1]: level=error msg="forward syslog to server error [&{0x174ba08 true 0xc00054e000 neuronex neuronex-231220 6 localhost:10514}][failed to get connection]" file="syslog/out_send.go:113" func="internal/syslog.(*SendOut).Process"

Get stream client status

Get stream client status

Responses

Response samples

Content type
application/json
[
  • {
    }
]

monitor

Alert types currently supported by NeuronEX

Responses

Response samples

Content type
application/json
[
  • {
    },
  • {
    },
  • {
    }
]

Query the current alert rule-related settings

Responses

Response samples

Content type
application/json
{
  • "enabled": true,
  • "webhookUrl": "https://www.baidu.com",
  • "interval": 15,
  • "fireChecks": 0,
  • "resolveChecks": 0,
  • "alertsConfig": [
    ]
}

Configure Alert rule-related settings.

Request Body schema: application/json
enabled
required
boolean

false: disabled, true: enabled ,If the value is false, the other fields are non-required

webhookUrl
required
string

required if enabled is true,the webhook that alert events are pushed to

interval
required
integer

required if enabled is true

fireChecks
integer

required if alertsConfig is empty, the default fireChecks for all rules in alertsConfig

resolveChecks
integer

required if alertsConfig is empty, the default resolveChecks for all rules in alertsConfig

Array of objects

optional, the setting of the rule alerts to be pushed,if it is empty, it means that requires all alert types.

Responses

Request samples

Content type
application/json
{
  • "enabled": true,
  • "webhookUrl": "https://www.baidu.com",
  • "interval": 15,
  • "fireChecks": 0,
  • "resolveChecks": 0,
  • "alertsConfig": [
    ]
}

Response samples

Content type
application/json
{ }

Query recently generated alert events

Responses

Response samples

Content type
application/json
{
  • "firing": [
    ],
  • "resolved": [
    ],
  • "timestamp": "2024-01-01T09:52:26.739266876+08:00"
}

Metrics currently supported by NeuronEX

Responses

Response samples

Content type
application/json
[
  • {
    },
  • {
    },
  • {
    },
  • {
    }
]

Query the current metric-related settings

Responses

Response samples

Content type
application/json
{
  • "enabled": true,
  • "prometheusUrl": "http://127.0.0.1:9091",
  • "interval": 15,
  • "labels": {
    },
  • "metrics": [
    ]
}

Configure Metric-related settings.

Request Body schema: application/json
enabled
required
boolean

required,false: disabled, true: enabled ,If the value is false, the other fields are non-required

prometheusUrl
required
string

required if enabled is true, the url of pushgateway,like http://localhost:9091

prometheusUsername
string

optional, the url of username for pushgateway

prometheusPassword
string

optional, the url of password for pushgateway

metricIds
Array of strings

optional, metric id array,a value of null means push all metric data.

interval
required
integer

required if enabled is true, the interval of generating metrics data,unit is second

object

optional, additional labels needed for metric, will be pushed to pushgateway along with the metrics data for grouping of metrics,key: label name,value: label value

Responses

Request samples

Content type
application/json
{
  • "enabled": false,
  • "prometheusUrl": "http://127.0.0.1:9091",
  • "prometheusUsername": "",
  • "prometheusPassword": "",
  • "metricIds": [
    ],
  • "interval": 15,
  • "labels": {
    }
}

Response samples

Content type
application/json
{ }

Query the most recent metric data

Responses

Response samples

Content type
application/json
"license_max_tags 30\nlicense_used_tags 0\nnorth_nodes_total 1\nnorth_running_nodes_total 1\nnorth_disconnected_nodes_total 1\nsouth_nodes_total 0\nsouth_running_nodes_total 0\nrunning_nodes_total 1\nexception_nodes_total 1\nsouth_connected_nodes_total 0\nsouth_exception_nodes_total 0\nnorth_connected_nodes_total 0\nnorth_exception_nodes_total 1\nrunning_rules_total 0\nstopped_rules_total 0\n"

Neuron

configuration

Add Node

Add Node

Request Body schema: application/json
name
required
string (node name)

node name

plugin
required
string (plugin name)
Array of objects (setting (optional))

Responses

Request samples

Content type
application/json
{
  • "name": "modbus-tcp-node",
  • "plugin": "Modbus TCP"
}

Response samples

Content type
application/json
{
  • "error": 0
}

Del node

Delete node

Request Body schema: application/json
name
required
string

node name

Responses

Request samples

Content type
application/json
{
  • "name": "modbus-tcp-node"
}

Response samples

Content type
application/json
{
  • "error": 0
}

Get node

Get node

query Parameters
type
required
string

Type of the node,type=1 means southbound node,type=2 means northbound node

plugin
string

Plugin type of the node

node
string

Name of the node

Responses

Response samples

Content type
application/json
{
  • "error": 0
}

Update node

Update node

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

Responses

Request samples

Content type
application/json
{
  • "name": "modbus-node",
  • "new_name": "modbus-tcp-node"
}

Response samples

Content type
application/json
{
  • "error": 0
}

Get Node Setting

Get Node Setting

query Parameters
node
required
string

Node name

Responses

Response samples

Content type
application/json
{
  • "node": "modbus-node",
  • "params": {
    }
}

Node Setting

Please refer to Plugin Setting for the configuration parameters of each plugin.

Request Body schema: application/json
node
required
string
required
object

The parameter fields in json fill in different fields according to different plugins

Responses

Request samples

Content type
application/json
{
  • "node": "modbus-node",
  • "params": {
    }
}

Response samples

Content type
application/json
{
  • "error": 0
}

Node CTL

Request Body schema: application/json
node
string
cmd
integer
Enum: 0 1

0 start, 1 stop

Responses

Request samples

Content type
application/json
{
  • "node": "modbus-node",
  • "cmd": 0
}

Response samples

Content type
application/json
{
  • "error": 0
}

Get Node State

query Parameters
node
string

Node name

Responses

Response samples

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

Add Group

Request Body schema: application/json
group
string

group name

node
string

node name

interval
integer

read/upload interval(ms)

Responses

Request samples

Content type
application/json
{
  • "group": "gconfig1",
  • "node": "modbus-node",
  • "interval": 10000
}

Response samples

Content type
application/json
{
  • "error": 0
}

Del Group

Request Body schema: application/json
group
string

group name

node
string

node name

Responses

Request samples

Content type
application/json
{
  • "group": "gconfig1",
  • "node": "modbus-node"
}

Response samples

Content type
application/json
{
  • "error": 0
}

Update Group

Request Body schema: application/json
node
required
string

node name

group
required
string

group name

new_name
string

group new name

interval
integer

read/upload interval(ms)

Responses

Request samples

Content type
application/json
{
  • "node": "modbus-node",
  • "group": "gconfig1",
  • "new_name": "group1",
  • "interval": 10000
}

Response samples

Content type
application/json
{
  • "error": 0
}

Get Group

query Parameters
node
string

Node name

Responses

Response samples

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

Add Tag

Request Body schema: application/json
node
required
string
group
required
string
Array of objects

Responses

Request samples

Content type
application/json
{
  • "node": "modbus-node",
  • "group": "config_modbus_tcp_sample_2",
  • "tags": [
    ]
}

Response samples

Content type
application/json
{
  • "index": 1,
  • "error": 0
}

Get Tag

query Parameters
node
required
string
group
required
string
name
string

Responses

Response samples

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

Update Tag

Request Body schema: application/json
node
required
string

node name

group
required
string

group name

required
Array of objects

Responses

Request samples

Content type
application/json
"{\n \"node\": \"modbus-tcp-test\",\n \"group\": \"group1\",\n \"tags\": [\n {\n \"name\": \"tag1\",\n \"type\": 8,\n \"attribute\": 0,\n \"address\": \"1!400001\",\n \"description\": \"\",\n \"precision\": 0,\n \"decimal\": 0,\n \"value\": 12\n },\n {\n \"name\": \"tag2\",\n \"type\": 6,\n \"attribute\": 0,\n \"address\": \"1!400002\",\n \"description\": \"\",\n \"precison\": 0,\n \"decimal\": 0,\n },\n {\n \"name\": \"static_tag\",\n \"address\": \"\",\n \"attribute\": 10,\n \"type\": 8,\n \"description\": \"\",\n \"precison\": 0,\n \"decimal\": 0,\n \"value\": 42\n }\n ]\n}"

Response samples

Content type
application/json
{
  • "error": 0,
  • "index": 1
}

Del Tag

Request Body schema: application/json
group
required
string

group name

node
required
string

node name

tags
required
Array of strings

tag name

Responses

Request samples

Content type
application/json
{
  • "group": "config_modbus_tcp_sample_2",
  • "node": "modbus-node",
  • "tags": [
    ]
}

Response samples

Content type
application/json
{
  • "error": 0
}

Add Plugin

Request Body schema: application/json
library
required
string

plugin library name

schema_file
required
string <binary>

plugin schema file

so_file
required
string <binary>

plugin so file

Responses

Request samples

Content type
application/json
""

Response samples

Content type
application/json
{
  • "error": 0
}

Del Plugin

Request Body schema: application/json
plugin
required
string

plugin name

Responses

Request samples

Content type
application/json
""

Response samples

Content type
application/json
{
  • "error": 0
}

Get Plugin

query Parameters
plugin
string

plugin name

Responses

Response samples

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

Get Plugin Schema

query Parameters
schema_name
required
string

Responses

Response samples

Content type
application/json
{
  • "tag_regex": [
    ],
  • "group_interval": 1000,
  • "connection_mode": {
    },
  • "interval": {
    },
  • "host": {
    },
  • "port": {
    },
  • "timeout": {
    }
}

Subscribe

Request Body schema: application/json
app
required
string

app name

driver
required
string

substring match against driver name

group
required
string

substring match against group name

object

when using the MQTT plugin, the topic field needs to be added

Responses

Request samples

Content type
application/json
{
  • "app": "mqtt",
  • "driver": "modbus-tcp",
  • "group": "group-1",
  • "params": {
    }
}

Response samples

Content type
application/json
{
  • "error": 0
}

Update Subscribe Parameters

Request Body schema: application/json
app
required
string

app name

driver
required
string

deliver name

group
required
string

driver node group name

required
object

Responses

Request samples

Content type
application/json
""

Response samples

Content type
application/json
{
  • "error": 0
}

UnSubscribe

Request Body schema: application/json
app
required
string

app name

driver
required
string

driver name

group
required
string

driver node group name

required
object

optional, when using the MQTT plugin, the topic field needs to be added

Responses

Request samples

Content type
application/json
{
  • "app": "mqtt",
  • "driver": "modbus-tcp",
  • "group": "group-1",
  • "params": {
    }
}

Response samples

Content type
application/json
{
  • "error": 0
}

Get Subscribe Group

query Parameters
app
required
string

Responses

Response samples

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

Subscribe Multiple Groups

Request Body schema: application/json
app
required
string

app n

required
Array of objects

Responses

Request samples

Content type
application/json
{
  • "app": "mqtt",
  • "groups": [
    ]
}

Response samples

Content type
application/json
{
  • "error": 0
}

Get Version

Responses

Response samples

Content type
application/json
{
  • "build_date": "2022-06-01",
  • "revision": "99e2184+dirty",
  • "version": "2.4.0"
}

Download log files

Responses

Response samples

Content type
application/json
{
  • "error": 0
}

Update node log level

Call the api to modify the log level of the node to debug, and automatically switch to the default level in about ten minutes.

Request Body schema: application/json
node
string

node name

level
required
string

log level ,could be debug、info、notice、warn、error、fatal

core
string

whether to switch the core log level.The core field is optional and defaults to true.

Responses

Request samples

Content type
application/json
""

Response samples

Content type
application/json
{
  • "error": 0
}

metrics

Get Metrics

query Parameters
category
string

one of global, driver and app

node
string

filter with node name, only meaningful when category=driver or category=app

Responses

Response samples

Content type
application/json
"# HELP core_dumped Whether there is any core dump\n# TYPE core_dumped gauge\ncore_dumped 0\n# HELP uptime_seconds Uptime in seconds\n# TYPE uptime_seconds counter\nuptime_seconds 314\n# HELP north_nodes_total Number of north nodes\n# TYPE north_nodes_total gauge\nnorth_nodes_total 1\n# HELP north_running_nodes_total Number of north nodes in running state\n# TYPE north_running_nodes_total gauge\nnorth_running_nodes_total 1\n# HELP north_disconnected_nodes_total Number of north nodes disconnected\n# TYPE north_disconnected_nodes_total gauge\nnorth_disconnected_nodes_total 1\n# HELP south_nodes_total Number of south nodes\n# TYPE south_nodes_total gauge\nsouth_nodes_total 1\n# HELP south_running_nodes_total Number of south nodes in running state\n# TYPE south_running_nodes_total gauge\nsouth_running_nodes_total 0\n# HELP south_disconnected_nodes_total Number of south nodes disconnected\n# TYPE south_disconnected_nodes_total gauge\nsouth_disconnected_nodes_total 1\n# HELP send_msgs_total Total number of messages sent\n# TYPE send_msgs_total counter\nsend_msgs_total{node=\"data-stream-processing\"} 0\n# HELP send_msg_errors_total Total number of errors sending messages\n# TYPE send_msg_errors_total counter\nsend_msg_errors_total{node=\"data-stream-processing\"} 0\n# HELP recv_msgs_total Total number of messages received\n# TYPE recv_msgs_total counter\nrecv_msgs_total{node=\"data-stream-processing\"} 0\n# HELP last_rtt_ms Last request round trip time in milliseconds\n# TYPE last_rtt_ms gauge\nlast_rtt_ms{node=\"modbus\"} 9999\n# HELP send_bytes Total number of bytes sent\n# TYPE send_bytes gauge\nsend_bytes{node=\"modbus\"} 0\n# HELP recv_bytes Total number of bytes received\n# TYPE recv_bytes gauge\nrecv_bytes{node=\"modbus\"} 0\n# HELP tag_reads_total Total number of tag reads including errors\n# TYPE tag_reads_total counter\ntag_reads_total{node=\"modbus\"} 0\n# HELP tag_read_errors_total Total number of tag read errors\n# TYPE tag_read_errors_total counter\ntag_read_errors_total{node=\"modbus\"} 0\n# HELP group_tags_total Total number of tags in the group\n# TYPE group_tags_total gauge\ngroup_tags_total{node=\"modbus\",group=\"grp\"} 1\n# HELP group_last_send_msgs Number of messages sent on last group timer invocation\n# TYPE group_last_send_msgs gauge\ngroup_last_send_msgs{node=\"modbus\",group=\"grp\"} 0\n# HELP group_last_timer_ms Time in milliseconds consumed on last group timer invocation\n# TYPE group_last_timer_ms gauge\ngroup_last_timer_ms{node=\"modbus\",group=\"grp\"} 0"

rw

Read Tag

Request Body schema: application/json
node
required
string

node name

group
required
string

group name

sync
boolean

synchronous read ,default false

object

Responses

Request samples

Content type
application/json
{
  • "node": "modbus-tcp-1",
  • "group": "config_modbus_tcp_sample_2",
  • "sync": false,
  • "query": {
    }
}

Response samples

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

Read Tag (pagination)

Request Body schema: application/json
node
required
string

node name

group
required
string

group name

sync
boolean

synchronous read ,default false

name
string

tag name substring match

description
string

tag description substring match

currentPage
required
integer

current page

pageSize
required
integer

number of tags per page

isError
required
boolean

response error tags only

Responses

Request samples

Content type
application/json
{
  • "node": "modbus-tcp-1",
  • "group": "config_modbus_tcp_sample_2",
  • "sync": false,
  • "query": {
    }
}

Response samples

Content type
application/json
{
  • "meta": {
    },
  • "items": [
    ]
}

Write One Tag

Request Body schema: application/json
node
required
string
group
required
string
tag
required
string
value
required
integer

Responses

Request samples

Content type
application/json
{
  • "node": "modbus-tcp-1",
  • "group": "config_modbus_tcp_sample_2",
  • "tag": "tag1",
  • "value": 1234
}

Response samples

Content type
application/json
{
  • "error": 0
}

Write Multiple Tags

Multiple tags writing currently only supports Mitsubishi 3E, Beckhoff ADS, Modbus TCP, Modbus RTU, Siemens S7 ISOTCP, Omron FINS TCP, OPC UA, BACnet/IP drivers.

Request Body schema: application/json
node
required
string
group
required
string
required
Array of objects

Responses

Request samples

Content type
application/json
{
  • "node": "modbus-tcp-1",
  • "group": "group1",
  • "tags": [
    ]
}

Response samples

Content type
application/json
{
  • "error": 0
}

TEST Reading Tag

Request Body schema: application/json
driver
required
string
group
required
string
tag
required
string
address
required
string
attribute
required
type
required
precision
required
integer
decimal
required
integer
bias
required
integer

Responses

Request samples

Content type
application/json
{
  • "driver": "1",
  • "group": "1",
  • "tag": "tag1",
  • "address": "1!400002",
  • "attribute": 8,
  • "type": 3,
  • "precision": 0,
  • "decimal": 0,
  • "bias": 0
}

Response samples

Content type
application/json
{
  • "value": 29540
}

eKuiper

configKey

List all configKey

This API is used to get all Config Keys under a specific source name.

Note: When retrieving Config Keys, if the properties contain a password field (case-insensitive, such as Password), the API will not return the actual password value, but instead replace it with "******" to conceal the password information.

path Parameters
name
required
string
Example: mqtt

Source name, supports built-in sources and extended sources. The built-in sources include mqtt, redis, neuron, memory, httppull, httppush, file, edgex, Extended sources include random, sql, video, zmq and user-defined sources

Responses

Response samples

Content type
application/json
{
  • "amd_broker": {
    },
  • "default": {
    },
  • "demo_conf": {
    }
}

Delete a configKey

This API is used to delete a Config Key configuration under a specific source name

path Parameters
name
required
string
Example: mqtt

Source name, supports built-in sources and extended sources. The built-in sources include mqtt, redis, neuron, memory, httppull, httppush, file, edgex, Extended sources include random, sql, video, zmq and user-defined sources

confKey
required
string
Example: demo_conf

Config Key Name。Taking the above as an example, the Config Keys are amd_broker, default, demo_conf in sequence.

Responses

Response samples

Content type
application/json
null

Register a Config Key

This API is used to register a Config Key under a specific source name

path Parameters
name
required
string

Source name, supports built-in sources and extended sources. The built-in sources include mqtt, redis, neuron, memory, httppull, httppush, file, edgex, Extended sources include random, sql, video, zmq and user-defined sources

confKey
required
string

Config Key name to register

Request Body schema: application/json
name
required
string (Source name)

supports built-in sources and extended sources. The built-in sources include mqtt, redis, neuron, memory, httppull, httppush, file, edgex, Extended sources include random, sql, video, zmq and user-defined sources

confKey
required
string (Config Key name to register)

Responses

Request samples

Content type
application/json
""

Response samples

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

configs

Reload Basic Configs

By dynamically reloading configuration, parameters such as debug and timezone can be updated for running eKuiper without restarting the application. Current supported dynamic reloadable parameters:

  • debug
  • consoleLog
  • fileLog
  • timezone
Request Body schema: application/json
debug
boolean
consoleLog
boolean
fileLog
boolean
timezone
string

Responses

Request samples

Content type
application/json
{
  • "debug": true,
  • "consoleLog": true,
  • "fileLog": true,
  • "timezone": "UTC"
}

Response samples

Content type
application/json
null

Shutdown eKuiper

Shut down eKuiper through rest api.

Responses

Response samples

Content type
application/json
{ }

data

Import Data

The API resets all existing data and then imports the new data into the system by default. But user can specify partial=1 parameter in HTTP URL to keep the existing data and apply the new data. The API supports specifying data by means of text content or file URIs.

Example 1: Import by text content

POST http://{{host}}/data/import
Content-Type: application/json

{
  "content": "{json of the ruleset}"
}

Example 2: Import by file URI

POST http://{{host}}/data/import
Content-Type: application/json

{
  "file": "file:///tmp/a.json"
}

Example 3: Import data via file URI and exit (for plug-ins and static schema updates, users need to ensure that eKuiper can be restarted after exiting)

POST http://{{host}}/data/import?stop=1
Content-Type: application/json

{
  "file": "file:///tmp/a.json"
}

Example 4: Keep the old data and import new data (overwrite the tables/streams/rules/source config/sink config. install plugins/schema if not exist, else ignore them)

POST http://{{host}}/data/import?partial=1
Content-Type: application/json

{
  "file": "file:///tmp/a.json"
}

Data Format

The file format for importing and exporting data is JSON, which can contain : streams, tables, rules, plugin, source yaml and so on. Each type holds the the key-value pair of the name and the creation statement. In the following example file, we define stream 、rules、table、plugin、source config、sink config

{
    "streams": {
        "demo": "CREATE STREAM demo () WITH (DATASOURCE=\"users\", FORMAT=\"JSON\")"
    },
    "tables": {
      "T110":"\n CREATE TABLE T110\n (\n S1 string\n )\n WITH (DATASOURCE=\"test.json\", FORMAT=\"json\", TYPE=\"file\", KIND=\"scan\", );\n "
    },
    "rules": {
        "rule1": "{\"id\": \"rule1\",\"sql\": \"SELECT * FROM demo\",\"actions\": [{\"log\": {}}]}",
        "rule2": "{\"id\": \"rule2\",\"sql\": \"SELECT * FROM demo\",\"actions\": [{  \"log\": {}}]}"
    },
    "nativePlugins":{
        "functions_image":"{\"name\":\"image\",\"file\":\"https://packages.emqx.net/kuiper-plugins/1.8.1/debian/functions/image_amd64.zip\",\"shellParas\":[]}",
        "sources_video":"{\"name\":\"video\",\"file\":\"https://packages.emqx.net/kuiper-plugins/1.8.1/debian/sources/video_amd64.zip\",\"shellParas\":[]}"
    },
    "portablePlugins":{
    },
    "sourceConfig":{
      "mqtt":"{\"td\":{\"insecureSkipVerify\":false,\"password\":\"public\",\"protocolVersion\":\"3.1.1\",\"qos\":1,\"server\":\"tcp://broker.emqx.io:1883\",\"username\":\"admin\"},\"test\":{\"insecureSkipVerify\":false,\"password\":\"public\",\"protocolVersion\":\"3.1.1\",\"qos\":1,\"server\":\"tcp://127.0.0.1:1883\",\"username\":\"admin\"}}"
    },
    "sinkConfig":{
      "edgex":"{\"test\":{\"bufferLength\":1024,\"contentType\":\"application/json\",\"enableCache\":false,\"format\":\"json\",\"messageType\":\"event\",\"omitIfEmpty\":false,\"port\":6379,\"protocol\":\"redis\",\"sendSingle\":true,\"server\":\"localhost\",\"topic\":\"application\",\"type\":\"redis\"}}"
    },
    "connectionConfig":{
    },
    "Service":{
    },
    "Schema":{
    },
    "uploads":{
    }
}
query Parameters
stop
integer
Example: stop=1

for plug-ins and static schema updates, users need to ensure that eKuiper can be restarted after exiting

partial
integer
Example: partial=1

Keep the old data and import new data (overwrite the tables/streams/rules/source config/sink config. install plugins/schema if not exist, else ignore them)

Request Body schema: application/json
content
string (text content)
file
string ( file URI)

Responses

Request samples

Content type
application/json
{
  • "content": "{json of the ruleset}"
}

Response samples

Content type
application/json
{
  • "ErrorMsg": "",
  • "ConfigResponse": {
    }
}

Import data status

This API returns data import errors. If all returns are empty, it means that the import is completely successful.

Responses

Response samples

Content type
application/json
Example
{
  • "streams": { },
  • "tables": { },
  • "rules": { },
  • "nativePlugins": { },
  • "portablePlugins": { },
  • "sourceConfig": { },
  • "sinkConfig": { },
  • "connectionConfig": { },
  • "Service": { },
  • "Schema": { },
  • "uploads": { }
}

Export all data

Export all data,The export API returns a file to download.

Responses

Response samples

Content type
application/json
{
  • "streams": { },
  • "tables": { },
  • "rules": { },
  • "nativePlugins": { },
  • "portablePlugins": { },
  • "sourceConfig": { },
  • "sinkConfig": { },
  • "connectionConfig": { },
  • "Service": { },
  • "Schema": { }
}

Export specific rules related data

Export specific rules related data,The export API returns a file to download.

Request Body schema: application/x-www-form-urlencoded
["rule1","rule2"]
required
string

Responses

Response samples

Content type
application/json
{
  • "streams": { },
  • "tables": { },
  • "rules": { },
  • "nativePlugins": { },
  • "portablePlugins": { },
  • "sourceConfig": { },
  • "sinkConfig": { },
  • "connectionConfig": { },
  • "Service": { },
  • "Schema": { }
}

overview

Getting information

This API is used to get the version number, system type, and program running time.

Responses

Response samples

Content type
application/json
{
  • "version": "1.0.1-22-g119ee91",
  • "os": "darwin",
  • "upTimeSeconds": 14
}

ping

Responses

Response samples

Content type
application/json
null

plugins

Create a plugin

The API accepts a JSON content to create a new plugin.The plugin is identified by the name. The name must be unique.

Parameters

  1. name: a unique name of the plugin. The name must be the same as the camel case version of the plugin with lowercase first letter. For example, if the exported plugin name is Random, then the name of this plugin is random.
  2. file: the url of the plugin files. The url can be http or https scheme or file scheme to refer to a local file path of the eKuiper server. It must be a zip file with: a compiled so file and the yaml file(only required for sources). If the plugin depends on some external dependencies, a bash script named install.sh can be provided to do the dependency installation. The name of the files must match the name of the plugin.

A sample zip file for a source named random.zip

  1. Random@v1.0.0.so
  2. random.yaml
  3. install.sh
  4. Various dependency files/folders of install.sh
    • mysdk.zip
    • myconfig.conf
  5. etc directory: the runtime configuration files or dependency files. After installation, this directory will be renamed to the plugin name under {{eKuiperPath}}/etc/{{pluginType}} directory.

Notice that, the install.sh will be run that the system may already had the lib or package. Make sure to check the path before. Below is an example install.sh to install a sample sdk lib.

dir=/usr/local/mysdk
cur=$(dirname "$0")
echo "Base path $cur"
if [ -d "$dir" ]; then
    echo "SDK path $dir exists."
else
    echo "Creating SDK path $dir"
    mkdir -p $dir
    echo "Created SDK path $dir"
fi

apt install --no-upgrade unzip
if [ -d "$dir/lib" ]; then
    echo "SDK lib path $dir/lib exists."
else
    echo "Unzip SDK lib to path $dir"
    unzip $cur/mysdk.zip -d $dir
    echo "Unzipped SDK lib to path $dir"
fi

if [ -f "/etc/ld.so.conf.d/myconfig.conf" ]; then
    echo "/etc/ld.so.conf.d/myconfig.conf exists"
else
    echo "Copy conf file"
    cp $cur/myconfig.conf /etc/ld.so.conf.d/
    echo "Copied conf file"
fi
ldconfig
echo "Done"
path Parameters
type
required
string

value only can be "sources", "sinks", "functions","portables"

Request Body schema: application/json
name
required
string
file
required
string
  • Request Sample when the file locates in a http server

    file:"http://127.0.0.1/plugins/sources/random.zip"

  • Request Sample for files locates in the same machine of the eKuiper server.

    file:"file:///var/plugins/sources/random.zip"

Responses

Request samples

Content type
application/json
{}

Response samples

Content type
application/json
{
  • "name": "random",
  • "file": "file:///var/plugins/sources/random.zip"
}

Show plugins

The API is used for displaying all of plugins defined in the server for a plugin type.

path Parameters
type
required
string

value only can be "sources", "sinks", "functions","portables"

Responses

Response samples

Content type
application/json
[
  • "plugin1",
  • "plugin2"
]

Describe a sources plugin

The API is used to print out the detailed definition of a plugin.

path Parameters
type
required
string

value only can be "sources", "sinks", "functions","portables"

name
required
string

Path parameter name is the name of the plugin.

Responses

Response samples

Content type
application/json
{
  • "name": "plugin1",
  • "version": "1.0.0"
}

Drop a plugin

The API is used for drop the plugin. Notice that, for native plugins, the eKuiper server needs to be restarted to take effect. The current rules will continue to run with the deleted native plugins successfully. For portable plugin, the deletion will take effect immediately. The current rules which are using that plugin may encounter errors but won't stop and can continue running if an updated plugin with the same name is created later. If this is not expected, manually stop or delete those rules before deleting a plugin.

The user can pass a query parameter to decide if eKuiper should be stopped after a delete in order to make the deletion take effect. The parameter is stop and only when the value is 1 will the eKuiper be stopped. The user has to manually restart it.

path Parameters
type
required
string

value only can be "sources", "sinks", "functions","portables"

name
required
string
query Parameters
stop
string
Example: stop=1

Responses

Response samples

Content type
application/json
{ }

Update a sources plugin

Notice that, native plugins can be updated, but the new version will not take effect until the eKuiper server is restarted. Portable plugins can be updated, and the new version will take effect immediately even for the running rules. The request body is the same as the create plugin request.

path Parameters
type
required
string

value only can be "sources", "sinks", "functions","portables"

name
required
string

Responses

Response samples

Content type
application/json
{ }

Show udfs

The API is used for displaying all user defined functions which are defined across all plugins.

Unlike source and sink plugins, function plugin can export multiple functions at once. The exported names must be unique globally across all plugins. There will be a one to many mapping between function and its container plugin. Thus, we provide show udf(user defined function) api to query all user defined functions so that users can check the name duplication. And we provide describe udf api to find out the defined plugin of a function. We also provide the register functions api to register the udf list for an auto loaded plugin.

Responses

Response samples

Content type
application/json
[
  • "func1",
  • "func2"
]

Describe an udf

The API is used to find out the plugin which defines the UDF. APIs to handle function plugin with multiple functions

path Parameters
name
required
string

Responses

Response samples

Content type
application/json
{
  • "name": "funcName",
  • "plugin": "pluginName"
}

Register functions

The API aims to register all exported functions in an auto loaded function plugin or when the exported functions are changed. If the plugin was loaded by CLI create command or REST create API with functions property specified, then this is not needed. The register API will persist the functions list in the kv. Unless the exported functions are changed, users only need to register it once. APIs to handle function plugin with multiple functions

path Parameters
plugin_name
required
string

Responses

Response samples

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

Get the available plugins

According to the configuration pluginHosts in file etc/kuiper.yaml , it returns the plugins list that can be installed at local run eKuiper instance. By default, it get the list from https://packages.emqx.net .

path Parameters
type
required
string

value only can be "sources", "sinks", "functions","portables"

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

Responses

Request samples

Content type
application/json
""

rules

Create a rule

The API accepts a JSON content and create and start a rule.

Request Body schema: application/json
id
required
string
sql
required
string
required
Array of objects

Responses

Request samples

Content type
application/json
{
  • "id": "rule1",
  • "sql": "SELECT * FROM demo",
  • "actions": [
    ]
}

Response samples

Content type
application/json
{ }

Show rules

The API is used for displaying all of rules defined in the server with a brief status.

Responses

Response samples

Content type
application/json
[
  • {
    },
  • {
    }
]

Describe a rule

The API is used for print the detailed definition of rule.

path Parameters
id
required
string

id is the id or name of the rule.

Responses

Response samples

Content type
application/json
{
  • "sql": "SELECT * from demo",
  • "actions": [
    ]
}

Update a rule

The API accepts a JSON content and update a rule.

path Parameters
id
required
string

id is the id or name of the old rule.

Request Body schema: application/json
id
required
string
sql
required
string
required
Array of objects

Responses

Request samples

Content type
application/json
{
  • "id": "rule1",
  • "sql": "SELECT * FROM demo",
  • "actions": [
    ]
}

Response samples

Content type
application/json
{ }

Drop a rule

The API is used for drop the rule.

path Parameters
id
required
string

Responses

Response samples

Content type
application/json
{ }

Start a rule

The API is used to start running the rule.

path Parameters
id
required
string

Responses

Response samples

Content type
application/json
{ }

Stop a rule

The API is used to start running the rule.

path Parameters
id
required
string

Responses

Response samples

Content type
application/json
{ }

Restart a rule

The API is used to start running the rule.

path Parameters
id
required
string

Responses

Response samples

Content type
application/json
{ }

Get the status of a rule

The command is used to get the status of the rule. If the rule is running, the metrics will be retrieved realtime. The status can be

  • $metrics
  • stopped: $reason
path Parameters
id
required
string

Responses

Response samples

Content type
application/json
"{\n \"source_demo_0_records_in_total\": 5,\n \"source_demo_0_records_out_total\": 5,\n \"source_demo_0_exceptions_total\": 0,\n \"source_demo_0_process_latency_ms\": 0,\n \"source_demo_0_buffer_length\": 0,\n \"source_demo_0_last_invocation\": \"2020-01-02T11:28:33.054821\",\n \"op_filter_0_records_in_total\": 5,\n \"op_filter_0_records_out_total\": 2,\n \"op_filter_0_exceptions_total\": 0,\n \"op_filter_0_process_latency_ms\": 0,\n \"op_filter_0_buffer_length\": 0,\n \"op_filter_0_last_invocation\": \"2020-01-02T11:28:33.054821\",\n}"

Get the topology structure of a rule

The command is used to get the status of the rule represented as a json string. In the json string, there are 2 fields:

  • sources: it is a string array of the names of all source nodes. They are the entry of the topology.
  • edges: it is a hash map of all edges categorized by nodes. The keys are the starting point of an edge. And the value is a collection of ending point.
path Parameters
id
required
string

Responses

Response samples

Content type
application/json
{
  • "sources": [
    ],
  • "edges": {
    }
}

Validate a rule

The API accepts a JSON content and validate a rule. For the API, here is the explanation of the status codes:

  • If the request body is incorrect, a status code of 400 will be returned, indicating an invalid request.
  • If the rule validation fails, a status code of 422 will be returned, indicating an invalid rule.
  • If the rule validation passes, a status code of 200 will be returned, indicating a valid and successfully validated rule.
Request Body schema: application/json
id
required
string
sql
required
string
required
Array of objects

Responses

Request samples

Content type
application/json
{
  • "id": "rule1",
  • "sql": "SELECT * FROM demo",
  • "actions": [
    ]
}

Response samples

Content type
application/json
{ }

Query Rule Plan

The API is used to get the plan of the SQL.

path Parameters
id
required
string

rule id

Responses

Response samples

Content type
application/json
{
  • "type": "ProjectPlan",
  • "info": "Fields:[ * ]",
  • "id": 0,
  • "children": [
    ]
}

ruleset

Import Ruleset

The API accepts rulesets and imports them into the system. If a stream or rule in the ruleset already exists, it is not created. The API returns text informing the number of streams and rules created. The API supports specifying rulesets by means of text content or file URIs.

Ruleset Format

The file format for importing and exporting ruleset is JSON, which can contain three parts: streams, tables and rules. Each type holds the the key-value pair of the name and the creation statement. In the following example file, we define a stream and two rules.

  "streams": {
    "demo": "CREATE STREAM demo () WITH (DATASOURCE=\"users\", FORMAT=\"JSON\")"
  },
  "tables": {},
  "rules": {
    "rule1": "{\"id\": \"rule1\",\"sql\": \"SELECT * FROM demo\",\"actions\": [{\"log\": {}}]}",
    "rule2": "{\"id\": \"rule2\",\"sql\": \"SELECT * FROM demo\",\"actions\": [{  \"log\": {}}]}"
  }
}
Request Body schema: application/json
file
string ( Import by file URI)
content
string ( Import by text content)

Responses

Request samples

Content type
application/json
{
  • "file": "file:///tmp/a.json"
}

Response samples

Content type
application/json
{ }

Export Ruleset

The export API returns a file to download.

Responses

Response samples

Content type
application/json
{ }

schemas

Create a schema

The API accepts a JSON content and create a schema. Each schema type has a standalone endpoint. Currently, only one schema type protobuf is supported. Schema is identified by its name, so the name must be unique for each type.

Parameters

  1. name:the unique name of the schema.
  2. schema content, use file or content parameter to specify. After schema created, the schema content will be written into file data/schemas/$shcema_type/$schema_name.
    • file: the url of the schema file. The url can be http or https scheme or file scheme to refer to a local file path of the eKuiper server. The schema file must be the file type of the corresponding schema type. For example, protobuf schema file's extension name must be .proto.
    • content: the text content of the schema.
  3. soFile:The so file of the static plugin. Detail about the plugin creation, please check customize format.
Request Body schema: application/json
name
required
string
content
string (Schema content inside content.)
file
string (Schema content in a file)
soFile
string (Schema with static plugin)

Responses

Request samples

Content type
application/json
""

Response samples

Content type
application/json
{ }

Show schemas

The API is used for displaying all schemas defined in the server.

Responses

Response samples

Content type
application/json
[
  • "schema1",
  • "schema2"
]

Describe a schema

The API is used for print the detailed definition of a schema.

path Parameters
name
required
string

name of the schema.

Responses

Response samples

Content type
application/json
{
  • "type": "protobuf",
  • "name": "schema1",
  • "content": "message Book {required string title = 1; required int32 price = 2;}",
  • "file": "ekuiper\\etc\\schemas\\protobuf\\schema1.proto"
}

Delete a schema

The API is used for dropping the schema.

path Parameters
name
required
string

Responses

Response samples

Content type
application/json
{ }

Update a schema

The API is used for updating the schema. The request body is the same as creating a schema.

path Parameters
name
required
string
Request Body schema: application/json
name
required
string
file
required
string

Responses

Request samples

Content type
application/json
""

Response samples

Content type
application/json
{ }

services

Register external services

This API accepts JSON content to create new external services.

parameter

  1. name: The unique name of the external service, which must be exactly the same as the json file of service definition in the zip file.
  2. file: URL of external service file. URL supports http, https and file modes. When using the file mode, the file must be on the machine where the eKuiper server is located. It must be a zip file, which contains the service description json file with the same name as the service and any other auxiliary files. The schema file must be in the schema folder.

Service file format

A sample zip file of the source named sample.zip

  1. sample.json
  2. Schema directory: it contains one or more schema files used by the service. For example, sample.proto.

An example of a request for a file on an HTTP server:

{
  "name":"random",
  "file":"http://127.0.0.1/services/sample.zip"
}

An example of a request for a file on the eKuiper server:

{
  "name":"random",
  "file":"file:///var/services/sample.zip"
}

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

a file on an HTTP server or a file on the eKuiper server.

Responses

Request samples

Content type
application/json
{}

Response samples

Content type
application/json
{ }

Display external services

This API is used to display all external services defined in the server.

Responses

Response samples

Content type
application/json
[
  • "sample",
  • "sample2"
]

Describe external services

This API is used to print detailed definitions of external services.

path Parameters
name
required
string

the name of the external service.

Responses

Response samples

Content type
application/json
{ }

Delete external services

This API is used to delete external services, and all functions defined under the service will be deleted.

path Parameters
name
required
string

Responses

Response samples

Content type
application/json
{ }

Update external services

This API is used to update external services, and its parameters are the same as that of service registration.

path Parameters
name
required
string
Request Body schema: application/json
name
required
string
file
required
string

Responses

Request samples

Content type
application/json
""

Response samples

Content type
application/json
{ }

Display all external functions

Each service can contain multiple functions. This API is used to display the names of all external functions that can be used in SQL.

Responses

Response samples

Content type
application/json
[
  • "func1",
  • "func2"
]

Describe external functions

This API is used to display the name of the service that defines this external function.

path Parameters
name
required
string

Responses

Response samples

Content type
application/json
{
  • "name": "funcName",
  • "serviceName": "serviceName"
}

streams

Create a stream

The API is used for creating a stream. This API can run any stream sql statements, not only stream creation.

Request Body schema: application/json
sql
required
string

Responses

Request samples

Content type
application/json
{
  • "sql": "create stream my_stream (id bigint, name string, score float) WITH ( datasource = \"topic/temperature\", FORMAT = \"json\", KEY = \"id\")"
}

Response samples

Content type
application/json
{ }

Show streams

The API is used for displaying all of streams defined in the server.

Responses

Response samples

Content type
application/json
[
  • "mystream"
]

Describe a stream

The API is used for print the detailed definition of stream.

path Parameters
id
required
string

Responses

Response samples

Content type
application/json
{
  • "Name": "demo",
  • "StreamFields": [
    ],
  • "Options": {
    }
}

Get stream schema

The API is used to get the stream schema. The schema is inferred from the physical and logical schema definitions.

path Parameters
id
required
string

Responses

Response samples

Content type
application/json
{
  • "id": {
    },
  • "name": {
    },
  • "age": {
    },
  • "hobbies": {
    }
}

Update a stream

The API is used for update the stream definition.

path Parameters
id
required
string

the id or name of the old stream.

Request Body schema: application/json
sql
required
string

Responses

Request samples

Content type
application/json
{
  • "sql": "create stream my_stream (id bigint, name string, score float) WITH ( datasource = \"topic/temperature\", FORMAT = \"json\", KEY = \"id\")"
}

Response samples

Content type
application/json
{ }

Drop a stream

The API is used for drop the stream definition.

path Parameters
id
required
string

Responses

Response samples

Content type
application/json
{ }

tables

Create a table

The API is used for creating a table. This API can run any table sql statements, not only table creation.

Request Body schema: application/json
sql
required
string

Responses

Request samples

Content type
application/json
{
  • "sql": "create table my_table (id bigint, name string, score float) WITH ( datasource = \"lookup.json\", FORMAT = \"json\", KEY = \"id\")"
}

Response samples

Content type
application/json
{ }

Show tables

The API is used for displaying all of tables defined in the server. This API accepts one parameter kind, the value could be scan or lookup to query each kind of tables. Other values are invalid, it will return all kinds of tables.

query Parameters
kind
string
Example: kind=lookup

query all the lookup tables.

Responses

Response samples

Content type
application/json
[
  • "mytable"
]

Describe a table

The API is used for print the detailed definition of table.

path Parameters
id
required
string

Responses

Response samples

Content type
application/json
{
  • "Name": "demo",
  • "StreamFields": [
    ],
  • "Options": {
    }
}

Get table schema

The API is used to get the table schema. The schema is inferred from the physical and logical schema definitions.

path Parameters
id
required
string

Responses

Response samples

Content type
application/json
{ }

Update a table

The API is used for update the table definition.

path Parameters
id
required
string

the id or name of the old table.

Responses

Response samples

Content type
application/json
{
  • "sql": "create table my_table (id bigint, name string, score float) WITH ( datasource = \"topic/temperature\", FORMAT = \"json\", KEY = \"id\")"
}

Drop a table

The API is used for drop the table definition.

path Parameters
id
required
string

Responses

Response samples

Content type
application/json
{ }

uploads

Upload a configuration file

The API supports to upload a local file, provide the text content of file or upload a http file link. The upload request will save the file into your ${dataPath}/uploads. It will override the existed file of the same name. The response is the absolute path of the uploaded file which you can refer in other configurations.

Upload by a file

The API accepts a multipart file upload requests. Below is an example html file to upload file to http://127.0.0.1:9081/config/uploads. In the form data, the file input name must be uploadFile.

<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Upload File</title>
  </head>
  <body>
    <form
      enctype="multipart/form-data"
      action="http://127.0.0.1:9081/config/uploads"
      method="post"
    >
      <input type="file" name="uploadFile" />
      <input type="submit" value="upload" />
    </form>
  </body>
</html>

Upload by content

Provide the text content and file name to create a configuration file.

{
  "name": "my.json",
  "content": "{\"hello\":\"world\"}"
}
{
  "name": "my.json",
  "file": "http://127.0.0.1:80/my.json"
}
Request Body schema: application/json
name
required
string (configuration file name)
content
string ( text content)
file
required
string (HTTP file link)

Should put the file in HTTP Server in advance

Responses

Request samples

Content type
application/json
{
  • "name": "my.json",
  • "content": "{\"hello\":\"world\"}"
}

Response samples

Content type
application/json
{ }

Show uploaded file list

The API is used for displaying all files in the ${dataPath}/uploads path.

Responses

Response samples

Content type
application/json
[
  • "/ekuiper/data/uploads/zk.gif",
  • "/ekuiper/data/uploads/abc.gif"
]

Delete an uploaded file

The API is used for deleting a file in the ${dataPath}/uploads path.

path Parameters
fileName
required
string

Responses

Response samples

Content type
application/json
{ }

data processing metrics

Get Metrics information of the data stream processing

Query the raw metrics information of the data stream processing, after the normal operation of the rules, you can see the metrics information in the api similar to kuiper_sink_records_in_total .

Responses

Response samples

Content type
application/json
"# HELP go_gc_duration_seconds A summary of the pause duration of garbage collection cycles.\n# TYPE go_gc_duration_seconds summary\ngo_gc_duration_seconds{quantile=\"0\"} 0.000185937\ngo_gc_duration_seconds{quantile=\"0.25\"} 0.000342795\ngo_gc_duration_seconds{quantile=\"0.5\"} 0.000369361\ngo_gc_duration_seconds{quantile=\"0.75\"} 0.000391542\ngo_gc_duration_seconds{quantile=\"1\"} 0.000391542\ngo_gc_duration_seconds_sum 0.001289635\ngo_gc_duration_seconds_count 4\n# HELP go_goroutines Number of goroutines that currently exist.\n# TYPE go_goroutines gauge\ngo_goroutines 15\n# HELP go_info Information about the Go environment.\n# TYPE go_info gauge\ngo_info{version=\"go1.20.2\"} 1\n# HELP go_memstats_alloc_bytes Number of bytes allocated and still in use.\n# TYPE go_memstats_alloc_bytes gauge\ngo_memstats_alloc_bytes 6.983208e+06\n# HELP go_memstats_alloc_bytes_total Total number of bytes allocated, even if freed.\n# TYPE go_memstats_alloc_bytes_total counter\ngo_memstats_alloc_bytes_total 1.1783664e+07\n# HELP go_memstats_buck_hash_sys_bytes Number of bytes used by the profiling bucket hash table.\n# TYPE go_memstats_buck_hash_sys_bytes gauge\ngo_memstats_buck_hash_sys_bytes 1.451727e+06\n# HELP go_memstats_frees_total Total number of frees.\n# TYPE go_memstats_frees_total counter\ngo_memstats_frees_total 62815\n# HELP go_memstats_gc_sys_bytes Number of bytes used for garbage collection system metadata.\n# TYPE go_memstats_gc_sys_bytes gauge\ngo_memstats_gc_sys_bytes 8.595544e+06\n# HELP go_memstats_heap_alloc_bytes Number of heap bytes allocated and still in use.\n# TYPE go_memstats_heap_alloc_bytes gauge\ngo_memstats_heap_alloc_bytes 6.983208e+06\n# HELP go_memstats_heap_idle_bytes Number of heap bytes waiting to be used.\n# TYPE go_memstats_heap_idle_bytes gauge\ngo_memstats_heap_idle_bytes 6.209536e+06\n# HELP go_memstats_heap_inuse_bytes Number of heap bytes that are in use.\n# TYPE go_memstats_heap_inuse_bytes gauge\ngo_memstats_heap_inuse_bytes 9.91232e+06\n# HELP go_memstats_heap_objects Number of allocated objects.\n# TYPE go_memstats_heap_objects gauge\ngo_memstats_heap_objects 38478\n# HELP go_memstats_heap_released_bytes Number of heap bytes released to OS.\n# TYPE go_memstats_heap_released_bytes gauge\ngo_memstats_heap_released_bytes 4.58752e+06\n# HELP go_memstats_heap_sys_bytes Number of heap bytes obtained from system.\n# TYPE go_memstats_heap_sys_bytes gauge\ngo_memstats_heap_sys_bytes 1.6121856e+07\n# HELP go_memstats_last_gc_time_seconds Number of seconds since 1970 of last garbage collection.\n# TYPE go_memstats_last_gc_time_seconds gauge\ngo_memstats_last_gc_time_seconds 1.7001045398775318e+09\n# HELP go_memstats_lookups_total Total number of pointer lookups.\n# TYPE go_memstats_lookups_total counter\ngo_memstats_lookups_total 0\n# HELP go_memstats_mallocs_total Total number of mallocs.\n# TYPE go_memstats_mallocs_total counter\ngo_memstats_mallocs_total 101293\n# HELP go_memstats_mcache_inuse_bytes Number of bytes in use by mcache structures.\n# TYPE go_memstats_mcache_inuse_bytes gauge\ngo_memstats_mcache_inuse_bytes 4800\n# HELP go_memstats_mcache_sys_bytes Number of bytes used for mcache structures obtained from system.\n# TYPE go_memstats_mcache_sys_bytes gauge\ngo_memstats_mcache_sys_bytes 15600\n# HELP go_memstats_mspan_inuse_bytes Number of bytes in use by mspan structures.\n# TYPE go_memstats_mspan_inuse_bytes gauge\ngo_memstats_mspan_inuse_bytes 177280\n# HELP go_memstats_mspan_sys_bytes Number of bytes used for mspan structures obtained from system.\n# TYPE go_memstats_mspan_sys_bytes gauge\ngo_memstats_mspan_sys_bytes 179520\n# HELP go_memstats_next_gc_bytes Number of heap bytes when next garbage collection will take place.\n# TYPE go_memstats_next_gc_bytes gauge\ngo_memstats_next_gc_bytes 1.4275312e+07\n# HELP go_memstats_other_sys_bytes Number of bytes used for other system allocations.\n# TYPE go_memstats_other_sys_bytes gauge\ngo_memstats_other_sys_bytes 895921\n# HELP go_memstats_stack_inuse_bytes Number of bytes in use by the stack allocator.\n# TYPE go_memstats_stack_inuse_bytes gauge\ngo_memstats_stack_inuse_bytes 655360\n# HELP go_memstats_stack_sys_bytes Number of bytes obtained from system for stack allocator.\n# TYPE go_memstats_stack_sys_bytes gauge\ngo_memstats_stack_sys_bytes 655360\n# HELP go_memstats_sys_bytes Number of bytes obtained from system.\n# TYPE go_memstats_sys_bytes gauge\ngo_memstats_sys_bytes 2.7915528e+07\n# HELP go_threads Number of OS threads created.\n# TYPE go_threads gauge\ngo_threads 9\n# HELP process_cpu_seconds_total Total user and system CPU time spent in seconds.\n# TYPE process_cpu_seconds_total counter\nprocess_cpu_seconds_total 0.38\n# HELP process_max_fds Maximum number of open file descriptors.\n# TYPE process_max_fds gauge\nprocess_max_fds 1.048576e+06\n# HELP process_open_fds Number of open file descriptors.\n# TYPE process_open_fds gauge\nprocess_open_fds 14\n# HELP process_resident_memory_bytes Resident memory size in bytes.\n# TYPE process_resident_memory_bytes gauge\nprocess_resident_memory_bytes 7.012352e+07\n# HELP process_start_time_seconds Start time of the process since unix epoch in seconds.\n# TYPE process_start_time_seconds gauge\nprocess_start_time_seconds 1.7001045391e+09\n# HELP process_virtual_memory_bytes Virtual memory size in bytes.\n# TYPE process_virtual_memory_bytes gauge\nprocess_virtual_memory_bytes 1.327280128e+09\n# HELP process_virtual_memory_max_bytes Maximum amount of virtual memory available in bytes.\n# TYPE process_virtual_memory_max_bytes gauge\nprocess_virtual_memory_max_bytes 1.8446744073709552e+19\n# HELP promhttp_metric_handler_requests_in_flight Current number of scrapes being served.\n# TYPE promhttp_metric_handler_requests_in_flight gauge\npromhttp_metric_handler_requests_in_flight 1\n# HELP promhttp_metric_handler_requests_total Total number of scrapes by HTTP status code.\n# TYPE promhttp_metric_handler_requests_total counter\npromhttp_metric_handler_requests_total{code=\"200\"} 0\npromhttp_metric_handler_requests_total{code=\"500\"} 0\npromhttp_metric_handler_requests_total{code=\"503\"} 0"

test rule

Create a Test Rule

Create a trial run rule, wait for it to run. This API can check syntax, ensuring the creation of an executable trial run rule.After the rule is created successfully, the websocket endpoint starts. Users can listen to the websocket address http://locahost:10081/test/uuid to get the result output. Among them, the port and id are the above return values.

Request Body schema: application/json
id
required
string or null

The id of the test rule, required, used for subsequent test rule management. Ensure uniqueness, it cannot be repeated with other test rules, otherwise the original test rule will be overwritten. This id has no association with the id of ordinary rules.

sql
required
string or null

The sql statement of the test rule, required, used to define the syntax of the test rule.

required
object or null

The mock rule definition of the data source of the test rule, optional, used to define the input data of the test rule. If not defined, the real data source in SQL will be used.

required
object or null

The definition of the sink parameters of the test rule, optional. Most of the common parameters of the sink can be used, such as dataTemplate and fields. If not defined, the default sink parameters will be used.

Responses

Request samples

Content type
application/json
{
  • "id": "uuid",
  • "sql": "select * from demo",
  • "mockSource": {
    },
  • "sinkProps": {
    }
}

Response samples

Content type
application/json
{
  • "id": "uuid",
  • "port": 10081
}

Start the Test Rule

Start the trial run rule, WebSocket will be able to receive the data output after the rule runs.

path Parameters
id
required
string

Responses

Response samples

Content type
application/json
"Test rule uuid was started"

Delete the Test Rule

Delete the trial run rule, WebSocket will stop the service.

path Parameters
id
required
string

Responses

Response samples

Content type
application/json
"Test rule uuid was stopped"

udf

Create a UDF

Besides defining function in plugins, user-defined functions (UDF) are also supported independently. Currently, we only support JavaScript UDF. We can use REST API or CLI to manage JavaScript functions.

Use this endpoint to create a new function.

Request Body schema: application/json
id
required
string

A unique name for the function. This name must also be defined as a function in the script field.

description
required
string

A brief description of the function.

script
required
string

The function implementation in JavaScript.

isAgg
required
boolean

A boolean indicating whether the function is an aggregate function.

Responses

Request samples

Content type
application/json
{
  • "id": "area",
  • "description": "calculate area",
  • "script": "function area(x, y) { return x * y; }",
  • "isAgg": false
}

Response samples

Content type
application/json
{ }

List UDFs

Use this endpoint to display all JavaScript functions defined in the server.The response will be a list of function names.

Responses

Response samples

Content type
application/json
[
  • "area"
]

Describe a UDF

Use this endpoint to get the detailed definition of a function.Replace {id} with the name of the function you want to describe. The response will be a JSON object with the function's details.

path Parameters
id
required
string

Responses

Response samples

Content type
application/json
{
  • "id": "area",
  • "description": "calculate area",
  • "script": "function area(x, y) { return x * y; }",
  • "isAgg": false
}

Delete a UDF

Use this endpoint to delete a function.Replace {id} with the name of the function you want to delete. Note that you need to manually stop or delete any rules using the UDF before deleting it. A running rule will not be affected by the deletion of a UDF.

path Parameters
id
required
string

Responses

Response samples

Content type
application/json
{ }

Update a UDF

The JavaScript UDF can be updated and hot reload. Notice that, a running rule must be restarted to load the updated function.Replace {id} with the name of the function you want to update. The request body should be the same as when creating a UDF. If the function of the id does not exist, it will be created. Otherwise, it will be updated.

path Parameters
id
required
string

Responses

Response samples

Content type
application/json
{ }