LM RESTful API

Logic Manager API is used to manage lvars, rules and other logic elements

This document describes API methods for RESTful calls. For direct and JSON RPC calls look LM API.

RESTful API basics

Majority EVA ICS API components and items support REST. Parameters for POST, PUT, PATCH and DELETE requests can be sent in both JSON and multipart/form-data. For JSON, Content-Type: application/json header must be specified.

Requests

API key can be sent in HTTP X-Auth-Key header (preferred) or in request parameters (as k).

  • GET request is used to get information about resource or list of resources of the specified type.
  • POST request is used to perform special API calls and create resources in case when resource id is generated by server. In the last case, response always contains additional field Location which points to the resource created.
  • PUT request is used to create new resources. If resource already exists, the server could refuse recreating it, responding with 409 Conflict HTTP error.
  • PATCH request is used to modify resource parameters.
  • DELETE request is used to delete resource.

For resource creation and modification, multiple parameters can be specified in a single request. For majority requests of such purpose, a special parameter “save” is used to tell server (if “save”: true) to save the resource configuration immediately after its modification.

For the group-related calls, put trailing slash at the end of the request URL:

/r/<resource_type>/<group>/

Responses

Success responses:

  • 200 OK API call completed successfully
  • 201 Created API call completed successfully, Response header Location contains either uri to the newly created object or resource is accessible by the effective request uri. For resources created with PUT, body contains either serialized resource object or resource type and id
  • 202 Accepted The server accepted command and will process it later.
  • 204 No Content API call completed successfully, no content to return

Error responses:

  • 403 Forbidden the API key has no access to this function or resource
  • 404 Not Found resource doesn’t exist
  • 405 Method Not Allowed API function/method not found
  • 409 Conflict resource/object already exists or is locked
  • 500 API Error API function execution has been failed. Check input parameters and server logs.

Response body may contain additional information encoded in JSON. { “result”: “OK” } and { “result”: “ERROR” } in body are not returned.

Contents

General functions

test API/key and get system info

Test can be executed with any valid API key of the controller the function is called to.

http

GET /r/core HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey

curl

curl -i http://localhost:8817/r/core -H 'X-Auth-Key: mykey'

wget

wget -S -O- http://localhost:8817/r/core --header='X-Auth-Key: mykey'

httpie

http http://localhost:8817/r/core X-Auth-Key:mykey

python-requests

requests.get('http://localhost:8817/r/core', headers={
    'X-Auth-Key': 'mykey',
})

response

HTTP/1.1 200 OK
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Content-Type: application/json
Expires: 0
Pragma: no-cache

{
    "acl": {
        "key_id": "masterkey",
        "master": true
    },
    "db_update": 1,
    "debug": true,
    "file_management": true,
    "layout": "enterprise",
    "polldelay": 0.01,
    "product_build": 2019031405,
    "product_code": "lm",
    "product_name": "EVA Logic Manager",
    "setup_mode": false,
    "system": "ws1-v1",
    "time": 1553193499.7972682,
    "uptime": 658,
    "version": "3.2.0"
}

Parameters:

  • API Key any valid API key

Returns:

JSON dict with system info and current API key permissions (for masterkey only { “master”: true } is returned)

save database and runtime configuration

All modified items, their status, and configuration will be written to the disk. If exec_before_save command is defined in the controller’s configuration file, it’s called before saving and exec_after_save after (e.g. to switch the partition to write mode and back to read-only).

http

POST /r/core HTTP/1.1
Host: localhost:8812
X-Auth-Key: mykey
Content-Type: application/json

{ "method": "save" }

curl

curl -i -X POST http://localhost:8812/r/core -H 'Content-Type: application/json' -H 'X-Auth-Key: mykey' --data-raw '{"method": "save"}'

wget

wget -S -O- http://localhost:8812/r/core --header='Content-Type: application/json' --header='X-Auth-Key: mykey' --post-data='{"method": "save"}'

httpie

echo '{
  "method": "save"
}' | http POST http://localhost:8812/r/core Content-Type:application/json X-Auth-Key:mykey

python-requests

requests.post('http://localhost:8812/r/core', headers={
    'Content-Type': 'application/json',
    'X-Auth-Key': 'mykey',
}, json={
    'method': 'save',
})

response

HTTP/1.1 204 No Content
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Expires: 0
Pragma: no-cache

Parameters:

  • API Key API key with sysfunc=yes permissions

execute a remote system command

Executes a command script on the server where the controller is installed.

http

POST /r/cmd/test HTTP/1.1
Host: localhost:8812
X-Auth-Key: mykey
Content-Type: application/json

{ "a": "0 2 3", "w": 5, "t": 10 }

curl

curl -i -X POST http://localhost:8812/r/cmd/test -H 'Content-Type: application/json' -H 'X-Auth-Key: mykey' --data-raw '{"a": "0 2 3", "t": 10, "w": 5}'

wget

wget -S -O- http://localhost:8812/r/cmd/test --header='Content-Type: application/json' --header='X-Auth-Key: mykey' --post-data='{"a": "0 2 3", "t": 10, "w": 5}'

httpie

echo '{
  "a": "0 2 3",
  "t": 10,
  "w": 5
}' | http POST http://localhost:8812/r/cmd/test Content-Type:application/json X-Auth-Key:mykey

python-requests

requests.post('http://localhost:8812/r/cmd/test', headers={
    'Content-Type': 'application/json',
    'X-Auth-Key': 'mykey',
}, json={
    'a': '0 2 3',
    't': 10,
    'w': 5,
})

response

HTTP/1.1 200 OK
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Content-Type: application/json
Expires: 0
Pragma: no-cache

{
    "args": [
        "0",
        "2",
        "3"
    ],
    "cmd": "test",
    "err": "some text to stderr\n",
    "exitcode": 0,
    "out": "test script start\nparam 1: 0 ( > 0 will generate \"failed\" status)\nparam 2: 2\nparam 3: 3\ndelay 3 sec\nscript finish\n",
    "status": "completed",
    "time": {
        "completed": 1552863480.7081513,
        "created": 1552863480.6993306,
        "running": 1552863480.7001197
    },
    "timeout": 10.0
}

Parameters:

  • API Key API key with allow=cmd permissions

Optionally:

  • a string of command arguments, separated by spaces (passed to the script)
  • w wait (in seconds) before API call sends a response. This allows to try waiting until command finish
  • t maximum time of command execution. If the command fails to finish within the specified time (in sec), it will be terminated

shutdown the controller

Controller process will be exited and then (should be) restarted by watchdog. This allows to restart controller remotely.

http

POST /r/core HTTP/1.1
Host: localhost:8812
X-Auth-Key: mykey
Content-Type: application/json

{ "method": "shutdown" }

curl

curl -i -X POST http://localhost:8812/r/core -H 'Content-Type: application/json' -H 'X-Auth-Key: mykey' --data-raw '{"method": "shutdown"}'

wget

wget -S -O- http://localhost:8812/r/core --header='Content-Type: application/json' --header='X-Auth-Key: mykey' --post-data='{"method": "shutdown"}'

httpie

echo '{
  "method": "shutdown"
}' | http POST http://localhost:8812/r/core Content-Type:application/json X-Auth-Key:mykey

python-requests

requests.post('http://localhost:8812/r/core', headers={
    'Content-Type': 'application/json',
    'X-Auth-Key': 'mykey',
}, json={
    'method': 'shutdown',
})

response

HTTP/1.1 202 Accepted
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Expires: 0
Pragma: no-cache

Parameters:

  • API Key API key with master permissions

switch debugging mode

Enables and disables debugging mode while the controller is running. After the controller is restarted, this parameter is lost and controller switches back to the mode specified in the configuration file.

http

PATCH /r/core HTTP/1.1
Host: localhost:8812
X-Auth-Key: mykey
Content-Type: application/json

{ "debug": true }

curl

curl -i -X PATCH http://localhost:8812/r/core -H 'Content-Type: application/json' -H 'X-Auth-Key: mykey' --data-raw '{"debug": true}'

wget

wget -S -O- --method=PATCH http://localhost:8812/r/core --header='Content-Type: application/json' --header='X-Auth-Key: mykey' --body-data='{"debug": true}'

httpie

echo '{
  "debug": true
}' | http PATCH http://localhost:8812/r/core Content-Type:application/json X-Auth-Key:mykey

python-requests

requests.patch('http://localhost:8812/r/core', headers={
    'Content-Type': 'application/json',
    'X-Auth-Key': 'mykey',
}, json={
    'debug': True,
})

response

HTTP/1.1 204 No Content
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Expires: 0
Pragma: no-cache

Parameters:

  • API Key API key with master permissions
  • debug true for enabling debug mode, false for disabling

log in and get authentication token

Obtains authentication token which can be used in API calls instead of API key.

If both k and u args are absent, but API method is called with HTTP request, which contain HTTP header for basic authorization, the function will try to parse it and log in user with credentials provided.

http

POST /r/token HTTP/1.1
Host: localhost:8817
Content-Type: application/json

{ "u": "admin", "p": "123" }

curl

curl -i -X POST http://localhost:8817/r/token -H 'Content-Type: application/json' --data-raw '{"p": "123", "u": "admin"}'

wget

wget -S -O- http://localhost:8817/r/token --header='Content-Type: application/json' --post-data='{"p": "123", "u": "admin"}'

httpie

echo '{
  "p": "123",
  "u": "admin"
}' | http POST http://localhost:8817/r/token Content-Type:application/json

python-requests

requests.post('http://localhost:8817/r/token', headers={
    'Content-Type': 'application/json',
}, json={
    'p': '123',
    'u': 'admin',
})

response

HTTP/1.1 200 OK
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Content-Type: application/json
Expires: 0
Pragma: no-cache

{
    "key": "masterkey",
    "token": "token:1c166529bc3b06dac6e0fbaefee38ebe77c455480e11ff4431de2b10a5508899"
}

Parameters:

  • API Key valid API key or
  • u user login
  • p user password

Returns:

A dict, containing API key ID and authentication token

log out and purge authentication token

Purges authentication token

If API key is used as parameter value, the function purges all tokens assigned to it.

http

DELETE /r/token HTTP/1.1
Host: localhost:8812
X-Auth-Key: token:c063c19fb54dd6b773b4f236f26ea7e5fbaa96f48b103221ae1107420096aef7

curl

curl -i -X DELETE http://localhost:8812/r/token -H 'X-Auth-Key: token:c063c19fb54dd6b773b4f236f26ea7e5fbaa96f48b103221ae1107420096aef7'

wget

wget -S -O- --method=DELETE http://localhost:8812/r/token --header='X-Auth-Key: token:c063c19fb54dd6b773b4f236f26ea7e5fbaa96f48b103221ae1107420096aef7'

httpie

http DELETE http://localhost:8812/r/token X-Auth-Key:token:c063c19fb54dd6b773b4f236f26ea7e5fbaa96f48b103221ae1107420096aef7

python-requests

requests.delete('http://localhost:8812/r/token', headers={
    'X-Auth-Key': 'token:c063c19fb54dd6b773b4f236f26ea7e5fbaa96f48b103221ae1107420096aef7',
})

response

HTTP/1.1 204 No Content
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Expires: 0
Pragma: no-cache

Parameters:

  • API Key valid API key or token

LVar functions

clear lvar state

set status (if expires lvar param > 0) or value (if expires isn’t set) of a logic variable to 0. Useful when lvar is used as a timer to stop it, or as a flag to set it False.

http

POST /r/lvar/tests/lvar1 HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey
Content-Type: application/json

{ "s": "clear" }

curl

curl -i -X POST http://localhost:8817/r/lvar/tests/lvar1 -H 'Content-Type: application/json' -H 'X-Auth-Key: mykey' --data-raw '{"s": "clear"}'

wget

wget -S -O- http://localhost:8817/r/lvar/tests/lvar1 --header='Content-Type: application/json' --header='X-Auth-Key: mykey' --post-data='{"s": "clear"}'

httpie

echo '{
  "s": "clear"
}' | http POST http://localhost:8817/r/lvar/tests/lvar1 Content-Type:application/json X-Auth-Key:mykey

python-requests

requests.post('http://localhost:8817/r/lvar/tests/lvar1', headers={
    'Content-Type': 'application/json',
    'X-Auth-Key': 'mykey',
}, json={
    's': 'clear',
})

response

HTTP/1.1 204 No Content
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Expires: 0
Pragma: no-cache

Parameters:

  • API Key valid API key

get item group list

Get the list of item groups. Useful e.g. for custom interfaces.

http

GET /r/lvar/@groups HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey

curl

curl -i http://localhost:8817/r/lvar/@groups -H 'X-Auth-Key: mykey'

wget

wget -S -O- http://localhost:8817/r/lvar/@groups --header='X-Auth-Key: mykey'

httpie

http http://localhost:8817/r/lvar/@groups X-Auth-Key:mykey

python-requests

requests.get('http://localhost:8817/r/lvar/@groups', headers={
    'X-Auth-Key': 'mykey',
})

response

HTTP/1.1 200 OK
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Content-Type: application/json
Expires: 0
Pragma: no-cache

[
    "nogroup",
    "tests",
    "timers"
]

Parameters:

  • API Key valid API key

get item state history

State history of one item or several items of the specified type can be obtained using state_history command.

http

GET /r/lvar/lvar:tests/lvar1@history HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey

curl

curl -i http://localhost:8817/r/lvar/lvar:tests/lvar1@history -H 'X-Auth-Key: mykey'

wget

wget -S -O- http://localhost:8817/r/lvar/lvar:tests/lvar1@history --header='X-Auth-Key: mykey'

httpie

http http://localhost:8817/r/lvar/lvar:tests/lvar1@history X-Auth-Key:mykey

python-requests

requests.get('http://localhost:8817/r/lvar/lvar:tests/lvar1@history', headers={
    'X-Auth-Key': 'mykey',
})

response

HTTP/1.1 200 OK
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Content-Type: application/json
Expires: 0
Pragma: no-cache

{
    "status": [
        1,
        1,
        1
    ],
    "t": [
        1553193500.1192024,
        1553193500.199146,
        1553193500.2409995
    ],
    "value": [
        1.0,
        null,
        null
    ]
}

Parameters:

  • API Key valid API key
  • a history notifier id (default: db_1)

Optionally:

  • s start time (timestamp or ISO)
  • e end time (timestamp or ISO)
  • l records limit (doesn’t work with “w”)
  • x state prop (“status” or “value”)
  • t time format(“iso” or “raw” for unix timestamp, default is “raw”)
  • w fill frame with the interval (e.g. “1T” - 1 min, “2H” - 2 hours etc.), start time is required
  • g output format (“list” or “dict”, default is “list”)

get lvar state

State of lvar or all lvars can be obtained using state command.

http

GET /r/lvar HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey

curl

curl -i http://localhost:8817/r/lvar -H 'X-Auth-Key: mykey'

wget

wget -S -O- http://localhost:8817/r/lvar --header='X-Auth-Key: mykey'

httpie

http http://localhost:8817/r/lvar X-Auth-Key:mykey

python-requests

requests.get('http://localhost:8817/r/lvar', headers={
    'X-Auth-Key': 'mykey',
})

response

HTTP/1.1 200 OK
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Content-Type: application/json
Expires: 0
Pragma: no-cache

[
    {
        "expires": 0,
        "full_id": "nogroup/flag1",
        "group": "nogroup",
        "id": "flag1",
        "oid": "lvar:nogroup/flag1",
        "set_time": 1528751049.3848495,
        "status": 1,
        "type": "lvar",
        "value": "1"
    },
    {
        "expires": 5.0,
        "full_id": "nogroup/timer1",
        "group": "nogroup",
        "id": "timer1",
        "oid": "lvar:nogroup/timer1",
        "set_time": 1552049990.9313273,
        "status": -1,
        "type": "lvar",
        "value": "null"
    },
    {
        "expires": 15.0,
        "full_id": "tests/lvar1",
        "group": "tests",
        "id": "lvar1",
        "oid": "lvar:tests/lvar1",
        "set_time": 1553193500.1979027,
        "status": 1,
        "type": "lvar",
        "value": "null"
    },
    {
        "expires": 30.0,
        "full_id": "tests/lvar2",
        "group": "tests",
        "id": "lvar2",
        "oid": "lvar:tests/lvar2",
        "set_time": 1553193499.8252523,
        "status": 1,
        "type": "lvar",
        "value": "null"
    },
    {
        "expires": 100.0,
        "full_id": "timers/timer1",
        "group": "timers",
        "id": "timer1",
        "oid": "lvar:timers/timer1",
        "set_time": 1552062897.9593153,
        "status": -1,
        "type": "lvar",
        "value": "null"
    }
]

Parameters:

  • API Key valid API key

Optionally:

reset lvar state

Set status and value of a logic variable to 1. Useful when lvar is being used as a timer to reset it, or as a flag to set it True.

http

POST /r/lvar/tests/lvar1 HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey
Content-Type: application/json

{ "s": "reset" }

curl

curl -i -X POST http://localhost:8817/r/lvar/tests/lvar1 -H 'Content-Type: application/json' -H 'X-Auth-Key: mykey' --data-raw '{"s": "reset"}'

wget

wget -S -O- http://localhost:8817/r/lvar/tests/lvar1 --header='Content-Type: application/json' --header='X-Auth-Key: mykey' --post-data='{"s": "reset"}'

httpie

echo '{
  "s": "reset"
}' | http POST http://localhost:8817/r/lvar/tests/lvar1 Content-Type:application/json X-Auth-Key:mykey

python-requests

requests.post('http://localhost:8817/r/lvar/tests/lvar1', headers={
    'Content-Type': 'application/json',
    'X-Auth-Key': 'mykey',
}, json={
    's': 'reset',
})

response

HTTP/1.1 204 No Content
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Expires: 0
Pragma: no-cache

Parameters:

  • API Key valid API key

set lvar state

Set status and value of a logic variable.

http

POST /r/lvar/lvar:tests/lvar1 HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey
Content-Type: application/json

{ "s": 1, "v": 29.445 }

curl

curl -i -X POST http://localhost:8817/r/lvar/lvar:tests/lvar1 -H 'Content-Type: application/json' -H 'X-Auth-Key: mykey' --data-raw '{"s": 1, "v": 29.445}'

wget

wget -S -O- http://localhost:8817/r/lvar/lvar:tests/lvar1 --header='Content-Type: application/json' --header='X-Auth-Key: mykey' --post-data='{"s": 1, "v": 29.445}'

httpie

echo '{
  "s": 1,
  "v": 29.445
}' | http POST http://localhost:8817/r/lvar/lvar:tests/lvar1 Content-Type:application/json X-Auth-Key:mykey

python-requests

requests.post('http://localhost:8817/r/lvar/lvar:tests/lvar1', headers={
    'Content-Type': 'application/json',
    'X-Auth-Key': 'mykey',
}, json={
    's': 1,
    'v': 29.445,
})

response

HTTP/1.1 204 No Content
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Expires: 0
Pragma: no-cache

Parameters:

  • API Key valid API key

Optionally:

  • s lvar status
  • v lvar value

toggle lvar state

switch value of a logic variable between 0 and 1. Useful when lvar is being used as a flag to switch it between True/False.

http

POST /r/lvar/tests/lvar1 HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey
Content-Type: application/json

{ "s": "toggle" }

curl

curl -i -X POST http://localhost:8817/r/lvar/tests/lvar1 -H 'Content-Type: application/json' -H 'X-Auth-Key: mykey' --data-raw '{"s": "toggle"}'

wget

wget -S -O- http://localhost:8817/r/lvar/tests/lvar1 --header='Content-Type: application/json' --header='X-Auth-Key: mykey' --post-data='{"s": "toggle"}'

httpie

echo '{
  "s": "toggle"
}' | http POST http://localhost:8817/r/lvar/tests/lvar1 Content-Type:application/json X-Auth-Key:mykey

python-requests

requests.post('http://localhost:8817/r/lvar/tests/lvar1', headers={
    'Content-Type': 'application/json',
    'X-Auth-Key': 'mykey',
}, json={
    's': 'toggle',
})

response

HTTP/1.1 204 No Content
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Expires: 0
Pragma: no-cache

Parameters:

  • API Key valid API key

LVar management

list lvars

Parameters:

  • API Key API key with master permissions

Optionally:

Returns:

the list of all lvars available

create lvar

Create new lvar

http

PUT /r/lvar/tests/lvar2 HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey
Content-Type: application/json

{ "save": true, "expires": 30 }

curl

curl -i -X PUT http://localhost:8817/r/lvar/tests/lvar2 -H 'Content-Type: application/json' -H 'X-Auth-Key: mykey' --data-raw '{"expires": 30, "save": true}'

wget

wget -S -O- --method=PUT http://localhost:8817/r/lvar/tests/lvar2 --header='Content-Type: application/json' --header='X-Auth-Key: mykey' --body-data='{"expires": 30, "save": true}'

httpie

echo '{
  "expires": 30,
  "save": true
}' | http PUT http://localhost:8817/r/lvar/tests/lvar2 Content-Type:application/json X-Auth-Key:mykey

python-requests

requests.put('http://localhost:8817/r/lvar/tests/lvar2', headers={
    'Content-Type': 'application/json',
    'X-Auth-Key': 'mykey',
}, json={
    'expires': 30,
    'save': True,
})

response

HTTP/1.1 201 Created
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Content-Type: application/json
Expires: 0
Pragma: no-cache

{
    "config_changed": false,
    "description": "",
    "expires": 30.0,
    "full_id": "tests/lvar2",
    "group": "tests",
    "id": "lvar2",
    "oid": "lvar:tests/lvar2",
    "set_time": 1553193499.8252523,
    "status": 1,
    "type": "lvar",
    "value": "null"
}

Parameters:

  • API Key API key with master permissions

Optionally:

  • save save lvar configuration immediately

delete lvar

http

DELETE /r/lvar/tests/lvar2 HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey

curl

curl -i -X DELETE http://localhost:8817/r/lvar/tests/lvar2 -H 'X-Auth-Key: mykey'

wget

wget -S -O- --method=DELETE http://localhost:8817/r/lvar/tests/lvar2 --header='X-Auth-Key: mykey'

httpie

http DELETE http://localhost:8817/r/lvar/tests/lvar2 X-Auth-Key:mykey

python-requests

requests.delete('http://localhost:8817/r/lvar/tests/lvar2', headers={
    'X-Auth-Key': 'mykey',
})

response

HTTP/1.1 204 No Content
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Expires: 0
Pragma: no-cache

Parameters:

  • API Key API key with master permissions

get lvar configuration

http

GET /r/lvar/tests/lvar2@config HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey

curl

curl -i http://localhost:8817/r/lvar/tests/lvar2@config -H 'X-Auth-Key: mykey'

wget

wget -S -O- http://localhost:8817/r/lvar/tests/lvar2@config --header='X-Auth-Key: mykey'

httpie

http http://localhost:8817/r/lvar/tests/lvar2@config X-Auth-Key:mykey

python-requests

requests.get('http://localhost:8817/r/lvar/tests/lvar2@config', headers={
    'X-Auth-Key': 'mykey',
})

response

HTTP/1.1 200 OK
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Content-Type: application/json
Expires: 0
Pragma: no-cache

{
    "expires": 30.0,
    "full_id": "tests/lvar2",
    "group": "tests",
    "id": "lvar2",
    "oid": "lvar:tests/lvar2",
    "set_time": 1553193499.8252523,
    "type": "lvar"
}

Parameters:

  • API Key API key with master permissions

Returns:

complete lvar configuration.

list lvar properties

Get all editable parameters of the lvar confiugration.

http

GET /r/lvar/tests/lvar1@props HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey

curl

curl -i http://localhost:8817/r/lvar/tests/lvar1@props -H 'X-Auth-Key: mykey'

wget

wget -S -O- http://localhost:8817/r/lvar/tests/lvar1@props --header='X-Auth-Key: mykey'

httpie

http http://localhost:8817/r/lvar/tests/lvar1@props X-Auth-Key:mykey

python-requests

requests.get('http://localhost:8817/r/lvar/tests/lvar1@props', headers={
    'X-Auth-Key': 'mykey',
})

response

HTTP/1.1 200 OK
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Content-Type: application/json
Expires: 0
Pragma: no-cache

{
    "description": "",
    "expires": 0,
    "mqtt_update": null,
    "set_time": 1553193500.117168,
    "update_delay": 0,
    "update_exec": null,
    "update_interval": 0,
    "update_timeout": null
}

Parameters:

  • API Key API key with master permissions

save lvar configuration

Saves lvar. configuration on disk (even if it hasn’t been changed)

http

POST /r/lvar/tests/lvar1 HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey
Content-Type: application/json

{ "method": "save" }

curl

curl -i -X POST http://localhost:8817/r/lvar/tests/lvar1 -H 'Content-Type: application/json' -H 'X-Auth-Key: mykey' --data-raw '{"method": "save"}'

wget

wget -S -O- http://localhost:8817/r/lvar/tests/lvar1 --header='Content-Type: application/json' --header='X-Auth-Key: mykey' --post-data='{"method": "save"}'

httpie

echo '{
  "method": "save"
}' | http POST http://localhost:8817/r/lvar/tests/lvar1 Content-Type:application/json X-Auth-Key:mykey

python-requests

requests.post('http://localhost:8817/r/lvar/tests/lvar1', headers={
    'Content-Type': 'application/json',
    'X-Auth-Key': 'mykey',
}, json={
    'method': 'save',
})

response

HTTP/1.1 204 No Content
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Expires: 0
Pragma: no-cache

Parameters:

  • API Key API key with master permissions

set lvar property

Set configuration parameters of the lvar.

http

PATCH /r/lvar/tests/lvar1 HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey
Content-Type: application/json

{ "expires": 15 }

curl

curl -i -X PATCH http://localhost:8817/r/lvar/tests/lvar1 -H 'Content-Type: application/json' -H 'X-Auth-Key: mykey' --data-raw '{"expires": 15}'

wget

wget -S -O- --method=PATCH http://localhost:8817/r/lvar/tests/lvar1 --header='Content-Type: application/json' --header='X-Auth-Key: mykey' --body-data='{"expires": 15}'

httpie

echo '{
  "expires": 15
}' | http PATCH http://localhost:8817/r/lvar/tests/lvar1 Content-Type:application/json X-Auth-Key:mykey

python-requests

requests.patch('http://localhost:8817/r/lvar/tests/lvar1', headers={
    'Content-Type': 'application/json',
    'X-Auth-Key': 'mykey',
}, json={
    'expires': 15,
})

response

HTTP/1.1 204 No Content
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Expires: 0
Pragma: no-cache

Parameters:

  • API Key API key with master permissions

Optionally:

  • save save configuration after successful call

Decision matrix rules

create new rule

Creates new decision rule. Rule id (UUID) is generated automatically unless specified.

http

POST /r/dmatrix_rule HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey

curl

curl -i -X POST http://localhost:8817/r/dmatrix_rule -H 'X-Auth-Key: mykey'

wget

wget -S -O- http://localhost:8817/r/dmatrix_rule --header='X-Auth-Key: mykey'

httpie

http POST http://localhost:8817/r/dmatrix_rule X-Auth-Key:mykey

python-requests

requests.post('http://localhost:8817/r/dmatrix_rule', headers={
    'X-Auth-Key': 'mykey',
})

response

HTTP/1.1 201 Created
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Content-Type: application/json
Expires: 0
Location: /r/dmatrix_rule/cc7de0ba-04a1-4161-ad73-588861b6e1ef
Pragma: no-cache

{
    "break_after_exec": false,
    "chillout_ends_in": 0,
    "chillout_time": 0,
    "condition": "",
    "description": "",
    "enabled": false,
    "for_initial": "skip",
    "for_item_group": null,
    "for_item_id": null,
    "for_item_type": null,
    "for_oid": "#:#/#/status",
    "for_prop": "status",
    "id": "cc7de0ba-04a1-4161-ad73-588861b6e1ef",
    "in_range_max": null,
    "in_range_max_eq": false,
    "in_range_min": null,
    "in_range_min_eq": false,
    "macro": null,
    "macro_args": [],
    "macro_kwargs": {},
    "oid": "dmatrix_rule:dm_rules/cc7de0ba-04a1-4161-ad73-588861b6e1ef",
    "priority": 100,
    "type": "dmatrix_rule"
}

Parameters:

  • API Key API key with master permissions

Optionally:

  • save save unit configuration immediately

delete rule

Deletes decision rule.

http

DELETE /r/dmatrix_rule/4c6e8c99-56fe-490c-8442-4936ba777498 HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey

curl

curl -i -X DELETE http://localhost:8817/r/dmatrix_rule/4c6e8c99-56fe-490c-8442-4936ba777498 -H 'X-Auth-Key: mykey'

wget

wget -S -O- --method=DELETE http://localhost:8817/r/dmatrix_rule/4c6e8c99-56fe-490c-8442-4936ba777498 --header='X-Auth-Key: mykey'

httpie

http DELETE http://localhost:8817/r/dmatrix_rule/4c6e8c99-56fe-490c-8442-4936ba777498 X-Auth-Key:mykey

python-requests

requests.delete('http://localhost:8817/r/dmatrix_rule/4c6e8c99-56fe-490c-8442-4936ba777498', headers={
    'X-Auth-Key': 'mykey',
})

response

HTTP/1.1 204 No Content
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Expires: 0
Pragma: no-cache

Parameters:

  • API Key API key with master permissions

get rule information

http

GET /r/dmatrix_rule/4c6e8c99-56fe-490c-8442-4936ba777498 HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey

curl

curl -i http://localhost:8817/r/dmatrix_rule/4c6e8c99-56fe-490c-8442-4936ba777498 -H 'X-Auth-Key: mykey'

wget

wget -S -O- http://localhost:8817/r/dmatrix_rule/4c6e8c99-56fe-490c-8442-4936ba777498 --header='X-Auth-Key: mykey'

httpie

http http://localhost:8817/r/dmatrix_rule/4c6e8c99-56fe-490c-8442-4936ba777498 X-Auth-Key:mykey

python-requests

requests.get('http://localhost:8817/r/dmatrix_rule/4c6e8c99-56fe-490c-8442-4936ba777498', headers={
    'X-Auth-Key': 'mykey',
})

response

HTTP/1.1 200 OK
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Content-Type: application/json
Expires: 0
Pragma: no-cache

{
    "break_after_exec": false,
    "chillout_ends_in": 0,
    "chillout_time": 0,
    "condition": "",
    "description": "",
    "enabled": false,
    "for_initial": "skip",
    "for_item_group": null,
    "for_item_id": null,
    "for_item_type": null,
    "for_oid": "#:#/#/status",
    "for_prop": "status",
    "id": "4c6e8c99-56fe-490c-8442-4936ba777498",
    "in_range_max": null,
    "in_range_max_eq": false,
    "in_range_min": null,
    "in_range_min_eq": false,
    "macro": null,
    "macro_args": [],
    "macro_kwargs": {},
    "oid": "dmatrix_rule:dm_rules/4c6e8c99-56fe-490c-8442-4936ba777498",
    "priority": 100,
    "type": "dmatrix_rule"
}

Parameters:

  • API Key valid API key

get rules list

Get the list of all available decision rules.

http

GET /r/dmatrix_rule HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey

curl

curl -i http://localhost:8817/r/dmatrix_rule -H 'X-Auth-Key: mykey'

wget

wget -S -O- http://localhost:8817/r/dmatrix_rule --header='X-Auth-Key: mykey'

httpie

http http://localhost:8817/r/dmatrix_rule X-Auth-Key:mykey

python-requests

requests.get('http://localhost:8817/r/dmatrix_rule', headers={
    'X-Auth-Key': 'mykey',
})

response

HTTP/1.1 200 OK
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Content-Type: application/json
Expires: 0
Pragma: no-cache

[
    {
        "break_after_exec": false,
        "chillout_ends_in": 0,
        "chillout_time": 0,
        "condition": "",
        "description": "",
        "enabled": false,
        "for_initial": "skip",
        "for_item_group": null,
        "for_item_id": null,
        "for_item_type": null,
        "for_oid": "#:#/#/status",
        "for_prop": "status",
        "id": "4c6e8c99-56fe-490c-8442-4936ba777498",
        "in_range_max": null,
        "in_range_max_eq": false,
        "in_range_min": null,
        "in_range_min_eq": false,
        "macro": null,
        "macro_args": [],
        "macro_kwargs": {},
        "oid": "dmatrix_rule:dm_rules/4c6e8c99-56fe-490c-8442-4936ba777498",
        "priority": 100,
        "type": "dmatrix_rule"
    },
    {
        "break_after_exec": false,
        "chillout_ends_in": 0,
        "chillout_time": 0,
        "condition": "",
        "description": "",
        "enabled": false,
        "for_initial": "skip",
        "for_item_group": null,
        "for_item_id": null,
        "for_item_type": null,
        "for_oid": "#:#/#/status",
        "for_prop": "status",
        "id": "9b317323-00e5-4e11-8573-33cdcada1d12",
        "in_range_max": null,
        "in_range_max_eq": false,
        "in_range_min": null,
        "in_range_min_eq": false,
        "macro": null,
        "macro_args": [],
        "macro_kwargs": {},
        "oid": "dmatrix_rule:dm_rules/9b317323-00e5-4e11-8573-33cdcada1d12",
        "priority": 100,
        "type": "dmatrix_rule"
    },
    {
        "break_after_exec": false,
        "chillout_ends_in": 0,
        "chillout_time": 0,
        "condition": "",
        "description": "",
        "enabled": false,
        "for_initial": "skip",
        "for_item_group": null,
        "for_item_id": null,
        "for_item_type": null,
        "for_oid": "#:#/#/status",
        "for_prop": "status",
        "id": "cc7de0ba-04a1-4161-ad73-588861b6e1ef",
        "in_range_max": null,
        "in_range_max_eq": false,
        "in_range_min": null,
        "in_range_min_eq": false,
        "macro": null,
        "macro_args": [],
        "macro_kwargs": {},
        "oid": "dmatrix_rule:dm_rules/cc7de0ba-04a1-4161-ad73-588861b6e1ef",
        "priority": 100,
        "type": "dmatrix_rule"
    }
]

Parameters:

  • API Key valid API key

list rule properties

Get all editable parameters of the decision rule.

http

GET /r/dmatrix_rule/4c6e8c99-56fe-490c-8442-4936ba777498@props HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey

curl

curl -i http://localhost:8817/r/dmatrix_rule/4c6e8c99-56fe-490c-8442-4936ba777498@props -H 'X-Auth-Key: mykey'

wget

wget -S -O- http://localhost:8817/r/dmatrix_rule/4c6e8c99-56fe-490c-8442-4936ba777498@props --header='X-Auth-Key: mykey'

httpie

http http://localhost:8817/r/dmatrix_rule/4c6e8c99-56fe-490c-8442-4936ba777498@props X-Auth-Key:mykey

python-requests

requests.get('http://localhost:8817/r/dmatrix_rule/4c6e8c99-56fe-490c-8442-4936ba777498@props', headers={
    'X-Auth-Key': 'mykey',
})

response

HTTP/1.1 200 OK
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Content-Type: application/json
Expires: 0
Pragma: no-cache

{
    "break_after_exec": false,
    "chillout_time": 0,
    "condition": "",
    "description": "",
    "enabled": false,
    "for_initial": "skip",
    "for_item_group": null,
    "for_item_id": null,
    "for_item_type": null,
    "for_oid": "#:#/#/status",
    "for_prop": "status",
    "in_range_max": null,
    "in_range_max_eq": false,
    "in_range_min": null,
    "in_range_min_eq": false,
    "macro": null,
    "macro_args": [],
    "macro_kwargs": {},
    "priority": 100
}

Parameters:

  • API Key valid API key

set rule parameters

Set configuration parameters of the decision rule.

Note

Master key is required for batch set.

http

PATCH /r/dmatrix_rule/4c6e8c99-56fe-490c-8442-4936ba777498 HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey
Content-Type: application/json

{ "save": true, "for_initial": "any", "enabled": true }

curl

curl -i -X PATCH http://localhost:8817/r/dmatrix_rule/4c6e8c99-56fe-490c-8442-4936ba777498 -H 'Content-Type: application/json' -H 'X-Auth-Key: mykey' --data-raw '{"enabled": true, "for_initial": "any", "save": true}'

wget

wget -S -O- --method=PATCH http://localhost:8817/r/dmatrix_rule/4c6e8c99-56fe-490c-8442-4936ba777498 --header='Content-Type: application/json' --header='X-Auth-Key: mykey' --body-data='{"enabled": true, "for_initial": "any", "save": true}'

httpie

echo '{
  "enabled": true,
  "for_initial": "any",
  "save": true
}' | http PATCH http://localhost:8817/r/dmatrix_rule/4c6e8c99-56fe-490c-8442-4936ba777498 Content-Type:application/json X-Auth-Key:mykey

python-requests

requests.patch('http://localhost:8817/r/dmatrix_rule/4c6e8c99-56fe-490c-8442-4936ba777498', headers={
    'Content-Type': 'application/json',
    'X-Auth-Key': 'mykey',
}, json={
    'enabled': True,
    'for_initial': 'any',
    'save': True,
})

response

HTTP/1.1 204 No Content
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Expires: 0
Pragma: no-cache

Parameters:

  • API Key valid API key

Optionally:

  • save save configuration after successful call

Logic control macros

create new macro

Creates new macro. Macro code should be put in xc/lm manually.

http

PUT /r/lmacro/tests/test_macro2 HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey

curl

curl -i -X PUT http://localhost:8817/r/lmacro/tests/test_macro2 -H 'X-Auth-Key: mykey'

wget

wget -S -O- --method=PUT http://localhost:8817/r/lmacro/tests/test_macro2 --header='X-Auth-Key: mykey'

httpie

http PUT http://localhost:8817/r/lmacro/tests/test_macro2 X-Auth-Key:mykey

python-requests

requests.put('http://localhost:8817/r/lmacro/tests/test_macro2', headers={
    'X-Auth-Key': 'mykey',
})

response

HTTP/1.1 201 Created
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Content-Type: application/json
Expires: 0
Pragma: no-cache

{
    "action_enabled": true,
    "full_id": "tests/test_macro2",
    "group": "tests",
    "id": "test_macro2",
    "oid": "lmacro:tests/test_macro2",
    "type": "lmacro"
}

Parameters:

  • API Key API key with master permissions

Optionally:

delete macro

Deletes macro.

http

DELETE /r/lmacro/tests/test_macro2 HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey

curl

curl -i -X DELETE http://localhost:8817/r/lmacro/tests/test_macro2 -H 'X-Auth-Key: mykey'

wget

wget -S -O- --method=DELETE http://localhost:8817/r/lmacro/tests/test_macro2 --header='X-Auth-Key: mykey'

httpie

http DELETE http://localhost:8817/r/lmacro/tests/test_macro2 X-Auth-Key:mykey

python-requests

requests.delete('http://localhost:8817/r/lmacro/tests/test_macro2', headers={
    'X-Auth-Key': 'mykey',
})

response

HTTP/1.1 204 No Content
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Expires: 0
Pragma: no-cache

Parameters:

  • API Key API key with master permissions

execute macro

Execute a macro with the specified arguments.

http

POST /r/lmacro/tests/test_macro HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey
Content-Type: application/json

{ "method": "run" }

curl

curl -i -X POST http://localhost:8817/r/lmacro/tests/test_macro -H 'Content-Type: application/json' -H 'X-Auth-Key: mykey' --data-raw '{"method": "run"}'

wget

wget -S -O- http://localhost:8817/r/lmacro/tests/test_macro --header='Content-Type: application/json' --header='X-Auth-Key: mykey' --post-data='{"method": "run"}'

httpie

echo '{
  "method": "run"
}' | http POST http://localhost:8817/r/lmacro/tests/test_macro Content-Type:application/json X-Auth-Key:mykey

python-requests

requests.post('http://localhost:8817/r/lmacro/tests/test_macro', headers={
    'Content-Type': 'application/json',
    'X-Auth-Key': 'mykey',
}, json={
    'method': 'run',
})

response

HTTP/1.1 201 Created
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Content-Type: application/json
Expires: 0
Location: /r/action/7bfeb95f-52db-40c9-b966-69b67b9c3f06
Pragma: no-cache

{
    "args": [],
    "err": "",
    "exitcode": 0,
    "item_group": "tests",
    "item_id": "test_macro",
    "item_oid": "lmacro:tests/test_macro",
    "item_type": "lmacro",
    "kwargs": {},
    "out": "test passed",
    "priority": 100,
    "status": "completed",
    "time": {
        "completed": 1553208911.3692856,
        "created": 1553208911.363952,
        "pending": 1553208911.3643816,
        "queued": 1553208911.3652995,
        "running": 1553208911.3663137
    },
    "uuid": "7bfeb95f-52db-40c9-b966-69b67b9c3f06"
}

Parameters:

  • API Key valid API key

Optionally:

  • a macro arguments, array or space separated
  • kw macro keyword arguments, name=value, comma separated or dict
  • w wait for the completion for the specified number of seconds
  • p queue priority (default is 100, lower is better)
  • q global queue timeout, if expires, action is marked as “dead”

get macro configuration properties

http

GET /r/lmacro/tests/test_macro@props HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey

curl

curl -i http://localhost:8817/r/lmacro/tests/test_macro@props -H 'X-Auth-Key: mykey'

wget

wget -S -O- http://localhost:8817/r/lmacro/tests/test_macro@props --header='X-Auth-Key: mykey'

httpie

http http://localhost:8817/r/lmacro/tests/test_macro@props X-Auth-Key:mykey

python-requests

requests.get('http://localhost:8817/r/lmacro/tests/test_macro@props', headers={
    'X-Auth-Key': 'mykey',
})

response

HTTP/1.1 200 OK
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Content-Type: application/json
Expires: 0
Pragma: no-cache

{
    "action_enabled": true,
    "action_exec": null,
    "description": "",
    "pass_errors": false,
    "send_critical": false
}

Parameters:

  • API Key API key with master permissions

get macro groups list

Get the list of macros. Useful e.g. for custom interfaces.

http

GET /r/lmacro/@groups HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey

curl

curl -i http://localhost:8817/r/lmacro/@groups -H 'X-Auth-Key: mykey'

wget

wget -S -O- http://localhost:8817/r/lmacro/@groups --header='X-Auth-Key: mykey'

httpie

http http://localhost:8817/r/lmacro/@groups X-Auth-Key:mykey

python-requests

requests.get('http://localhost:8817/r/lmacro/@groups', headers={
    'X-Auth-Key': 'mykey',
})

response

HTTP/1.1 200 OK
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Content-Type: application/json
Expires: 0
Pragma: no-cache

[
    "tests"
]

Parameters:

  • API Key valid API key

get macro information

http

GET /r/lmacro/tests/test_macro HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey

curl

curl -i http://localhost:8817/r/lmacro/tests/test_macro -H 'X-Auth-Key: mykey'

wget

wget -S -O- http://localhost:8817/r/lmacro/tests/test_macro --header='X-Auth-Key: mykey'

httpie

http http://localhost:8817/r/lmacro/tests/test_macro X-Auth-Key:mykey

python-requests

requests.get('http://localhost:8817/r/lmacro/tests/test_macro', headers={
    'X-Auth-Key': 'mykey',
})

response

HTTP/1.1 200 OK
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Content-Type: application/json
Expires: 0
Pragma: no-cache

{
    "action_enabled": true,
    "description": "",
    "full_id": "tests/test_macro",
    "group": "tests",
    "id": "test_macro",
    "oid": "lmacro:tests/test_macro",
    "type": "lmacro"
}

Parameters:

  • API Key valid API key

get macro list

Get the list of all available macros.

http

GET /r/lmacro HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey

curl

curl -i http://localhost:8817/r/lmacro -H 'X-Auth-Key: mykey'

wget

wget -S -O- http://localhost:8817/r/lmacro --header='X-Auth-Key: mykey'

httpie

http http://localhost:8817/r/lmacro X-Auth-Key:mykey

python-requests

requests.get('http://localhost:8817/r/lmacro', headers={
    'X-Auth-Key': 'mykey',
})

response

HTTP/1.1 200 OK
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Content-Type: application/json
Expires: 0
Pragma: no-cache

[
    {
        "action_enabled": true,
        "description": "",
        "full_id": "tests/test1",
        "group": "tests",
        "id": "test1",
        "oid": "lmacro:tests/test1",
        "type": "lmacro"
    },
    {
        "action_enabled": true,
        "description": "",
        "full_id": "tests/test2",
        "group": "tests",
        "id": "test2",
        "oid": "lmacro:tests/test2",
        "type": "lmacro"
    },
    {
        "action_enabled": true,
        "description": "",
        "full_id": "tests/test_macro",
        "group": "tests",
        "id": "test_macro",
        "oid": "lmacro:tests/test_macro",
        "type": "lmacro"
    },
    {
        "action_enabled": true,
        "description": "",
        "full_id": "tests/test_macro2",
        "group": "tests",
        "id": "test_macro2",
        "oid": "lmacro:tests/test_macro2",
        "type": "lmacro"
    }
]

Parameters:

  • API Key valid API key

Optionally:

macro execution result

Get macro execution results either by action uuid or by macro id.

http

GET /r/action?i=tests%2Ftest_macro HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey

curl

curl -i 'http://localhost:8817/r/action?i=tests%2Ftest_macro' -H 'X-Auth-Key: mykey'

wget

wget -S -O- 'http://localhost:8817/r/action?i=tests%2Ftest_macro' --header='X-Auth-Key: mykey'

httpie

http 'http://localhost:8817/r/action?i=tests%2Ftest_macro' X-Auth-Key:mykey

python-requests

requests.get('http://localhost:8817/r/action?i=tests%2Ftest_macro', headers={
    'X-Auth-Key': 'mykey',
})

response

HTTP/1.1 200 OK
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Content-Type: application/json
Expires: 0
Pragma: no-cache

[
    {
        "args": [],
        "err": "",
        "exitcode": 0,
        "item_group": "tests",
        "item_id": "test_macro",
        "item_oid": "lmacro:tests/test_macro",
        "item_type": "lmacro",
        "kwargs": {},
        "out": "test passed",
        "priority": 100,
        "status": "completed",
        "time": {
            "completed": 1553208910.6751578,
            "created": 1553208910.6690092,
            "pending": 1553208910.669596,
            "queued": 1553208910.6709642,
            "running": 1553208910.6717882
        },
        "uuid": "35540036-c941-489c-bda7-c2d209c3abd6"
    }
]

Parameters:

  • API Key valid API key

Optionally:

  • g filter by unit group
  • s filter by action status: Q for queued, R for running, F for finished

Returns:

list or single serialized action object

set macro configuration property

Set configuration parameters of the macro.

http

PATCH /r/lmacro/tests/test_macro HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey
Content-Type: application/json

{ "save": true, "pass_errors": true }

curl

curl -i -X PATCH http://localhost:8817/r/lmacro/tests/test_macro -H 'Content-Type: application/json' -H 'X-Auth-Key: mykey' --data-raw '{"pass_errors": true, "save": true}'

wget

wget -S -O- --method=PATCH http://localhost:8817/r/lmacro/tests/test_macro --header='Content-Type: application/json' --header='X-Auth-Key: mykey' --body-data='{"pass_errors": true, "save": true}'

httpie

echo '{
  "pass_errors": true,
  "save": true
}' | http PATCH http://localhost:8817/r/lmacro/tests/test_macro Content-Type:application/json X-Auth-Key:mykey

python-requests

requests.patch('http://localhost:8817/r/lmacro/tests/test_macro', headers={
    'Content-Type': 'application/json',
    'X-Auth-Key': 'mykey',
}, json={
    'pass_errors': True,
    'save': True,
})

response

HTTP/1.1 204 No Content
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Expires: 0
Pragma: no-cache

Parameters:

  • API Key API key with master permissions

Optionally:

  • save save configuration after successful call

Logic cycles

create new cycle

Creates new cycle.

http

PUT /r/lcycle/tests/test_cycle2 HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey

curl

curl -i -X PUT http://localhost:8817/r/lcycle/tests/test_cycle2 -H 'X-Auth-Key: mykey'

wget

wget -S -O- --method=PUT http://localhost:8817/r/lcycle/tests/test_cycle2 --header='X-Auth-Key: mykey'

httpie

http PUT http://localhost:8817/r/lcycle/tests/test_cycle2 X-Auth-Key:mykey

python-requests

requests.put('http://localhost:8817/r/lcycle/tests/test_cycle2', headers={
    'X-Auth-Key': 'mykey',
})

response

HTTP/1.1 201 Created
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Content-Type: application/json
Expires: 0
Pragma: no-cache

{
    "full_id": "tests/test_cycle2",
    "group": "tests",
    "ict": 100,
    "id": "test_cycle2",
    "interval": 1,
    "macro": null,
    "oid": "lcycle:tests/test_cycle2",
    "on_error": null,
    "status": 0,
    "type": "lcycle",
    "value": "1.0000"
}

Parameters:

  • API Key API key with master permissions

Optionally:

delete cycle

Deletes cycle. If cycle is running, it is stopped before deletion.

http

DELETE /r/lcycle/tests/test_cycle2 HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey

curl

curl -i -X DELETE http://localhost:8817/r/lcycle/tests/test_cycle2 -H 'X-Auth-Key: mykey'

wget

wget -S -O- --method=DELETE http://localhost:8817/r/lcycle/tests/test_cycle2 --header='X-Auth-Key: mykey'

httpie

http DELETE http://localhost:8817/r/lcycle/tests/test_cycle2 X-Auth-Key:mykey

python-requests

requests.delete('http://localhost:8817/r/lcycle/tests/test_cycle2', headers={
    'X-Auth-Key': 'mykey',
})

response

HTTP/1.1 204 No Content
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Expires: 0
Pragma: no-cache

Parameters:

  • API Key API key with master permissions

get cycle configuration properties

http

GET /r/lcycle/tests/test_cycle@props HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey

curl

curl -i http://localhost:8817/r/lcycle/tests/test_cycle@props -H 'X-Auth-Key: mykey'

wget

wget -S -O- http://localhost:8817/r/lcycle/tests/test_cycle@props --header='X-Auth-Key: mykey'

httpie

http http://localhost:8817/r/lcycle/tests/test_cycle@props X-Auth-Key:mykey

python-requests

requests.get('http://localhost:8817/r/lcycle/tests/test_cycle@props', headers={
    'X-Auth-Key': 'mykey',
})

response

HTTP/1.1 200 OK
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Content-Type: application/json
Expires: 0
Pragma: no-cache

{
    "autostart": false,
    "description": "",
    "ict": 20,
    "interval": 1,
    "macro": "tests/test_macro",
    "on_error": null
}

Parameters:

  • API Key API key with master permissions

get cycle groups list

Get the list of cycles. Useful e.g. for custom interfaces.

http

GET /r/lcycle/@groups HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey

curl

curl -i http://localhost:8817/r/lcycle/@groups -H 'X-Auth-Key: mykey'

wget

wget -S -O- http://localhost:8817/r/lcycle/@groups --header='X-Auth-Key: mykey'

httpie

http http://localhost:8817/r/lcycle/@groups X-Auth-Key:mykey

python-requests

requests.get('http://localhost:8817/r/lcycle/@groups', headers={
    'X-Auth-Key': 'mykey',
})

response

HTTP/1.1 200 OK
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Content-Type: application/json
Expires: 0
Pragma: no-cache

[
    "tests"
]

Parameters:

  • API Key valid API key

get cycle information

http

GET /r/lcycle/tests/test_cycle HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey

curl

curl -i http://localhost:8817/r/lcycle/tests/test_cycle -H 'X-Auth-Key: mykey'

wget

wget -S -O- http://localhost:8817/r/lcycle/tests/test_cycle --header='X-Auth-Key: mykey'

httpie

http http://localhost:8817/r/lcycle/tests/test_cycle X-Auth-Key:mykey

python-requests

requests.get('http://localhost:8817/r/lcycle/tests/test_cycle', headers={
    'X-Auth-Key': 'mykey',
})

response

HTTP/1.1 200 OK
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Content-Type: application/json
Expires: 0
Pragma: no-cache

{
    "avg": 1,
    "description": "",
    "full_id": "tests/test_cycle",
    "group": "tests",
    "ict": 20,
    "id": "test_cycle",
    "interval": 1,
    "iterations": 0,
    "macro": "tests/test_macro",
    "oid": "lcycle:tests/test_cycle",
    "on_error": null,
    "status": 1,
    "type": "lcycle",
    "value": "1.0000"
}

Parameters:

  • API Key valid API key

Returns:

field “value” contains real average cycle interval

get cycle list

Get the list of all available cycles.

http

GET /r/lcycle HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey

curl

curl -i http://localhost:8817/r/lcycle -H 'X-Auth-Key: mykey'

wget

wget -S -O- http://localhost:8817/r/lcycle --header='X-Auth-Key: mykey'

httpie

http http://localhost:8817/r/lcycle X-Auth-Key:mykey

python-requests

requests.get('http://localhost:8817/r/lcycle', headers={
    'X-Auth-Key': 'mykey',
})

response

HTTP/1.1 200 OK
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Content-Type: application/json
Expires: 0
Pragma: no-cache

[
    {
        "avg": 0.0105,
        "description": "",
        "full_id": "tests/cycle1",
        "group": "tests",
        "ict": 20,
        "id": "cycle1",
        "interval": 0.01,
        "iterations": 275,
        "macro": "tests/test",
        "oid": "lcycle:tests/cycle1",
        "on_error": null,
        "status": 0,
        "type": "lcycle",
        "value": "275,0.0105,"
    },
    {
        "avg": 0.5,
        "description": "test 2Hz cycle",
        "full_id": "tests/test1",
        "group": "tests",
        "ict": 100,
        "id": "test1",
        "interval": 0.5,
        "iterations": 0,
        "macro": "tests/test1",
        "oid": "lcycle:tests/test1",
        "on_error": null,
        "status": 0,
        "type": "lcycle",
        "value": "0,0.5000,"
    }
]

Parameters:

  • API Key valid API key

Optionally:

reset cycle statistic

http

POST /r/lcycle/tests/test_cycle HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey
Content-Type: application/json

{ "method": "reset" }

curl

curl -i -X POST http://localhost:8817/r/lcycle/tests/test_cycle -H 'Content-Type: application/json' -H 'X-Auth-Key: mykey' --data-raw '{"method": "reset"}'

wget

wget -S -O- http://localhost:8817/r/lcycle/tests/test_cycle --header='Content-Type: application/json' --header='X-Auth-Key: mykey' --post-data='{"method": "reset"}'

httpie

echo '{
  "method": "reset"
}' | http POST http://localhost:8817/r/lcycle/tests/test_cycle Content-Type:application/json X-Auth-Key:mykey

python-requests

requests.post('http://localhost:8817/r/lcycle/tests/test_cycle', headers={
    'Content-Type': 'application/json',
    'X-Auth-Key': 'mykey',
}, json={
    'method': 'reset',
})

response

HTTP/1.1 204 No Content
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Expires: 0
Pragma: no-cache

Parameters:

  • API Key valid API key

set cycle property

Set configuration parameters of the cycle.

http

PATCH /r/lcycle/tests/test_cycle HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey
Content-Type: application/json

{ "save": true, "ict": 20, "macro": "tests/test_macro" }

curl

curl -i -X PATCH http://localhost:8817/r/lcycle/tests/test_cycle -H 'Content-Type: application/json' -H 'X-Auth-Key: mykey' --data-raw '{"ict": 20, "macro": "tests/test_macro", "save": true}'

wget

wget -S -O- --method=PATCH http://localhost:8817/r/lcycle/tests/test_cycle --header='Content-Type: application/json' --header='X-Auth-Key: mykey' --body-data='{"ict": 20, "macro": "tests/test_macro", "save": true}'

httpie

echo '{
  "ict": 20,
  "macro": "tests/test_macro",
  "save": true
}' | http PATCH http://localhost:8817/r/lcycle/tests/test_cycle Content-Type:application/json X-Auth-Key:mykey

python-requests

requests.patch('http://localhost:8817/r/lcycle/tests/test_cycle', headers={
    'Content-Type': 'application/json',
    'X-Auth-Key': 'mykey',
}, json={
    'ict': 20,
    'macro': 'tests/test_macro',
    'save': True,
})

response

HTTP/1.1 204 No Content
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Expires: 0
Pragma: no-cache

Parameters:

  • API Key API key with master permissions

Optionally:

  • save save configuration after successful call

start cycle

http

POST /r/lcycle/tests/test_cycle HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey
Content-Type: application/json

{ "method": "start" }

curl

curl -i -X POST http://localhost:8817/r/lcycle/tests/test_cycle -H 'Content-Type: application/json' -H 'X-Auth-Key: mykey' --data-raw '{"method": "start"}'

wget

wget -S -O- http://localhost:8817/r/lcycle/tests/test_cycle --header='Content-Type: application/json' --header='X-Auth-Key: mykey' --post-data='{"method": "start"}'

httpie

echo '{
  "method": "start"
}' | http POST http://localhost:8817/r/lcycle/tests/test_cycle Content-Type:application/json X-Auth-Key:mykey

python-requests

requests.post('http://localhost:8817/r/lcycle/tests/test_cycle', headers={
    'Content-Type': 'application/json',
    'X-Auth-Key': 'mykey',
}, json={
    'method': 'start',
})

response

HTTP/1.1 204 No Content
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Expires: 0
Pragma: no-cache

Parameters:

  • API Key valid API key

stop cycle

http

POST /r/lcycle/tests/test_cycle HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey
Content-Type: application/json

{ "method": "stop" }

curl

curl -i -X POST http://localhost:8817/r/lcycle/tests/test_cycle -H 'Content-Type: application/json' -H 'X-Auth-Key: mykey' --data-raw '{"method": "stop"}'

wget

wget -S -O- http://localhost:8817/r/lcycle/tests/test_cycle --header='Content-Type: application/json' --header='X-Auth-Key: mykey' --post-data='{"method": "stop"}'

httpie

echo '{
  "method": "stop"
}' | http POST http://localhost:8817/r/lcycle/tests/test_cycle Content-Type:application/json X-Auth-Key:mykey

python-requests

requests.post('http://localhost:8817/r/lcycle/tests/test_cycle', headers={
    'Content-Type': 'application/json',
    'X-Auth-Key': 'mykey',
}, json={
    'method': 'stop',
})

response

HTTP/1.1 202 Accepted
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Expires: 0
Pragma: no-cache

Parameters:

  • API Key valid API key

Optionally:

  • wait wait until cycle is stopped

Macro extensions

get extension module info

http

GET /r/ext-module/audio HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey

curl

curl -i http://localhost:8817/r/ext-module/audio -H 'X-Auth-Key: mykey'

wget

wget -S -O- http://localhost:8817/r/ext-module/audio --header='X-Auth-Key: mykey'

httpie

http http://localhost:8817/r/ext-module/audio X-Auth-Key:mykey

python-requests

requests.get('http://localhost:8817/r/ext-module/audio', headers={
    'X-Auth-Key': 'mykey',
})

response

HTTP/1.1 200 OK
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Content-Type: application/json
Expires: 0
Pragma: no-cache

{
    "api": 1,
    "author": "Altertech Group, https://www.altertech.com/",
    "description": "Play audio file",
    "help": "\nPlays audio file inside the specified directory. The file path should be\nrelative to the directory root, witout a starting slash.\n",
    "license": "Apache License 2.0",
    "mod": "audio",
    "mods_required": [
        "soundfile",
        "sounddevice"
    ],
    "version": "1.0.0"
}

Parameters:

  • API Key API key with master permissions

get extension usage help

http

GET /r/ext-module/audio?help=functions HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey

curl

curl -i 'http://localhost:8817/r/ext-module/audio?help=functions' -H 'X-Auth-Key: mykey'

wget

wget -S -O- 'http://localhost:8817/r/ext-module/audio?help=functions' --header='X-Auth-Key: mykey'

httpie

http 'http://localhost:8817/r/ext-module/audio?help=functions' X-Auth-Key:mykey

python-requests

requests.get('http://localhost:8817/r/ext-module/audio?help=functions', headers={
    'X-Auth-Key': 'mykey',
})

response

HTTP/1.1 200 OK
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Content-Type: application/json
Expires: 0
Pragma: no-cache

{
    "play(soundfile, gain=0, wait=True)": "Play sound file"
}

Parameters:

  • API Key API key with master permissions

get list of available extension modules

http

GET /r/ext-module HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey

curl

curl -i http://localhost:8817/r/ext-module -H 'X-Auth-Key: mykey'

wget

wget -S -O- http://localhost:8817/r/ext-module --header='X-Auth-Key: mykey'

httpie

http http://localhost:8817/r/ext-module X-Auth-Key:mykey

python-requests

requests.get('http://localhost:8817/r/ext-module', headers={
    'X-Auth-Key': 'mykey',
})

response

HTTP/1.1 200 OK
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Content-Type: application/json
Expires: 0
Pragma: no-cache

[
    {
        "api": 1,
        "author": "Altertech Group, https://www.altertech.com/",
        "description": "Play audio file",
        "help": "\nPlays audio file inside the specified directory. The file path should be\nrelative to the directory root, witout a starting slash.\n",
        "id": null,
        "license": "Apache License 2.0",
        "mod": "audio",
        "mods_required": [
            "soundfile",
            "sounddevice"
        ],
        "version": "1.0.0"
    },
    {
        "api": 1,
        "author": "Altertech Group, https://www.altertech.com/",
        "description": "Push client for Roboger",
        "help": "\nPush client for Roboger event pager (https://www.roboger.com,\nhttps://github.com/alttch/roboger). Refer to pyrpush module documentation for\nmore info: https://pypi.org/project/pyrpush/\n",
        "id": null,
        "license": "Apache License 2.0",
        "mod": "rpush",
        "mods_required": [
            "pyrpush"
        ],
        "version": "1.0.0"
    },
    {
        "api": 1,
        "author": "Altertech Group, https://www.altertech.com/",
        "description": "Run macro on remote LM PLC",
        "help": "\nAllows to run macros on remote LM PLC\n",
        "id": null,
        "license": "Apache License 2.0",
        "mod": "run_remote",
        "mods_required": [],
        "version": "1.0.0"
    },
    {
        "api": 1,
        "author": "Altertech Group, https://www.altertech.com/",
        "description": "Text-to-speech via ttsbroker",
        "help": "\nText-to-speech engine via ttsbroker Python module. Refer to module\ndocumentation for more info: https://pypi.org/project/ttsbroker/\n",
        "id": null,
        "license": "Apache License 2.0",
        "mod": "tts",
        "mods_required": [
            "ttsbroker"
        ],
        "version": "1.0.0"
    }
]

Parameters:

  • API Key API key with master permissions

get list of available macro extensions

http

GET /r/ext HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey

curl

curl -i http://localhost:8817/r/ext -H 'X-Auth-Key: mykey'

wget

wget -S -O- http://localhost:8817/r/ext --header='X-Auth-Key: mykey'

httpie

http http://localhost:8817/r/ext X-Auth-Key:mykey

python-requests

requests.get('http://localhost:8817/r/ext', headers={
    'X-Auth-Key': 'mykey',
})

response

HTTP/1.1 200 OK
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Content-Type: application/json
Expires: 0
Pragma: no-cache

[
    {
        "id": "a1",
        "mod": "audio"
    },
    {
        "id": "test_a",
        "mod": "audio"
    },
    {
        "id": "test_a2",
        "mod": "audio"
    }
]

Parameters:

  • API Key API key with master permissions

Optionally:

get loaded extension information

http

GET /r/ext/test_a HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey

curl

curl -i http://localhost:8817/r/ext/test_a -H 'X-Auth-Key: mykey'

wget

wget -S -O- http://localhost:8817/r/ext/test_a --header='X-Auth-Key: mykey'

httpie

http http://localhost:8817/r/ext/test_a X-Auth-Key:mykey

python-requests

requests.get('http://localhost:8817/r/ext/test_a', headers={
    'X-Auth-Key': 'mykey',
})

response

HTTP/1.1 200 OK
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Content-Type: application/json
Expires: 0
Pragma: no-cache

{
    "api": 1,
    "author": "Altertech Group, https://www.altertech.com/",
    "cfg": {
        "sdir": "/opt/data/snd"
    },
    "description": "Play audio file",
    "help": "\nPlays audio file inside the specified directory. The file path should be\nrelative to the directory root, witout a starting slash.\n",
    "id": "test_a",
    "license": "Apache License 2.0",
    "mod": "audio",
    "mods_required": [
        "soundfile",
        "sounddevice"
    ],
    "version": "1.0.0"
}

Parameters:

  • API Key API key with master permissions

load extension module

Loads:doc:macro extension</lm/ext>.

http

PUT /r/ext/test_a2 HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey
Content-Type: application/json

{ "m": "audio", "c": "sdir=/opt/data/snd", "save": true }

curl

curl -i -X PUT http://localhost:8817/r/ext/test_a2 -H 'Content-Type: application/json' -H 'X-Auth-Key: mykey' --data-raw '{"c": "sdir=/opt/data/snd", "m": "audio", "save": true}'

wget

wget -S -O- --method=PUT http://localhost:8817/r/ext/test_a2 --header='Content-Type: application/json' --header='X-Auth-Key: mykey' --body-data='{"c": "sdir=/opt/data/snd", "m": "audio", "save": true}'

httpie

echo '{
  "c": "sdir=/opt/data/snd",
  "m": "audio",
  "save": true
}' | http PUT http://localhost:8817/r/ext/test_a2 Content-Type:application/json X-Auth-Key:mykey

python-requests

requests.put('http://localhost:8817/r/ext/test_a2', headers={
    'Content-Type': 'application/json',
    'X-Auth-Key': 'mykey',
}, json={
    'c': 'sdir=/opt/data/snd',
    'm': 'audio',
    'save': True,
})

response

HTTP/1.1 201 Created
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Content-Type: application/json
Expires: 0
Pragma: no-cache

{
    "api": 1,
    "author": "Altertech Group, https://www.altertech.com/",
    "cfg": {
        "sdir": "/opt/data/snd"
    },
    "description": "Play audio file",
    "help": "\nPlays audio file inside the specified directory. The file path should be\nrelative to the directory root, witout a starting slash.\n",
    "id": "test_a2",
    "license": "Apache License 2.0",
    "mod": "audio",
    "mods_required": [
        "soundfile",
        "sounddevice"
    ],
    "version": "1.0.0"
}

Parameters:

  • API Key API key with master permissions
  • m extension module

Optionally:

  • c extension configuration
  • save save extension configuration after successful call

set extension configuration property

appends property to extension configuration and reloads module

http

PATCH /r/ext/test_a HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey
Content-Type: application/json

{ "save": true, "d": 2, "save": true }

curl

curl -i -X PATCH http://localhost:8817/r/ext/test_a -H 'Content-Type: application/json' -H 'X-Auth-Key: mykey' --data-raw '{"d": 2, "save": true}'

wget

wget -S -O- --method=PATCH http://localhost:8817/r/ext/test_a --header='Content-Type: application/json' --header='X-Auth-Key: mykey' --body-data='{"d": 2, "save": true}'

httpie

echo '{
  "d": 2,
  "save": true
}' | http PATCH http://localhost:8817/r/ext/test_a Content-Type:application/json X-Auth-Key:mykey

python-requests

requests.patch('http://localhost:8817/r/ext/test_a', headers={
    'Content-Type': 'application/json',
    'X-Auth-Key': 'mykey',
}, json={
    'd': 2,
    'save': True,
})

response

HTTP/1.1 204 No Content
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Expires: 0
Pragma: no-cache

Parameters:

  • API Key API key with master permissions

Optionally:

  • save save configuration after successful call

unload macro extension

http

DELETE /r/ext/test_a2 HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey

curl

curl -i -X DELETE http://localhost:8817/r/ext/test_a2 -H 'X-Auth-Key: mykey'

wget

wget -S -O- --method=DELETE http://localhost:8817/r/ext/test_a2 --header='X-Auth-Key: mykey'

httpie

http DELETE http://localhost:8817/r/ext/test_a2 X-Auth-Key:mykey

python-requests

requests.delete('http://localhost:8817/r/ext/test_a2', headers={
    'X-Auth-Key': 'mykey',
})

response

HTTP/1.1 204 No Content
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Expires: 0
Pragma: no-cache

Parameters:

  • API Key API key with master permissions

Remote controllers

connect remote UC via HTTP

Connects remote UC controller to the local.

http

POST /r/controller/uc HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey
Content-Type: application/json

{ "u": "localhost", "a": "secretkey", "save": true }

curl

curl -i -X POST http://localhost:8817/r/controller/uc -H 'Content-Type: application/json' -H 'X-Auth-Key: mykey' --data-raw '{"a": "secretkey", "save": true, "u": "localhost"}'

wget

wget -S -O- http://localhost:8817/r/controller/uc --header='Content-Type: application/json' --header='X-Auth-Key: mykey' --post-data='{"a": "secretkey", "save": true, "u": "localhost"}'

httpie

echo '{
  "a": "secretkey",
  "save": true,
  "u": "localhost"
}' | http POST http://localhost:8817/r/controller/uc Content-Type:application/json X-Auth-Key:mykey

python-requests

requests.post('http://localhost:8817/r/controller/uc', headers={
    'Content-Type': 'application/json',
    'X-Auth-Key': 'mykey',
}, json={
    'a': 'secretkey',
    'save': True,
    'u': 'localhost',
})

response

HTTP/1.1 201 Created
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Content-Type: application/json
Expires: 0
Location: /r/controller/uc/ws1-v1
Pragma: no-cache

{
    "build": "2019031405",
    "connected": true,
    "description": "",
    "enabled": true,
    "full_id": "uc/ws1-v1",
    "group": "uc",
    "id": "ws1-v1",
    "managed": false,
    "mqtt_update": null,
    "oid": "remote_uc:uc/ws1-v1",
    "proto": "http",
    "static": true,
    "type": "remote_uc",
    "version": "3.2.0"
}

Parameters:

  • API Key API key with master permissions
  • u UC API uri (proto://host:port, port not required if default)
  • a remote controller API key ($key to use local key)

Optionally:

  • m ref:MQTT notifier<mqtt_> to exchange item states in real time (default: eva_1)
  • s verify remote SSL certificate or pass invalid
  • t timeout (seconds) for the remote controller API calls
  • save save connected controller configuration on the disk immediately after creation

disable connected controller

http

PATCH /r/controller/uc/ws1-v1 HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey
Content-Type: application/json

{ "save": true, "enabled": false }

curl

curl -i -X PATCH http://localhost:8817/r/controller/uc/ws1-v1 -H 'Content-Type: application/json' -H 'X-Auth-Key: mykey' --data-raw '{"enabled": false, "save": true}'

wget

wget -S -O- --method=PATCH http://localhost:8817/r/controller/uc/ws1-v1 --header='Content-Type: application/json' --header='X-Auth-Key: mykey' --body-data='{"enabled": false, "save": true}'

httpie

echo '{
  "enabled": false,
  "save": true
}' | http PATCH http://localhost:8817/r/controller/uc/ws1-v1 Content-Type:application/json X-Auth-Key:mykey

python-requests

requests.patch('http://localhost:8817/r/controller/uc/ws1-v1', headers={
    'Content-Type': 'application/json',
    'X-Auth-Key': 'mykey',
}, json={
    'enabled': False,
    'save': True,
})

response

HTTP/1.1 204 No Content
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Expires: 0
Pragma: no-cache

Parameters:

  • API Key API key with master permissions

Optionally:

  • save save configuration after successful call

disconnect controller

http

DELETE /r/controller/uc/ws1-v1 HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey

curl

curl -i -X DELETE http://localhost:8817/r/controller/uc/ws1-v1 -H 'X-Auth-Key: mykey'

wget

wget -S -O- --method=DELETE http://localhost:8817/r/controller/uc/ws1-v1 --header='X-Auth-Key: mykey'

httpie

http DELETE http://localhost:8817/r/controller/uc/ws1-v1 X-Auth-Key:mykey

python-requests

requests.delete('http://localhost:8817/r/controller/uc/ws1-v1', headers={
    'X-Auth-Key': 'mykey',
})

response

HTTP/1.1 204 No Content
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Expires: 0
Pragma: no-cache

Parameters:

  • API Key API key with master permissions

enable connected controller

http

PATCH /r/controller/uc/ws1-v1 HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey
Content-Type: application/json

{ "save": true, "enabled": true }

curl

curl -i -X PATCH http://localhost:8817/r/controller/uc/ws1-v1 -H 'Content-Type: application/json' -H 'X-Auth-Key: mykey' --data-raw '{"enabled": true, "save": true}'

wget

wget -S -O- --method=PATCH http://localhost:8817/r/controller/uc/ws1-v1 --header='Content-Type: application/json' --header='X-Auth-Key: mykey' --body-data='{"enabled": true, "save": true}'

httpie

echo '{
  "enabled": true,
  "save": true
}' | http PATCH http://localhost:8817/r/controller/uc/ws1-v1 Content-Type:application/json X-Auth-Key:mykey

python-requests

requests.patch('http://localhost:8817/r/controller/uc/ws1-v1', headers={
    'Content-Type': 'application/json',
    'X-Auth-Key': 'mykey',
}, json={
    'enabled': True,
    'save': True,
})

response

HTTP/1.1 204 No Content
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Expires: 0
Pragma: no-cache

Parameters:

  • API Key API key with master permissions

Optionally:

  • save save configuration after successful call

get a list of items from connected UCs

Get a list of the items loaded from the connected UC controllers. Useful to debug the controller connections.

http

GET /r/controller/uc/ws1-v1@items HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey

curl

curl -i http://localhost:8817/r/controller/uc/ws1-v1@items -H 'X-Auth-Key: mykey'

wget

wget -S -O- http://localhost:8817/r/controller/uc/ws1-v1@items --header='X-Auth-Key: mykey'

httpie

http http://localhost:8817/r/controller/uc/ws1-v1@items X-Auth-Key:mykey

python-requests

requests.get('http://localhost:8817/r/controller/uc/ws1-v1@items', headers={
    'X-Auth-Key': 'mykey',
})

response

HTTP/1.1 200 OK
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Content-Type: application/json
Expires: 0
Pragma: no-cache

[
    {
        "controller_id": "uc/ws1-v1",
        "description": "",
        "full_id": "env/temp_test",
        "group": "env",
        "id": "temp_test",
        "loc_x": null,
        "loc_y": null,
        "loc_z": null,
        "location": "",
        "oid": "sensor:env/temp_test",
        "status": 0,
        "type": "sensor",
        "value": "null"
    },
    {
        "action_enabled": true,
        "controller_id": "uc/ws1-v1",
        "description": "",
        "full_id": "nogroup/test2",
        "group": "nogroup",
        "id": "test2",
        "loc_x": null,
        "loc_y": null,
        "loc_z": null,
        "location": "",
        "nstatus": -1,
        "nvalue": "null",
        "oid": "unit:nogroup/test2",
        "status": -1,
        "status_labels": [
            {
                "label": "OFF",
                "status": 0
            },
            {
                "label": "ON",
                "status": 1
            }
        ],
        "type": "unit",
        "value": "null"
    }
]

Parameters:

  • API Key API key with master permissions

Optionally:

  • g filter by item group
  • p filter by item type

get connected controller information

http

GET /r/controller/uc/ws1-v1 HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey

curl

curl -i http://localhost:8817/r/controller/uc/ws1-v1 -H 'X-Auth-Key: mykey'

wget

wget -S -O- http://localhost:8817/r/controller/uc/ws1-v1 --header='X-Auth-Key: mykey'

httpie

http http://localhost:8817/r/controller/uc/ws1-v1 X-Auth-Key:mykey

python-requests

requests.get('http://localhost:8817/r/controller/uc/ws1-v1', headers={
    'X-Auth-Key': 'mykey',
})

response

HTTP/1.1 200 OK
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Content-Type: application/json
Expires: 0
Pragma: no-cache

{
    "build": "2019031405",
    "connected": true,
    "description": "",
    "enabled": true,
    "full_id": "uc/ws1-v1",
    "group": "uc",
    "id": "ws1-v1",
    "managed": false,
    "mqtt_update": null,
    "oid": "remote_uc:uc/ws1-v1",
    "proto": "http",
    "static": true,
    "type": "remote_uc",
    "version": "3.2.0"
}

Parameters:

  • API Key API key with master permissions

get controller connection parameters

http

GET /r/controller/uc/ws1-v1@props HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey

curl

curl -i http://localhost:8817/r/controller/uc/ws1-v1@props -H 'X-Auth-Key: mykey'

wget

wget -S -O- http://localhost:8817/r/controller/uc/ws1-v1@props --header='X-Auth-Key: mykey'

httpie

http http://localhost:8817/r/controller/uc/ws1-v1@props X-Auth-Key:mykey

python-requests

requests.get('http://localhost:8817/r/controller/uc/ws1-v1@props', headers={
    'X-Auth-Key': 'mykey',
})

response

HTTP/1.1 200 OK
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Content-Type: application/json
Expires: 0
Pragma: no-cache

{
    "description": "",
    "enabled": true,
    "key": "secretkey",
    "mqtt_update": null,
    "reload_interval": 300,
    "retries": 2,
    "ssl_verify": true,
    "static": true,
    "timeout": 5.0,
    "uri": "http://localhost:8812"
}

Parameters:

  • API Key API key with master permissions

get controllers list

Get the list of all connected UC controllers.

http

GET /r/controller HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey

curl

curl -i http://localhost:8817/r/controller -H 'X-Auth-Key: mykey'

wget

wget -S -O- http://localhost:8817/r/controller --header='X-Auth-Key: mykey'

httpie

http http://localhost:8817/r/controller X-Auth-Key:mykey

python-requests

requests.get('http://localhost:8817/r/controller', headers={
    'X-Auth-Key': 'mykey',
})

response

HTTP/1.1 200 OK
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Content-Type: application/json
Expires: 0
Pragma: no-cache

[]

Parameters:

  • API Key API key with master permissions

reload controller

Reloads items from connected UC

http

POST /r/controller/uc/ws1-v1 HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey
Content-Type: application/json

{ "method": "reload" }

curl

curl -i -X POST http://localhost:8817/r/controller/uc/ws1-v1 -H 'Content-Type: application/json' -H 'X-Auth-Key: mykey' --data-raw '{"method": "reload"}'

wget

wget -S -O- http://localhost:8817/r/controller/uc/ws1-v1 --header='Content-Type: application/json' --header='X-Auth-Key: mykey' --post-data='{"method": "reload"}'

httpie

echo '{
  "method": "reload"
}' | http POST http://localhost:8817/r/controller/uc/ws1-v1 Content-Type:application/json X-Auth-Key:mykey

python-requests

requests.post('http://localhost:8817/r/controller/uc/ws1-v1', headers={
    'Content-Type': 'application/json',
    'X-Auth-Key': 'mykey',
}, json={
    'method': 'reload',
})

response

HTTP/1.1 204 No Content
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Expires: 0
Pragma: no-cache

Parameters:

  • API Key API key with master permissions

set controller connection parameters

http

PATCH /r/controller/uc/ws1-v1 HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey
Content-Type: application/json

{ "save": true, "reload_interval": 60 }

curl

curl -i -X PATCH http://localhost:8817/r/controller/uc/ws1-v1 -H 'Content-Type: application/json' -H 'X-Auth-Key: mykey' --data-raw '{"reload_interval": 60, "save": true}'

wget

wget -S -O- --method=PATCH http://localhost:8817/r/controller/uc/ws1-v1 --header='Content-Type: application/json' --header='X-Auth-Key: mykey' --body-data='{"reload_interval": 60, "save": true}'

httpie

echo '{
  "reload_interval": 60,
  "save": true
}' | http PATCH http://localhost:8817/r/controller/uc/ws1-v1 Content-Type:application/json X-Auth-Key:mykey

python-requests

requests.patch('http://localhost:8817/r/controller/uc/ws1-v1', headers={
    'Content-Type': 'application/json',
    'X-Auth-Key': 'mykey',
}, json={
    'reload_interval': 60,
    'save': True,
})

response

HTTP/1.1 204 No Content
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Expires: 0
Pragma: no-cache

Parameters:

  • API Key API key with master permissions

Optionally:

  • save save configuration after successful call

test connection to remote controller

http

POST /r/controller/uc/ws1-v1 HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey
Content-Type: application/json

{ "method": "test" }

curl

curl -i -X POST http://localhost:8817/r/controller/uc/ws1-v1 -H 'Content-Type: application/json' -H 'X-Auth-Key: mykey' --data-raw '{"method": "test"}'

wget

wget -S -O- http://localhost:8817/r/controller/uc/ws1-v1 --header='Content-Type: application/json' --header='X-Auth-Key: mykey' --post-data='{"method": "test"}'

httpie

echo '{
  "method": "test"
}' | http POST http://localhost:8817/r/controller/uc/ws1-v1 Content-Type:application/json X-Auth-Key:mykey

python-requests

requests.post('http://localhost:8817/r/controller/uc/ws1-v1', headers={
    'Content-Type': 'application/json',
    'X-Auth-Key': 'mykey',
}, json={
    'method': 'test',
})

response

HTTP/1.1 204 No Content
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Expires: 0
Pragma: no-cache

Parameters:

  • API Key API key with master permissions

CVARs

get the value of user-defined variable

Note

Even if different EVA controllers are working on the same server, they have different sets of variables To set the variables for each subsystem, use SYS API on the respective address/port.

http

GET /r/cvar/test HTTP/1.1
Host: localhost:8812
X-Auth-Key: mykey

curl

curl -i http://localhost:8812/r/cvar/test -H 'X-Auth-Key: mykey'

wget

wget -S -O- http://localhost:8812/r/cvar/test --header='X-Auth-Key: mykey'

httpie

http http://localhost:8812/r/cvar/test X-Auth-Key:mykey

python-requests

requests.get('http://localhost:8812/r/cvar/test', headers={
    'X-Auth-Key': 'mykey',
})

response

HTTP/1.1 200 OK
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Content-Type: application/json
Expires: 0
Pragma: no-cache

{
    "test": "some_value"
}

Parameters:

  • API Key API key with master permissions

Optionally:

Returns:

Dict containing variable and its value. If no varible name was specified, all cvars are returned.

set the value of user-defined variable

http

PUT /r/cvar/test HTTP/1.1
Host: localhost:8812
X-Auth-Key: mykey
Content-Type: application/json

{ "v": "some_value" }

curl

curl -i -X PUT http://localhost:8812/r/cvar/test -H 'Content-Type: application/json' -H 'X-Auth-Key: mykey' --data-raw '{"v": "some_value"}'

wget

wget -S -O- --method=PUT http://localhost:8812/r/cvar/test --header='Content-Type: application/json' --header='X-Auth-Key: mykey' --body-data='{"v": "some_value"}'

httpie

echo '{
  "v": "some_value"
}' | http PUT http://localhost:8812/r/cvar/test Content-Type:application/json X-Auth-Key:mykey

python-requests

requests.put('http://localhost:8812/r/cvar/test', headers={
    'Content-Type': 'application/json',
    'X-Auth-Key': 'mykey',
}, json={
    'v': 'some_value',
})

response

HTTP/1.1 201 Created
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Content-Type: application/json
Expires: 0
Pragma: no-cache

{
    "test": "some_value"
}

Parameters:

  • API Key API key with master permissions

Optionally:

  • v variable value (if not specified, variable is deleted)

Locking functions

acquire lock

Locks can be used similarly to file locking by the specific process. The difference is that SYS API tokens can be:

  • centralized for several systems (any EVA server can act as lock server)
  • removed from outside
  • automatically unlocked after the expiration time, if the initiator failed or forgot to release the lock

used to restrict parallel process starting or access to system files/resources. LM PLC macro share locks with extrnal scripts.

Note

Even if different EVA controllers are working on the same server, their lock tokens are stored in different bases. To work with the token of each subsystem, use SYS API on the respective address/port.

http

PUT /r/lock/mylock1 HTTP/1.1
Host: localhost:8812
X-Auth-Key: mykey
Content-Type: application/json

{ "e": 1, "t": 15 }

curl

curl -i -X PUT http://localhost:8812/r/lock/mylock1 -H 'Content-Type: application/json' -H 'X-Auth-Key: mykey' --data-raw '{"e": 1, "t": 15}'

wget

wget -S -O- --method=PUT http://localhost:8812/r/lock/mylock1 --header='Content-Type: application/json' --header='X-Auth-Key: mykey' --body-data='{"e": 1, "t": 15}'

httpie

echo '{
  "e": 1,
  "t": 15
}' | http PUT http://localhost:8812/r/lock/mylock1 Content-Type:application/json X-Auth-Key:mykey

python-requests

requests.put('http://localhost:8812/r/lock/mylock1', headers={
    'Content-Type': 'application/json',
    'X-Auth-Key': 'mykey',
}, json={
    'e': 1,
    't': 15,
})

response

HTTP/1.1 201 Created
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Content-Type: application/json
Expires: 0
Pragma: no-cache

{
    "id": "mylock1",
    "type": "lock"
}

Parameters:

  • API Key API key with allow=lock permissions

Optionally:

  • t maximum time (seconds) to acquire lock
  • e time after which lock is automatically released (if absent, lock may be released only via unlock function)

get lock status

http

GET /r/lock/mylock1 HTTP/1.1
Host: localhost:8812
X-Auth-Key: mykey

curl

curl -i http://localhost:8812/r/lock/mylock1 -H 'X-Auth-Key: mykey'

wget

wget -S -O- http://localhost:8812/r/lock/mylock1 --header='X-Auth-Key: mykey'

httpie

http http://localhost:8812/r/lock/mylock1 X-Auth-Key:mykey

python-requests

requests.get('http://localhost:8812/r/lock/mylock1', headers={
    'X-Auth-Key': 'mykey',
})

response

HTTP/1.1 200 OK
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Content-Type: application/json
Expires: 0
Pragma: no-cache

{
    "id": "mylock1",
    "locked": true,
    "type": "lock"
}

Parameters:

  • API Key API key with allow=lock permissions

release lock

Releases the previously acquired lock.

http

DELETE /r/lock/mylock1 HTTP/1.1
Host: localhost:8812
X-Auth-Key: mykey

curl

curl -i -X DELETE http://localhost:8812/r/lock/mylock1 -H 'X-Auth-Key: mykey'

wget

wget -S -O- --method=DELETE http://localhost:8812/r/lock/mylock1 --header='X-Auth-Key: mykey'

httpie

http DELETE http://localhost:8812/r/lock/mylock1 X-Auth-Key:mykey

python-requests

requests.delete('http://localhost:8812/r/lock/mylock1', headers={
    'X-Auth-Key': 'mykey',
})

response

HTTP/1.1 204 No Content
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Expires: 0
Pragma: no-cache

Parameters:

  • API Key API key with allow=lock permissions

Logging

put message to log file

An external application can put a message in the logs on behalf of the controller.

http

POST /r/log/warning HTTP/1.1
Host: localhost:8812
X-Auth-Key: mykey
Content-Type: application/json

{ "m": "local file system is full" }

curl

curl -i -X POST http://localhost:8812/r/log/warning -H 'Content-Type: application/json' -H 'X-Auth-Key: mykey' --data-raw '{"m": "local file system is full"}'

wget

wget -S -O- http://localhost:8812/r/log/warning --header='Content-Type: application/json' --header='X-Auth-Key: mykey' --post-data='{"m": "local file system is full"}'

httpie

echo '{
  "m": "local file system is full"
}' | http POST http://localhost:8812/r/log/warning Content-Type:application/json X-Auth-Key:mykey

python-requests

requests.post('http://localhost:8812/r/log/warning', headers={
    'Content-Type': 'application/json',
    'X-Auth-Key': 'mykey',
}, json={
    'm': 'local file system is full',
})

response

HTTP/1.1 204 No Content
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Expires: 0
Pragma: no-cache

Parameters:

  • API Key API key with sysfunc=yes permissions
  • l log level
  • m message text

put debug message to log file

An external application can put a message in the logs on behalf of the controller.

Parameters:

  • API Key API key with sysfunc=yes permissions
  • m message text

put info message to log file

An external application can put a message in the logs on behalf of the controller.

Parameters:

  • API Key API key with sysfunc=yes permissions
  • m message text

put warning message to log file

An external application can put a message in the logs on behalf of the controller.

Parameters:

  • API Key API key with sysfunc=yes permissions
  • m message text

put error message to log file

An external application can put a message in the logs on behalf of the controller.

Parameters:

  • API Key API key with sysfunc=yes permissions
  • m message text

put critical message to log file

An external application can put a message in the logs on behalf of the controller.

Parameters:

  • API Key API key with sysfunc=yes permissions
  • m message text

get records from the controller log

Log records are stored in the controllers’ memory until restart or the time (keep_logmem) specified in controller configuration passes.

http

GET /r/log/warning?t=3600&n=3 HTTP/1.1
Host: localhost:8812
X-Auth-Key: mykey

curl

curl -i 'http://localhost:8812/r/log/warning?t=3600&n=3' -H 'X-Auth-Key: mykey'

wget

wget -S -O- 'http://localhost:8812/r/log/warning?t=3600&n=3' --header='X-Auth-Key: mykey'

httpie

http 'http://localhost:8812/r/log/warning?t=3600&n=3' X-Auth-Key:mykey

python-requests

requests.get('http://localhost:8812/r/log/warning?t=3600&n=3', headers={
    'X-Auth-Key': 'mykey',
})

response

HTTP/1.1 200 OK
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Content-Type: application/json
Expires: 0
Pragma: no-cache

[
    {
        "h": "mws1-v1",
        "l": 30,
        "mod": "sysapi",
        "msg": "test warning message",
        "p": "uc",
        "t": 1552863481.1394246,
        "th": "CP Server Thread-15"
    },
    {
        "h": "mws1-v1",
        "l": 40,
        "mod": "sysapi",
        "msg": "test error message",
        "p": "uc",
        "t": 1552863481.1516943,
        "th": "CP Server Thread-16"
    },
    {
        "h": "mws1-v1",
        "l": 50,
        "mod": "sysapi",
        "msg": "test critical message",
        "p": "uc",
        "t": 1552863481.1631815,
        "th": "CP Server Thread-17"
    }
]

Parameters:

  • API Key API key with sysfunc=yes permissions

Optionally:

  • t get log records not older than t seconds
  • n the maximum number of log records you want to obtain

rotate log file

Equal to kill -HUP <controller_process_pid>.

http

POST /r/core HTTP/1.1
Host: localhost:8812
X-Auth-Key: mykey
Content-Type: application/json

{ "method": "log_rotate" }

curl

curl -i -X POST http://localhost:8812/r/core -H 'Content-Type: application/json' -H 'X-Auth-Key: mykey' --data-raw '{"method": "log_rotate"}'

wget

wget -S -O- http://localhost:8812/r/core --header='Content-Type: application/json' --header='X-Auth-Key: mykey' --post-data='{"method": "log_rotate"}'

httpie

echo '{
  "method": "log_rotate"
}' | http POST http://localhost:8812/r/core Content-Type:application/json X-Auth-Key:mykey

python-requests

requests.post('http://localhost:8812/r/core', headers={
    'Content-Type': 'application/json',
    'X-Auth-Key': 'mykey',
}, json={
    'method': 'log_rotate',
})

response

HTTP/1.1 204 No Content
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Expires: 0
Pragma: no-cache

Parameters:

  • API Key API key with sysfunc=yes permissions

API keys

create API key

API keys are defined statically in etc/<controller>_apikeys.ini file as well as can be created with API and stored in user database.

Keys with master permission can not be created.

http

PUT /r/key/testkey2 HTTP/1.1
Host: localhost:8812
X-Auth-Key: mykey
Content-Type: application/json

{ "save": true, "sysfunc": true, "allow": "cmd" }

curl

curl -i -X PUT http://localhost:8812/r/key/testkey2 -H 'Content-Type: application/json' -H 'X-Auth-Key: mykey' --data-raw '{"allow": "cmd", "save": true, "sysfunc": true}'

wget

wget -S -O- --method=PUT http://localhost:8812/r/key/testkey2 --header='Content-Type: application/json' --header='X-Auth-Key: mykey' --body-data='{"allow": "cmd", "save": true, "sysfunc": true}'

httpie

echo '{
  "allow": "cmd",
  "save": true,
  "sysfunc": true
}' | http PUT http://localhost:8812/r/key/testkey2 Content-Type:application/json X-Auth-Key:mykey

python-requests

requests.put('http://localhost:8812/r/key/testkey2', headers={
    'Content-Type': 'application/json',
    'X-Auth-Key': 'mykey',
}, json={
    'allow': 'cmd',
    'save': True,
    'sysfunc': True,
})

response

HTTP/1.1 201 Created
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Content-Type: application/json
Expires: 0
Pragma: no-cache

{
    "allow": [
        "cmd"
    ],
    "dynamic": true,
    "groups": [],
    "hosts_allow": [
        "0.0.0.0/0"
    ],
    "hosts_assign": [],
    "id": "testkey2",
    "items": [],
    "key": "443e342f7e49566fafc1cbe928878b0c18510bb2979ceca7aceb5e45b2b96280",
    "master": false,
    "pvt": [],
    "rpvt": [],
    "sysfunc": true
}

Parameters:

  • API Key API key with master permissions
  • save save configuration immediately

Returns:

JSON with serialized key object

delete API key

http

DELETE /r/key/testkey2 HTTP/1.1
Host: localhost:8812
X-Auth-Key: mykey

curl

curl -i -X DELETE http://localhost:8812/r/key/testkey2 -H 'X-Auth-Key: mykey'

wget

wget -S -O- --method=DELETE http://localhost:8812/r/key/testkey2 --header='X-Auth-Key: mykey'

httpie

http DELETE http://localhost:8812/r/key/testkey2 X-Auth-Key:mykey

python-requests

requests.delete('http://localhost:8812/r/key/testkey2', headers={
    'X-Auth-Key': 'mykey',
})

response

HTTP/1.1 204 No Content
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Expires: 0
Pragma: no-cache

Parameters:

  • API Key API key with master permissions

list API key permissions

Lists API key permissons (including a key itself)

Note

API keys, defined in etc/<controller>_apikeys.ini file can not be managed with API.

http

GET /r/key/testkey2 HTTP/1.1
Host: localhost:8812
X-Auth-Key: mykey

curl

curl -i http://localhost:8812/r/key/testkey2 -H 'X-Auth-Key: mykey'

wget

wget -S -O- http://localhost:8812/r/key/testkey2 --header='X-Auth-Key: mykey'

httpie

http http://localhost:8812/r/key/testkey2 X-Auth-Key:mykey

python-requests

requests.get('http://localhost:8812/r/key/testkey2', headers={
    'X-Auth-Key': 'mykey',
})

response

HTTP/1.1 200 OK
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Content-Type: application/json
Expires: 0
Pragma: no-cache

{
    "allow": [
        "cmd"
    ],
    "dynamic": true,
    "groups": [],
    "hosts_allow": [
        "0.0.0.0/0"
    ],
    "hosts_assign": [],
    "id": "testkey2",
    "items": [],
    "key": "443e342f7e49566fafc1cbe928878b0c18510bb2979ceca7aceb5e45b2b96280",
    "master": false,
    "pvt": [],
    "rpvt": [],
    "sysfunc": true
}

Parameters:

  • API Key API key with master permissions
  • save save configuration immediately

list API keys

http

GET /r/key HTTP/1.1
Host: localhost:8812
X-Auth-Key: mykey

curl

curl -i http://localhost:8812/r/key -H 'X-Auth-Key: mykey'

wget

wget -S -O- http://localhost:8812/r/key --header='X-Auth-Key: mykey'

httpie

http http://localhost:8812/r/key X-Auth-Key:mykey

python-requests

requests.get('http://localhost:8812/r/key', headers={
    'X-Auth-Key': 'mykey',
})

response

HTTP/1.1 200 OK
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Content-Type: application/json
Expires: 0
Pragma: no-cache

[
    {
        "dynamic": false,
        "key_id": "masterkey",
        "master": true
    },
    {
        "allow": {
            "cmd": true,
            "device": true,
            "lock": false
        },
        "dynamic": true,
        "groups": [
            "#"
        ],
        "items": [],
        "key_id": "default",
        "master": false,
        "sysfunc": false
    },
    {
        "allow": {
            "cmd": true,
            "device": true,
            "lock": false
        },
        "dynamic": false,
        "groups": [
            "#"
        ],
        "items": [],
        "key_id": "lm",
        "master": false,
        "sysfunc": false
    },
    {
        "allow": {
            "cmd": false,
            "device": true,
            "lock": true
        },
        "dynamic": false,
        "groups": [
            "#"
        ],
        "items": [],
        "key_id": "operator",
        "master": false,
        "sysfunc": true
    },
    {
        "allow": {
            "cmd": false,
            "device": false,
            "lock": false
        },
        "dynamic": false,
        "groups": [
            "#"
        ],
        "items": [],
        "key_id": "sfa",
        "master": false,
        "sysfunc": false
    },
    {
        "allow": {
            "cmd": false,
            "device": false,
            "lock": false
        },
        "dynamic": true,
        "groups": [],
        "items": [
            "item1"
        ],
        "key_id": "t4",
        "master": false,
        "sysfunc": true
    },
    {
        "allow": {
            "cmd": false,
            "device": false,
            "lock": false
        },
        "dynamic": false,
        "groups": [],
        "items": [
            "sensor:sensors/sensor1"
        ],
        "key_id": "test",
        "master": false,
        "sysfunc": false
    },
    {
        "allow": {
            "cmd": false,
            "device": false,
            "lock": false
        },
        "dynamic": true,
        "groups": [],
        "items": [],
        "key_id": "testkey",
        "master": false,
        "sysfunc": true
    },
    {
        "allow": {
            "cmd": true,
            "device": false,
            "lock": false
        },
        "dynamic": true,
        "groups": [],
        "items": [],
        "key_id": "testkey2",
        "master": false,
        "sysfunc": true
    }
]

Parameters:

  • API Key API key with master permissions

regenerate API key

http

POST /r/key/testkey2 HTTP/1.1
Host: localhost:8812
X-Auth-Key: mykey
Content-Type: application/json

{ "method": "regenerate" }

curl

curl -i -X POST http://localhost:8812/r/key/testkey2 -H 'Content-Type: application/json' -H 'X-Auth-Key: mykey' --data-raw '{"method": "regenerate"}'

wget

wget -S -O- http://localhost:8812/r/key/testkey2 --header='Content-Type: application/json' --header='X-Auth-Key: mykey' --post-data='{"method": "regenerate"}'

httpie

echo '{
  "method": "regenerate"
}' | http POST http://localhost:8812/r/key/testkey2 Content-Type:application/json X-Auth-Key:mykey

python-requests

requests.post('http://localhost:8812/r/key/testkey2', headers={
    'Content-Type': 'application/json',
    'X-Auth-Key': 'mykey',
}, json={
    'method': 'regenerate',
})

response

HTTP/1.1 200 OK
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Content-Type: application/json
Expires: 0
Pragma: no-cache

{
    "key": "3dbcd3d24c6dc878cebe369eb9fdb95ae99fee14e99cdfd911b83629688d2854"
}

Parameters:

  • API Key API key with master permissions

Returns:

JSON dict with new key value in “key” field

set API key permissions

http

PATCH /r/key/testkey2 HTTP/1.1
Host: localhost:8812
X-Auth-Key: mykey
Content-Type: application/json

{ "save": true, "sysfunc": true }

curl

curl -i -X PATCH http://localhost:8812/r/key/testkey2 -H 'Content-Type: application/json' -H 'X-Auth-Key: mykey' --data-raw '{"save": true, "sysfunc": true}'

wget

wget -S -O- --method=PATCH http://localhost:8812/r/key/testkey2 --header='Content-Type: application/json' --header='X-Auth-Key: mykey' --body-data='{"save": true, "sysfunc": true}'

httpie

echo '{
  "save": true,
  "sysfunc": true
}' | http PATCH http://localhost:8812/r/key/testkey2 Content-Type:application/json X-Auth-Key:mykey

python-requests

requests.patch('http://localhost:8812/r/key/testkey2', headers={
    'Content-Type': 'application/json',
    'X-Auth-Key': 'mykey',
}, json={
    'save': True,
    'sysfunc': True,
})

response

HTTP/1.1 204 No Content
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Expires: 0
Pragma: no-cache

Parameters:

  • API Key API key with master permissions
  • p property
  • v value (if none, permission will be revoked)
  • save save configuration immediately

User accounts

assign API key to user

http

PATCH /r/user/test2 HTTP/1.1
Host: localhost:8812
X-Auth-Key: mykey
Content-Type: application/json

{ "a": "masterkey" }

curl

curl -i -X PATCH http://localhost:8812/r/user/test2 -H 'Content-Type: application/json' -H 'X-Auth-Key: mykey' --data-raw '{"a": "masterkey"}'

wget

wget -S -O- --method=PATCH http://localhost:8812/r/user/test2 --header='Content-Type: application/json' --header='X-Auth-Key: mykey' --body-data='{"a": "masterkey"}'

httpie

echo '{
  "a": "masterkey"
}' | http PATCH http://localhost:8812/r/user/test2 Content-Type:application/json X-Auth-Key:mykey

python-requests

requests.patch('http://localhost:8812/r/user/test2', headers={
    'Content-Type': 'application/json',
    'X-Auth-Key': 'mykey',
}, json={
    'a': 'masterkey',
})

response

HTTP/1.1 204 No Content
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Expires: 0
Pragma: no-cache

Parameters:

  • API Key API key with master permissions
  • a API key to assign (key id, not a key itself)

create user account

Note

All changes to user accounts are instant, if the system works in read/only mode, set it to read/write before performing user management.

http

PUT /r/user/test2 HTTP/1.1
Host: localhost:8812
X-Auth-Key: mykey
Content-Type: application/json

{ "p": "verysecretpassword", "a": "testkey" }

curl

curl -i -X PUT http://localhost:8812/r/user/test2 -H 'Content-Type: application/json' -H 'X-Auth-Key: mykey' --data-raw '{"a": "testkey", "p": "verysecretpassword"}'

wget

wget -S -O- --method=PUT http://localhost:8812/r/user/test2 --header='Content-Type: application/json' --header='X-Auth-Key: mykey' --body-data='{"a": "testkey", "p": "verysecretpassword"}'

httpie

echo '{
  "a": "testkey",
  "p": "verysecretpassword"
}' | http PUT http://localhost:8812/r/user/test2 Content-Type:application/json X-Auth-Key:mykey

python-requests

requests.put('http://localhost:8812/r/user/test2', headers={
    'Content-Type': 'application/json',
    'X-Auth-Key': 'mykey',
}, json={
    'a': 'testkey',
    'p': 'verysecretpassword',
})

response

HTTP/1.1 201 Created
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Content-Type: application/json
Expires: 0
Pragma: no-cache

{
    "key": "testkey",
    "user": "test2"
}

Parameters:

  • API Key API key with master permissions
  • p user password
  • a API key to assign (key id, not a key itself)

delete user account

http

DELETE /r/user/test2 HTTP/1.1
Host: localhost:8812
X-Auth-Key: mykey

curl

curl -i -X DELETE http://localhost:8812/r/user/test2 -H 'X-Auth-Key: mykey'

wget

wget -S -O- --method=DELETE http://localhost:8812/r/user/test2 --header='X-Auth-Key: mykey'

httpie

http DELETE http://localhost:8812/r/user/test2 X-Auth-Key:mykey

python-requests

requests.delete('http://localhost:8812/r/user/test2', headers={
    'X-Auth-Key': 'mykey',
})

response

HTTP/1.1 204 No Content
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Expires: 0
Pragma: no-cache

Parameters:

  • API Key API key with master permissions

get user account info

http

GET /r/user/test2 HTTP/1.1
Host: localhost:8812
X-Auth-Key: mykey

curl

curl -i http://localhost:8812/r/user/test2 -H 'X-Auth-Key: mykey'

wget

wget -S -O- http://localhost:8812/r/user/test2 --header='X-Auth-Key: mykey'

httpie

http http://localhost:8812/r/user/test2 X-Auth-Key:mykey

python-requests

requests.get('http://localhost:8812/r/user/test2', headers={
    'X-Auth-Key': 'mykey',
})

response

HTTP/1.1 200 OK
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Content-Type: application/json
Expires: 0
Pragma: no-cache

{
    "key": "testkey",
    "user": "test2"
}

Parameters:

  • API Key API key with master permissions

list user accounts

http

GET /r/user HTTP/1.1
Host: localhost:8812
X-Auth-Key: mykey

curl

curl -i http://localhost:8812/r/user -H 'X-Auth-Key: mykey'

wget

wget -S -O- http://localhost:8812/r/user --header='X-Auth-Key: mykey'

httpie

http http://localhost:8812/r/user X-Auth-Key:mykey

python-requests

requests.get('http://localhost:8812/r/user', headers={
    'X-Auth-Key': 'mykey',
})

response

HTTP/1.1 200 OK
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Content-Type: application/json
Expires: 0
Pragma: no-cache

[
    {
        "key": "test",
        "user": "divisor"
    },
    {
        "key": "testkey",
        "user": "test"
    },
    {
        "key": "testkey",
        "user": "test2"
    }
]

Parameters:

  • API Key API key with master permissions

set user password

http

PATCH /r/user/test2 HTTP/1.1
Host: localhost:8812
X-Auth-Key: mykey
Content-Type: application/json

{ "p": "qwerty" }

curl

curl -i -X PATCH http://localhost:8812/r/user/test2 -H 'Content-Type: application/json' -H 'X-Auth-Key: mykey' --data-raw '{"p": "qwerty"}'

wget

wget -S -O- --method=PATCH http://localhost:8812/r/user/test2 --header='Content-Type: application/json' --header='X-Auth-Key: mykey' --body-data='{"p": "qwerty"}'

httpie

echo '{
  "p": "qwerty"
}' | http PATCH http://localhost:8812/r/user/test2 Content-Type:application/json X-Auth-Key:mykey

python-requests

requests.patch('http://localhost:8812/r/user/test2', headers={
    'Content-Type': 'application/json',
    'X-Auth-Key': 'mykey',
}, json={
    'p': 'qwerty',
})

response

HTTP/1.1 204 No Content
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Expires: 0
Pragma: no-cache

Parameters:

  • API Key API key with master permissions
  • p new password

Notifier management

disable notifier

Note

The notifier is disabled until controller restart. To disable notifier permanently, use notifier management CLI.

http

PATCH /r/notifier/eva_1 HTTP/1.1
Host: localhost:8812
X-Auth-Key: mykey
Content-Type: application/json

{ "enabled": false }

curl

curl -i -X PATCH http://localhost:8812/r/notifier/eva_1 -H 'Content-Type: application/json' -H 'X-Auth-Key: mykey' --data-raw '{"enabled": false}'

wget

wget -S -O- --method=PATCH http://localhost:8812/r/notifier/eva_1 --header='Content-Type: application/json' --header='X-Auth-Key: mykey' --body-data='{"enabled": false}'

httpie

echo '{
  "enabled": false
}' | http PATCH http://localhost:8812/r/notifier/eva_1 Content-Type:application/json X-Auth-Key:mykey

python-requests

requests.patch('http://localhost:8812/r/notifier/eva_1', headers={
    'Content-Type': 'application/json',
    'X-Auth-Key': 'mykey',
}, json={
    'enabled': False,
})

response

HTTP/1.1 204 No Content
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Expires: 0
Pragma: no-cache

Parameters:

  • API Key API key with master permissions

enable notifier

Note

The notifier is enabled until controller restart. To enable notifier permanently, use notifier management CLI.

http

PATCH /r/notifier/eva_1 HTTP/1.1
Host: localhost:8812
X-Auth-Key: mykey
Content-Type: application/json

{ "enabled": true }

curl

curl -i -X PATCH http://localhost:8812/r/notifier/eva_1 -H 'Content-Type: application/json' -H 'X-Auth-Key: mykey' --data-raw '{"enabled": true}'

wget

wget -S -O- --method=PATCH http://localhost:8812/r/notifier/eva_1 --header='Content-Type: application/json' --header='X-Auth-Key: mykey' --body-data='{"enabled": true}'

httpie

echo '{
  "enabled": true
}' | http PATCH http://localhost:8812/r/notifier/eva_1 Content-Type:application/json X-Auth-Key:mykey

python-requests

requests.patch('http://localhost:8812/r/notifier/eva_1', headers={
    'Content-Type': 'application/json',
    'X-Auth-Key': 'mykey',
}, json={
    'enabled': True,
})

response

HTTP/1.1 204 No Content
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Expires: 0
Pragma: no-cache

Parameters:

  • API Key API key with master permissions

get notifier configuration

http

GET /r/notifier/eva_1 HTTP/1.1
Host: localhost:8812
X-Auth-Key: mykey

curl

curl -i http://localhost:8812/r/notifier/eva_1 -H 'X-Auth-Key: mykey'

wget

wget -S -O- http://localhost:8812/r/notifier/eva_1 --header='X-Auth-Key: mykey'

httpie

http http://localhost:8812/r/notifier/eva_1 X-Auth-Key:mykey

python-requests

requests.get('http://localhost:8812/r/notifier/eva_1', headers={
    'X-Auth-Key': 'mykey',
})

response

HTTP/1.1 200 OK
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Content-Type: application/json
Expires: 0
Pragma: no-cache

{
    "announce_interval": 5.0,
    "api_enabled": true,
    "enabled": false,
    "events": [
        {
            "groups": [
                "#"
            ],
            "subject": "state",
            "types": [
                "#"
            ]
        },
        {
            "level": 30,
            "subject": "log"
        }
    ],
    "host": "mws1-v1",
    "id": "eva_1",
    "password": "test",
    "qos": {
        "action": 2,
        "log": 2,
        "state": 2,
        "system": 2
    },
    "type": "mqtt",
    "username": "eva"
}

Parameters:

  • API Key API key with master permissions

list notifiers

http

GET /r/notifier HTTP/1.1
Host: localhost:8812
X-Auth-Key: mykey

curl

curl -i http://localhost:8812/r/notifier -H 'X-Auth-Key: mykey'

wget

wget -S -O- http://localhost:8812/r/notifier --header='X-Auth-Key: mykey'

httpie

http http://localhost:8812/r/notifier X-Auth-Key:mykey

python-requests

requests.get('http://localhost:8812/r/notifier', headers={
    'X-Auth-Key': 'mykey',
})

response

HTTP/1.1 200 OK
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Content-Type: application/json
Expires: 0
Pragma: no-cache

[
    {
        "db": "db1.db",
        "enabled": true,
        "events": [
            {
                "groups": [
                    "#"
                ],
                "subject": "state",
                "types": [
                    "#"
                ]
            }
        ],
        "id": "db_1",
        "keep": 86400,
        "type": "db"
    },
    {
        "announce_interval": 5.0,
        "api_enabled": true,
        "enabled": false,
        "events": [
            {
                "groups": [
                    "#"
                ],
                "subject": "state",
                "types": [
                    "#"
                ]
            },
            {
                "level": 30,
                "subject": "log"
            }
        ],
        "host": "mws1-v1",
        "id": "eva_1",
        "password": "test",
        "qos": {
            "action": 2,
            "log": 2,
            "state": 2,
            "system": 2
        },
        "type": "mqtt",
        "username": "eva"
    }
]

Parameters:

  • API Key API key with master permissions

File management

put file to runtime folder

Puts a new file into runtime folder. If the file with such name exists, it will be overwritten. As all files in runtime are text, binary data can not be put.

http

PUT /r/runtime/xc/uc/test_action_script2 HTTP/1.1
Host: localhost:8812
X-Auth-Key: mykey
Content-Type: application/json

{ "m": "/bin/sh\n\nexit 0", "e": true }

curl

curl -i -X PUT http://localhost:8812/r/runtime/xc/uc/test_action_script2 -H 'Content-Type: application/json' -H 'X-Auth-Key: mykey' --data-raw '{"e": true, "m": "/bin/sh\n\nexit 0"}'

wget

wget -S -O- --method=PUT http://localhost:8812/r/runtime/xc/uc/test_action_script2 --header='Content-Type: application/json' --header='X-Auth-Key: mykey' --body-data='{"e": true, "m": "/bin/sh\n\nexit 0"}'

httpie

echo '{
  "e": true,
  "m": "/bin/sh\n\nexit 0"
}' | http PUT http://localhost:8812/r/runtime/xc/uc/test_action_script2 Content-Type:application/json X-Auth-Key:mykey

python-requests

requests.put('http://localhost:8812/r/runtime/xc/uc/test_action_script2', headers={
    'Content-Type': 'application/json',
    'X-Auth-Key': 'mykey',
}, json={
    'e': True,
    'm': '/bin/sh\n\nexit 0',
})

response

HTTP/1.1 201 Created
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Content-Type: application/json
Expires: 0
Pragma: no-cache

{
    "id": "xc/uc/test_action_script2",
    "type": "runtime"
}

Parameters:

  • API Key API key with master permissions
  • m file content

set file exec permission

http

PATCH /r/runtime/xc/uc/test_action_script2 HTTP/1.1
Host: localhost:8812
X-Auth-Key: mykey
Content-Type: application/json

{ "e": true, "e": true }

curl

curl -i -X PATCH http://localhost:8812/r/runtime/xc/uc/test_action_script2 -H 'Content-Type: application/json' -H 'X-Auth-Key: mykey' --data-raw '{"e": true}'

wget

wget -S -O- --method=PATCH http://localhost:8812/r/runtime/xc/uc/test_action_script2 --header='Content-Type: application/json' --header='X-Auth-Key: mykey' --body-data='{"e": true}'

httpie

echo '{
  "e": true
}' | http PATCH http://localhost:8812/r/runtime/xc/uc/test_action_script2 Content-Type:application/json X-Auth-Key:mykey

python-requests

requests.patch('http://localhost:8812/r/runtime/xc/uc/test_action_script2', headers={
    'Content-Type': 'application/json',
    'X-Auth-Key': 'mykey',
}, json={
    'e': True,
})

response

HTTP/1.1 204 No Content
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Expires: 0
Pragma: no-cache

Parameters:

  • API Key API key with master permissions
  • e false for 0x644, true for 0x755 (executable)

delete file from runtime folder

http

DELETE /r/runtime/xc/uc/test_action_script2 HTTP/1.1
Host: localhost:8812
X-Auth-Key: mykey

curl

curl -i -X DELETE http://localhost:8812/r/runtime/xc/uc/test_action_script2 -H 'X-Auth-Key: mykey'

wget

wget -S -O- --method=DELETE http://localhost:8812/r/runtime/xc/uc/test_action_script2 --header='X-Auth-Key: mykey'

httpie

http DELETE http://localhost:8812/r/runtime/xc/uc/test_action_script2 X-Auth-Key:mykey

python-requests

requests.delete('http://localhost:8812/r/runtime/xc/uc/test_action_script2', headers={
    'X-Auth-Key': 'mykey',
})

response

HTTP/1.1 204 No Content
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Expires: 0
Pragma: no-cache

Parameters:

  • API Key API key with master permissions

get file contents from runtime folder

http

GET /r/runtime/xc/uc/test_action_script2 HTTP/1.1
Host: localhost:8812
X-Auth-Key: mykey

curl

curl -i http://localhost:8812/r/runtime/xc/uc/test_action_script2 -H 'X-Auth-Key: mykey'

wget

wget -S -O- http://localhost:8812/r/runtime/xc/uc/test_action_script2 --header='X-Auth-Key: mykey'

httpie

http http://localhost:8812/r/runtime/xc/uc/test_action_script2 X-Auth-Key:mykey

python-requests

requests.get('http://localhost:8812/r/runtime/xc/uc/test_action_script2', headers={
    'X-Auth-Key': 'mykey',
})

response

HTTP/1.1 200 OK
Allow: DELETE, GET, HEAD, PATCH, POST, PUT
Cache-Control: no-cache, no-store, must-revalidate
Content-Type: application/json
Expires: 0
Pragma: no-cache

{
    "data": "/bin/sh\n\nexit 0",
    "e": true,
    "file": "xc/uc/test_action_script2"
}

Parameters:

  • API Key API key with master permissions