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 see LM API.

RESTful API basics

Warning

RESTful API is deprecated and scheduled to be removed (not implemented) in EVA ICS v4. Use JSON RPC API, whenever it is possible.

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.

Long API calls

  • Long API calls should be avoided at any cost.

  • All critical action and command methods have an option to obtain action ID and check for the result later.

  • If long API calls are performed between controllers (e.g. action methods with wait param), remote controller timeout should be always greater than max. expected “wait” timeout in API call, otherwise client controller will repeat API calls continuously, up to max retries for the target controller.

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.

For SFA, the result section “connected” contains connection status of remote controllers. The API key must have an access either to “uc” and “lm” groups (“remote_uc:uc” and “remote_lm:lm”) or to particular controller oids.

http

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

curl

curl -i -X GET 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

Clear language cache

check access to the particular item

Does not check is supervisor lock set, also does not check the item really exist

Parameters:

  • API Key valid API key

  • i item id or list of ids

Returns:

oid list with subobjects “r”, “w” (true/false)

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) or array (list)

  • 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

  • s STDIN data

get list of loaded core plugins

http

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

curl

curl -i -X GET http://localhost:8812/r/plugin -H "X-Auth-Key: mykey"

wget

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

httpie

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

python-requests

requests.get('http://localhost:8812/r/plugin', 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

[
    {
        "author": "Altertech, https://www.altertech.com/",
        "license": "Apache License 2.0",
        "name": "test",
        "version": "0.0.1"
    }
]

Parameters:

  • API Key API key with master permissions

Returns:

list with plugin module information

install a package

Parameters:

  • API Key API key with master permissions

  • m package content (base64-encoded tar/tgz)

  • o package setup options

  • w wait (in seconds) before API call sends a response. This allows to try waiting until the package is installed

shutdown the controller

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

For MQTT API calls a small shutdown delay usually should be specified to let the core send the correct API response.

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

Returns:

current boot id. This allows client to check is the controller restarted later, by comparing returned boot id and new boot id (obtained with “test” command)

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 an 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.

If authentication token is specified, the function will check it and return token information if it is valid.

If both token and credentials (user or API key) are specified, the function will return the token to normal mode.

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",
    "user": "admin"
}

Parameters:

  • API Key valid API key or

  • u user login

  • p user password

  • a authentication token

Returns:

A dict, containing API key ID and authentication token

log out and purge the authentication token

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 token

Set token read-only

Applies read-only mode for token. In read-only mode, only read-only functions work, others return result_token_restricted(15).

The method works for token-authenticated API calls only.

To exit read-only mode, user must either re-login or, to keep the current token, call “login” API method with both token and user credentials.

Get neighbor clients

Parameters:

  • API Key valid API key

  • i neightbor client id

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

decrement lvar value

Decrement value of a logic variable. Initial value should be number

http

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

{ "v": "!decrement" }

curl

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

wget

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

httpie

echo '{
  "v": "!decrement"
}' | 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={'v': '!decrement'})

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 -X GET 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.

If master key is used, the method attempts to get stored state for an item even if it doesn’t present currently in system.

The method can return state log for disconnected items as well.

http

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

curl

curl -i -X GET 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 or e.g. 1D for -1 day)

  • e end time (timestamp or ISO or e.g. 1D for -1 day)

  • 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”)

  • z Time zone (pytz, e.g. UTC or Europe/Prague)

  • w fill frame with the interval (e.g. “1T” - 1 min, “2H” - 2 hours etc.), start time is required, set to 1D if not specified

  • g output format (“list”, “dict” or “chart”, default is “list”)

  • c options for chart (dict or comma separated)

  • o extra options for notifier data request

Returns:

history data in specified format or chart image.

For chart, JSON RPC gets reply with “content_type” and “data” fields, where content is image content type. If PNG image format is selected, data is base64-encoded.

Options for chart (all are optional):

If option “w” (fill) is used, number of digits after comma may be specified. E.g. 5T:3 will output values with 3 digits after comma.

Additionally, SI prefix may be specified to convert value to kilos, megas etc, e.g. 5T:k:3 - divide value by 1000 and output 3 digits after comma. Valid prefixes are: k, M, G, T, P, E, Z, Y.

If binary prefix is required, it should be followed by “b”, e.g. 5T:Mb:3 - divide value by 2^20 and output 3 digits after comma.

get item state log

State log of a single item or group of the specified type can be obtained using state_log command.

note: only SQL notifiers are supported

Difference from state_history method:

  • state_log doesn’t optimize data to be displayed on charts * the data is returned from a database as-is * a single item OID or OID mask (e.g. sensor:env/#) can be specified

note: the method supports MQTT-style masks but only masks with wildcard-ending, like “type:group/subgroup/#” are supported.

The method can return state log for disconnected items as well.

For wildcard fetching, API key should have an access to the whole chosen group.

note: record limit means the limit for records, fetched from the database, but repeating state records are automatically grouped and the actual number of returned records can be lower than requested.

http

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

curl

curl -i -X GET http://localhost:8817/r/lvar/tests/lvar1@log -H "X-Auth-Key: mykey"

wget

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

httpie

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

python-requests

requests.get('http://localhost:8817/r/lvar/tests/lvar1@log', 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

[
    {
        "oid": "lvar:tests/lvar1",
        "status": 1,
        "t": 1607295624.8417337,
        "value": null
    },
    {
        "oid": "lvar:tests/lvar1",
        "status": 1,
        "t": 1607295636.6316836,
        "value": "value1"
    },
    {
        "oid": "lvar:tests/lvar1",
        "status": 1,
        "t": 1607295637.536753,
        "value": "value2"
    },
    {
        "oid": "lvar:tests/lvar1",
        "status": 1,
        "t": 1607295638.475802,
        "value": "value3"
    }
]

Parameters:

  • API Key valid API key

  • a history notifier id (default: db_1)

Optionally:

  • s start time (timestamp or ISO or e.g. 1D for -1 day)

  • e end time (timestamp or ISO or e.g. 1D for -1 day)

  • l records limit (doesn’t work with “w”)

  • t time format (“iso” or “raw” for unix timestamp, default is “raw”)

  • z Time zone (pytz, e.g. UTC or Europe/Prague)

  • o extra options for notifier data request

Returns:

state log records (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 -X GET 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:

increment lvar value

Increment value of a logic variable. Initial value should be number

http

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

{ "v": "!increment" }

curl

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

wget

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

httpie

echo '{
  "v": "!increment"
}' | 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={'v': '!increment'})

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

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:

  • x serialize specified item prop(s)

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 -X GET 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 -X GET 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_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 rule 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 -X GET 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 -X GET 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 -X GET 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 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 -X GET 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 -X GET 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 -X GET 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

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

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 -X GET 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

[
    {
        "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"
    },
    {
        "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"
    }
]

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

Logic 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/68574286-35f8-4b52-b8e0-f51c6dafddf5
Pragma: no-cache

{
    "args": [],
    "err": "",
    "exitcode": null,
    "finished": false,
    "finished_in": null,
    "item_group": "tests",
    "item_id": "test_macro",
    "item_oid": "lmacro:tests/test_macro",
    "item_type": "lmacro",
    "kwargs": {},
    "out": "",
    "priority": 100,
    "status": "running",
    "time": {
        "created": 1559868831.9411464,
        "pending": 1559868831.9414475,
        "queued": 1559868831.9422777,
        "running": 1559868831.9430113
    },
    "uuid": "68574286-35f8-4b52-b8e0-f51c6dafddf5"
}

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 -X GET 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 -X GET 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 -X GET 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 -X GET 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 -X GET '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,
        "finished": true,
        "finished_in": 0.0097811,
        "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": 1559868831.1551707,
            "created": 1559868831.1453896,
            "pending": 1559868831.1458647,
            "queued": 1559868831.1469553,
            "running": 1559868831.1479862
        },
        "uuid": "7707c382-eefa-48d2-9b5e-92d114af4e85"
    }
]

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, D for dead

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

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 -X GET 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 -X GET '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 -X GET 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 -X GET 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 -X GET 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 -X GET 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 -X GET 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 -X GET 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 -X GET 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

rescan controllers via UPnP

http

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

{ "method": "upnp-rescan" }

curl

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

wget

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

httpie

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

python-requests

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

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

Scheduled jobs

create new job

Creates new scheduled job. Job id (UUID) is generated automatically unless specified.

http

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

curl

curl -i -X POST http://localhost:8817/r/job -H "X-Auth-Key: mykey"

wget

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

httpie

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

python-requests

requests.post('http://localhost:8817/r/job', 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/job/32ec1063-26cc-4f73-ba40-73ffc2e1787b
Pragma: no-cache

{
    "description": "",
    "enabled": false,
    "every": "",
    "id": "32ec1063-26cc-4f73-ba40-73ffc2e1787b",
    "last": null,
    "macro": null,
    "macro_args": [],
    "macro_kwargs": {},
    "oid": "job:jobs/32ec1063-26cc-4f73-ba40-73ffc2e1787b",
    "type": "job"
}

Parameters:

  • API Key API key with master permissions

Optionally:

  • save save job configuration immediately

delete job

Deletes scheduled job.

http

DELETE /r/job/9c6e8c99-56fe-490c-8442-4936ba777499 HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey

curl

curl -i -X DELETE http://localhost:8817/r/job/9c6e8c99-56fe-490c-8442-4936ba777499 -H "X-Auth-Key: mykey"

wget

wget -S -O- --method=DELETE http://localhost:8817/r/job/9c6e8c99-56fe-490c-8442-4936ba777499 --header="X-Auth-Key: mykey"

httpie

http DELETE http://localhost:8817/r/job/9c6e8c99-56fe-490c-8442-4936ba777499 X-Auth-Key:mykey

python-requests

requests.delete('http://localhost:8817/r/job/9c6e8c99-56fe-490c-8442-4936ba777499', 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 job information

http

GET /r/job/9c6e8c99-56fe-490c-8442-4936ba777499 HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey

curl

curl -i -X GET http://localhost:8817/r/job/9c6e8c99-56fe-490c-8442-4936ba777499 -H "X-Auth-Key: mykey"

wget

wget -S -O- http://localhost:8817/r/job/9c6e8c99-56fe-490c-8442-4936ba777499 --header="X-Auth-Key: mykey"

httpie

http http://localhost:8817/r/job/9c6e8c99-56fe-490c-8442-4936ba777499 X-Auth-Key:mykey

python-requests

requests.get('http://localhost:8817/r/job/9c6e8c99-56fe-490c-8442-4936ba777499', 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,
    "every": "",
    "id": "9c6e8c99-56fe-490c-8442-4936ba777499",
    "last": null,
    "macro": "tests/test1",
    "macro_args": [
        "test"
    ],
    "macro_kwargs": {},
    "oid": "job:jobs/9c6e8c99-56fe-490c-8442-4936ba777499",
    "type": "job"
}

Parameters:

  • API Key API key with master permissions

get jobs list

Get the list of all available scheduled jobs.

http

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

curl

curl -i -X GET http://localhost:8817/r/job -H "X-Auth-Key: mykey"

wget

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

httpie

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

python-requests

requests.get('http://localhost:8817/r/job', 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": false,
        "every": "",
        "id": "9d8a338f-cdc4-46ac-8610-ba3b1597c73e",
        "last": null,
        "macro": null,
        "macro_args": [],
        "macro_kwargs": {},
        "oid": "job:jobs/9d8a338f-cdc4-46ac-8610-ba3b1597c73e",
        "type": "job"
    },
    {
        "description": "",
        "enabled": false,
        "every": "",
        "id": "7545a768-ce67-44ad-9544-2a54ad6c7e83",
        "last": null,
        "macro": null,
        "macro_args": [],
        "macro_kwargs": {},
        "oid": "job:jobs/7545a768-ce67-44ad-9544-2a54ad6c7e83",
        "type": "job"
    }
]

Parameters:

  • API Key API key with master permissions

list job properties

Get all editable parameters of the scheduled job.

http

GET /r/job/9c6e8c99-56fe-490c-8442-4936ba777499@props HTTP/1.1
Host: localhost:8817
X-Auth-Key: mykey

curl

curl -i -X GET http://localhost:8817/r/job/9c6e8c99-56fe-490c-8442-4936ba777499@props -H "X-Auth-Key: mykey"

wget

wget -S -O- http://localhost:8817/r/job/9c6e8c99-56fe-490c-8442-4936ba777499@props --header="X-Auth-Key: mykey"

httpie

http http://localhost:8817/r/job/9c6e8c99-56fe-490c-8442-4936ba777499@props X-Auth-Key:mykey

python-requests

requests.get('http://localhost:8817/r/job/9c6e8c99-56fe-490c-8442-4936ba777499@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,
    "every": "",
    "macro": "tests/test1",
    "macro_args": [
        "test"
    ],
    "macro_kwargs": {}
}

Parameters:

  • API Key API key with master permissions

set job parameters

Set configuration parameters of the scheduled job.

http

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

{ "save": true, "macro": "tests/test1", "enabled": true }

curl

curl -i -X PATCH http://localhost:8817/r/job/9c6e8c99-56fe-490c-8442-4936ba777499 -H "Content-Type: application/json" -H "X-Auth-Key: mykey" --data-raw '{"enabled": true, "macro": "tests/test1", "save": true}'

wget

wget -S -O- --method=PATCH http://localhost:8817/r/job/9c6e8c99-56fe-490c-8442-4936ba777499 --header="Content-Type: application/json" --header="X-Auth-Key: mykey" --body-data='{"enabled": true, "macro": "tests/test1", "save": true}'

httpie

echo '{
  "enabled": true,
  "macro": "tests/test1",
  "save": true
}' | http PATCH http://localhost:8817/r/job/9c6e8c99-56fe-490c-8442-4936ba777499 Content-Type:application/json X-Auth-Key:mykey

python-requests

requests.patch('http://localhost:8817/r/job/9c6e8c99-56fe-490c-8442-4936ba777499', headers={'Content-Type': 'application/json', 'X-Auth-Key': 'mykey'}, json={'enabled': True, 'macro': 'tests/test1', '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

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 -X GET 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 can 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 -X GET 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 -X GET '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

  • x regex pattern filter

rotate log file

Deprecated, not required since 3.3.0

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

get API call log

  • API call with master permission returns all records requested

  • API call with other API key returns records for the specified key only

  • API call with an authentication token returns records for the current authorized user

http

GET /r/core@apilog HTTP/1.1
Host: localhost:8812
X-Auth-Key: mykey

curl

curl -i -X GET http://localhost:8812/r/core@apilog -H "X-Auth-Key: mykey"

wget

wget -S -O- http://localhost:8812/r/core@apilog --header="X-Auth-Key: mykey"

httpie

http http://localhost:8812/r/core@apilog X-Auth-Key:mykey

python-requests

requests.get('http://localhost:8812/r/core@apilog', 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

[
    {
        "auth": "key",
        "func": "login",
        "gw": "http",
        "id": "a4ac6da7-2fa8-4938-8613-48e6495158b1",
        "ip": "127.0.0.1",
        "ki": "operator",
        "params": "{\"u\":\"ttt\",\"p\":\"<hidden>\"}",
        "status": "OK",
        "t": 1596055098.3651853,
        "tf": 1596055098.3837607,
        "u": "ttt",
        "utp": null
    },
    {
        "auth": "key",
        "func": "list_key_props",
        "gw": "http",
        "id": "35685960-cc2f-4fb6-8efc-c4ebca8bf9b5",
        "ip": "127.0.0.1",
        "ki": "masterkey",
        "params": "{\"i\":\"operator\"}",
        "status": "OK",
        "t": 1596055125.9569867,
        "tf": 1596055125.9690392,
        "u": null,
        "utp": null
    },
    {
        "auth": "key",
        "func": "action_toggle",
        "gw": "http",
        "id": "1bdc23da-95a1-4b41-b354-3f3c62e24405",
        "ip": "127.0.0.1",
        "ki": "masterkey",
        "params": "{\"i\":\"unit:light/hall\",\"p\":null,\"w\":null,\"q\":null,\"u\":null}",
        "status": "OK",
        "t": 1596055185.7343063,
        "tf": 1596055185.7551231,
        "u": null,
        "utp": null
    }
]

Parameters:

  • API Key any valid API key

Optionally:

  • s start time (timestamp or ISO or e.g. 1D for -1 day)

  • e end time (timestamp or ISO or e.g. 1D for -1 day)

  • n records limit

  • t time format (“iso” or “raw” for unix timestamp, default is “raw”)

  • f record filter (requires API key with master permission)

Returns:

List of API calls

Note: API call params are returned as string and can be invalid JSON data as they’re always truncated to 512 symbols in log database

Record filter should be specified either as string (k1=val1,k2=val2) or as a dict. Valid fields are:

  • gw: filter by API gateway

  • ip: filter by caller IP

  • auth: filter by authentication type

  • u: filter by user

  • utp: filter by user type

  • ki: filter by API key ID

  • func: filter by API function

  • params: filter by API call params (matches if field contains value)

  • status: filter by API call status

API keys

create API key

API keys are defined statically in EVA registry config/<controller>/apikeys tree or can be created with API and stored in the user database.

Keys with the 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 EVA registry can not be managed with API.

http

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

curl

curl -i -X GET 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 -X GET 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) or multiple keys, comma separated

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 -X GET 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 -X GET 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_id": "test",
        "user": "divisor"
    },
    {
        "key_id": "testkey",
        "user": "test"
    },
    {
        "key_id": "testkey",
        "user": "test2"
    }
]

Parameters:

  • API Key API key with master permissions

set user password

Either master key and user login must be specified or a user must be logged in and a session token used

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 master key or token

  • p new password

List active session tokens

Parameters:

  • API Key API key with master permissions

Drop session token(s)

Parameters:

  • API Key API key with master permissions

  • a session token or

  • u user name or

  • i API key id

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 -X GET 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 -X GET 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

restart notifier

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 (plain text or base64-encoded)

  • b if True - put binary file (decode base64)

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 -X GET 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

  • b if True - force getting binary file (base64-encode content)

Core scripts

List MQTT topics core scripts react on

http

GET /r/corescript/mqtt-topics HTTP/1.1
Host: localhost:8812
X-Auth-Key: mykey

curl

curl -i -X GET http://localhost:8812/r/corescript/mqtt-topics -H "X-Auth-Key: mykey"

wget

wget -S -O- http://localhost:8812/r/corescript/mqtt-topics --header="X-Auth-Key: mykey"

httpie

http http://localhost:8812/r/corescript/mqtt-topics X-Auth-Key:mykey

python-requests

requests.get('http://localhost:8812/r/corescript/mqtt-topics', 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

[
    {
        "qos": 2,
        "topic": "eva_1:cluster/#"
    },
    {
        "qos": 2,
        "topic": "test/test2"
    },
    {
        "qos": 1,
        "topic": "ttt/ttt"
    }
]

Parameters:

  • API Key API key with master permissions

Reload core scripts if some was added or deleted

http

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

{ "method": "reload" }

curl

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

wget

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

httpie

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

python-requests

requests.post('http://localhost:8812/r/corescript', 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

Subscribe core scripts to MQTT topic

The method subscribes core scripts to topic of default MQTT notifier (eva_1). To specify another notifier, set topic as <notifer_id>:<topic>

http

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

{ "q": 2, "method": "mqtt-subscribe", "t": "some/test/topic2" }

curl

curl -i -X POST http://localhost:8812/r/corescript -H "Content-Type: application/json" -H "X-Auth-Key: mykey" --data-raw '{"method": "mqtt-subscribe", "q": 2, "t": "some/test/topic2"}'

wget

wget -S -O- http://localhost:8812/r/corescript --header="Content-Type: application/json" --header="X-Auth-Key: mykey" --post-data='{"method": "mqtt-subscribe", "q": 2, "t": "some/test/topic2"}'

httpie

echo '{
  "method": "mqtt-subscribe",
  "q": 2,
  "t": "some/test/topic2"
}' | http POST http://localhost:8812/r/corescript Content-Type:application/json X-Auth-Key:mykey

python-requests

requests.post('http://localhost:8812/r/corescript', headers={'Content-Type': 'application/json', 'X-Auth-Key': 'mykey'}, json={'method': 'mqtt-subscribe', 'q': 2, 't': 'some/test/topic2'})

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

  • t MQTT topic (“+” and “#” masks are supported)

  • q MQTT topic QoS

  • save save core script config after modification

Unsubscribe core scripts from MQTT topic

http

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

{ "method": "mqtt-unsubscribe", "t": "some/test/topic2" }

curl

curl -i -X POST http://localhost:8812/r/corescript -H "Content-Type: application/json" -H "X-Auth-Key: mykey" --data-raw '{"method": "mqtt-unsubscribe", "t": "some/test/topic2"}'

wget

wget -S -O- http://localhost:8812/r/corescript --header="Content-Type: application/json" --header="X-Auth-Key: mykey" --post-data='{"method": "mqtt-unsubscribe", "t": "some/test/topic2"}'

httpie

echo '{
  "method": "mqtt-unsubscribe",
  "t": "some/test/topic2"
}' | http POST http://localhost:8812/r/corescript Content-Type:application/json X-Auth-Key:mykey

python-requests

requests.post('http://localhost:8812/r/corescript', headers={'Content-Type': 'application/json', 'X-Auth-Key': 'mykey'}, json={'method': 'mqtt-unsubscribe', 't': 'some/test/topic2'})

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

  • t MQTT topic (“+” and “#” masks are allowed)

  • save save core script config after modification

Registry management

Safely purge registry database

Clears registry trash and invalid files. Keeps broken keys

Parameters:

  • API Key API key with sysfunc=yes permissions