LM API
Logic Manager API is used to manage lvars, rules and other logic elements
This document describes API methods for direct and JSON RPC calls. For RESTful API see LM RESTful API.
API basics
JSON RPC
JSON RPC 2.0 protocol is the primary EVA ICS API protocol. Note that default JSON RPC result is { “ok”: true } (instead of { “result”: “OK” } in the direct API). There’s no { result: “ERROR” } responses, as JSON RPC sends errors in “error” field.
If JSON RPC request is called without ID and server should not return a result, it will return http response with a code 202 Accepted.
Note
JSON RPC is recommended way to use EVA ICS API, unless direct method calling or RESTful is really required.
JSON RPC API URL:
http://<ip_address:8817>/jrpc
or
http://<ip_address:8817>
(all POST requests to the root URI are processed as JSON RPC)
JSON RPC payload encoding
EVA ICS supports JSON RPC payloads, encoded as generic JSON and as MessagePack. MessagePack encoding works faster, requires less bandwidth and is highly recommended to use.
To call API methods with MessagePack-encoded payloads, use Content-Type: application/msgpack HTTP request header.
JSON RPC error responses
JSON RPC calls return the following error codes:
1 the item or resource is not found
2 access is denied with the set API key
6 Attempt to call undefined API method/function
10 API function failed (all errors not listed here fall within this category)
11 API function is called with invalid params
12 API function attempted to create resource which already exists and can’t be recreated until deleted/removed
13 the resource is busy (in use) and can not be accessed/recreated or deleted at this moment
14 the method is not implemented in/for requested resource
Response field “message” may contain additional information about error.
Warning
It’s highly not recommended to perform long API calls, calling API functions from JavaScript in a web browser (e.g. giving “w” param to action methods to wait until action finish). Web browser may repeat API call continuously, which may lead to absolutely unexpected behavior.
JSON RPC via HTTP GET
Embedded equipment sometimes can send HTTP GET requests only. JSON RPC API supports such calls as well.
To make JSON RPC API request with HTTP get, send it to:
http://<ip_address:8817>/jrpc?i=ID&m=METHOD&p=PARAMS
where:
ID request ID (any custom value). If not specified, API response isn’t sent back
METHOD JSON RPC method to call
PARAMS method params, as url-encoded JSON
E.g. the following HTTP GET request will invoke method “test” with request id=1 and params { “k”: “mykey” }:
http://<ip_address:8817>/jrpc?i=1&m=test&p=%7B%22k%22%3A%22mykey%22%7D
Note
JSON RPC API calls via HTTP GET are insecure, limited to 2048 bytes and can not be batch. Use JSON RPC via HTTP POST with JSON or MessagePack payload always when possible.
Direct API
Warning
Direct method calling is deprecated and scheduled to be removed (not implemented) in EVA ICS v4. Use JSON RPC API, whenever it is possible.
LM API functions are called through URL request
http://<ip_address:8817>/lm-api/function
If SSL is allowed in the controller configuration file, you can also use https calls.
Direct API responses
Good for backward compatibility with any devices, as all API functions can be called using GET and POST. When POST is used, the parameters can be passed to functions either as multipart/form-data or as JSON.
API key can be sent in request parameters, session (if enabled and user is logged in) or in HTTP X-Auth-Key header.
Standard responses in status/body:
200 OK { “result”: “OK” } API call completed successfully.
Standard error responses in status:
400 Bad Request Invalid request params
403 Forbidden the API key has no access to this function or resource
404 Not Found method or resource/object doesn’t exist
405 Method Not Allowed API function/method not found or HTTP method is not either GET or POST
409 Conflict resource/object already exists or is locked
500 API Error API function execution has been failed. Check input parameters and server logs.
In case API function has been failed, response body will contain JSON data with _error field, which contains error message.
{
"_error": "unable to add object, already present",
"result": "ERROR"
}
LVar functions
clear - 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 /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 132
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "clear",
"params": {
"i": "tests/lvar1",
"k": "mykey"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 132" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "clear", "params": {"i": "tests/lvar1", "k": "mykey"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 132" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "clear", "params": {"i": "tests/lvar1", "k": "mykey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "clear",
"params": {
"i": "tests/lvar1",
"k": "mykey"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:132 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '132', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'clear', 'params': {'i': 'tests/lvar1', 'k': 'mykey'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 79
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"ok": true
}
}
Parameters:
k valid API key
i lvar id
decrement - decrement lvar value
Decrement value of a logic variable. Initial value should be number
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 136
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "decrement",
"params": {
"i": "tests/lvar1",
"k": "mykey"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 136" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "decrement", "params": {"i": "tests/lvar1", "k": "mykey"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 136" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "decrement", "params": {"i": "tests/lvar1", "k": "mykey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "decrement",
"params": {
"i": "tests/lvar1",
"k": "mykey"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:136 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '136', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'decrement', 'params': {'i': 'tests/lvar1', 'k': 'mykey'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 79
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"ok": true
}
}
Parameters:
k valid API key
i lvar id
groups - get item group list
Get the list of item groups. Useful e.g. for custom interfaces.
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 105
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "groups",
"params": {
"k": "mykey"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 105" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "groups", "params": {"k": "mykey"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 105" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "groups", "params": {"k": "mykey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "groups",
"params": {
"k": "mykey"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:105 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '105', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'groups', 'params': {'k': 'mykey'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 76
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": [
"tests"
]
}
Parameters:
k valid API key
p item type (must be set to lvar [LV])
increment - increment lvar value
Increment value of a logic variable. Initial value should be number
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 136
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "increment",
"params": {
"i": "tests/lvar1",
"k": "mykey"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 136" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "increment", "params": {"i": "tests/lvar1", "k": "mykey"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 136" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "increment", "params": {"i": "tests/lvar1", "k": "mykey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "increment",
"params": {
"i": "tests/lvar1",
"k": "mykey"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:136 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '136', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'increment', 'params': {'i': 'tests/lvar1', 'k': 'mykey'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 79
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"ok": true
}
}
Parameters:
k valid API key
i lvar id
reset - 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 /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 132
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "reset",
"params": {
"i": "tests/lvar1",
"k": "mykey"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 132" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "reset", "params": {"i": "tests/lvar1", "k": "mykey"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 132" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "reset", "params": {"i": "tests/lvar1", "k": "mykey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "reset",
"params": {
"i": "tests/lvar1",
"k": "mykey"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:132 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '132', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'reset', 'params': {'i': 'tests/lvar1', 'k': 'mykey'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 79
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"ok": true
}
}
Parameters:
k valid API key
i lvar id
set - set lvar state
Set status and value of a logic variable.
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 163
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "set",
"params": {
"i": "tests/lvar1",
"k": "mykey",
"s": 1,
"v": 29
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 163" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "set", "params": {"i": "tests/lvar1", "k": "mykey", "s": 1, "v": 29}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 163" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "set", "params": {"i": "tests/lvar1", "k": "mykey", "s": 1, "v": 29}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "set",
"params": {
"i": "tests/lvar1",
"k": "mykey",
"s": 1,
"v": 29
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:163 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '163', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'set', 'params': {'i': 'tests/lvar1', 'k': 'mykey', 's': 1, 'v': 29}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 79
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"ok": true
}
}
Parameters:
k valid API key
i lvar id
Optionally:
s lvar status
v lvar value
state - get lvar state
State of lvar or all lvars can be obtained using state command.
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 104
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "state",
"params": {
"k": "mykey"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 104" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "state", "params": {"k": "mykey"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 104" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "state", "params": {"k": "mykey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "state",
"params": {
"k": "mykey"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:104 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '104', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'state', 'params': {'k': 'mykey'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 666
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": [
{
"expires": 15.0,
"full_id": "tests/lvar1",
"group": "tests",
"id": "lvar1",
"oid": "lvar:tests/lvar1",
"set_time": 1604185854.291637,
"status": 1,
"type": "lvar",
"value": "0"
},
{
"expires": 0,
"full_id": "tests/lvar5",
"group": "tests",
"id": "lvar5",
"oid": "lvar:tests/lvar5",
"set_time": 1604185854.0752258,
"status": 1,
"type": "lvar",
"value": ""
}
]
}
Parameters:
k valid API key
Optionally:
p item type (none or lvar [LV])
i item id
g item group
full return full state
state_history - 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
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 145
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "state_history",
"params": {
"i": "lvar:tests/lvar1",
"k": "mykey"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 145" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "state_history", "params": {"i": "lvar:tests/lvar1", "k": "mykey"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 145" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "state_history", "params": {"i": "lvar:tests/lvar1", "k": "mykey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "state_history",
"params": {
"i": "lvar:tests/lvar1",
"k": "mykey"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:145 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '145', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'state_history', 'params': {'i': 'lvar:tests/lvar1', 'k': 'mykey'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 787
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"status": [
-1,
-1,
1,
1,
1,
1,
1,
1,
1,
1
],
"t": [
1604185850.3238852,
1604185851.9794078,
1604185854.0263395,
1604185854.1407351,
1604185854.1557796,
1604185854.2269773,
1604185854.242243,
1604185854.2968373,
1604185854.3143985,
1604185855.1648626
],
"value": [
null,
null,
null,
0.0,
0.0,
1.0,
1.0,
0.0,
0.0,
0.0
]
}
}
Parameters:
k valid API key
a history notifier id (default: db_1)
i item oids or full ids, list or comma separated
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):
type: chart type (line or bar, default is line)
tf: chart time format
out: output format (svg, png, default is svg),
style: chart style (without “Style” suffix, e.g. Dark)
other options: http://pygal.org/en/stable/documentation/configuration/chart.html#options (use range_min, range_max for range, other are passed as-is)
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.
state_log - 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
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 141
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "state_log",
"params": {
"i": "lvar:tests/lvar1",
"k": "mykey"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 141" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "state_log", "params": {"i": "lvar:tests/lvar1", "k": "mykey"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 141" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "state_log", "params": {"i": "lvar:tests/lvar1", "k": "mykey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "state_log",
"params": {
"i": "lvar:tests/lvar1",
"k": "mykey"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:141 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '141', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'state_log', 'params': {'i': 'lvar:tests/lvar1', 'k': 'mykey'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 661
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": [
{
"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:
k valid API key
a history notifier id (default: db_1)
i item oid or oid mask (type:group/subgroup/#)
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)
toggle - 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 /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 133
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "toggle",
"params": {
"i": "tests/lvar1",
"k": "mykey"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 133" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "toggle", "params": {"i": "tests/lvar1", "k": "mykey"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 133" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "toggle", "params": {"i": "tests/lvar1", "k": "mykey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "toggle",
"params": {
"i": "tests/lvar1",
"k": "mykey"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:133 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '133', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'toggle', 'params': {'i': 'tests/lvar1', 'k': 'mykey'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 79
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"ok": true
}
}
Parameters:
k valid API key
i lvar id
LVar management
list - list lvars
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 103
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "list",
"params": {
"k": "mykey"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 103" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "list", "params": {"k": "mykey"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 103" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "list", "params": {"k": "mykey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "list",
"params": {
"k": "mykey"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:103 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '103', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'list', 'params': {'k': 'mykey'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 624
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": [
{
"description": "",
"expires": 0,
"full_id": "tests/lvar1",
"group": "tests",
"id": "lvar1",
"oid": "lvar:tests/lvar1",
"set_time": 1604185854.291637,
"type": "lvar"
},
{
"description": "",
"expires": 0,
"full_id": "tests/lvar5",
"group": "tests",
"id": "lvar5",
"oid": "lvar:tests/lvar5",
"set_time": 1604185854.0752258,
"type": "lvar"
}
]
}
Parameters:
k API key with master permissions
Optionally:
g filter by item group
x serialize specified item prop(s)
Returns:
the list of all lvars available
create - alias for create_lvar
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 157
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "create",
"params": {
"i": "tests/lvar5",
"k": "mykey",
"save": "true"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 157" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "create", "params": {"i": "tests/lvar5", "k": "mykey", "save": "true"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 157" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "create", "params": {"i": "tests/lvar5", "k": "mykey", "save": "true"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "create",
"params": {
"i": "tests/lvar5",
"k": "mykey",
"save": "true"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:157 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '157', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'create', 'params': {'i': 'tests/lvar5', 'k': 'mykey', 'save': 'true'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 305
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"expires": 0,
"full_id": "tests/lvar5",
"group": "tests",
"id": "lvar5",
"oid": "lvar:tests/lvar5",
"set_time": 1604185854.0752258,
"status": 1,
"type": "lvar",
"value": ""
}
}
create_lvar - create lvar
Create new lvar
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 162
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "create_lvar",
"params": {
"i": "tests/lvar1",
"k": "mykey",
"save": "true"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 162" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "create_lvar", "params": {"i": "tests/lvar1", "k": "mykey", "save": "true"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 162" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "create_lvar", "params": {"i": "tests/lvar1", "k": "mykey", "save": "true"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "create_lvar",
"params": {
"i": "tests/lvar1",
"k": "mykey",
"save": "true"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:162 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '162', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'create_lvar', 'params': {'i': 'tests/lvar1', 'k': 'mykey', 'save': 'true'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 304
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"expires": 0,
"full_id": "tests/lvar1",
"group": "tests",
"id": "lvar1",
"oid": "lvar:tests/lvar1",
"set_time": 1604185854.015231,
"status": 1,
"type": "lvar",
"value": ""
}
}
Parameters:
k API key with master permissions
i lvar id
Optionally:
g lvar group
save save lvar configuration immediately
destroy - alias for destroy_lvar
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 139
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "destroy",
"params": {
"i": "lvar:tests/lvar5",
"k": "mykey"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 139" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "destroy", "params": {"i": "lvar:tests/lvar5", "k": "mykey"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 139" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "destroy", "params": {"i": "lvar:tests/lvar5", "k": "mykey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "destroy",
"params": {
"i": "lvar:tests/lvar5",
"k": "mykey"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:139 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '139', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'destroy', 'params': {'i': 'lvar:tests/lvar5', 'k': 'mykey'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 79
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"ok": true
}
}
destroy_lvar - delete lvar
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 144
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "destroy_lvar",
"params": {
"i": "lvar:tests/lvar1",
"k": "mykey"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 144" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "destroy_lvar", "params": {"i": "lvar:tests/lvar1", "k": "mykey"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 144" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "destroy_lvar", "params": {"i": "lvar:tests/lvar1", "k": "mykey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "destroy_lvar",
"params": {
"i": "lvar:tests/lvar1",
"k": "mykey"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:144 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '144', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'destroy_lvar', 'params': {'i': 'lvar:tests/lvar1', 'k': 'mykey'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 79
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"ok": true
}
}
Parameters:
k API key with master permissions
i lvar id
get_config - get lvar configuration
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 142
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "get_config",
"params": {
"i": "lvar:tests/lvar1",
"k": "mykey"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 142" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "get_config", "params": {"i": "lvar:tests/lvar1", "k": "mykey"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 142" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "get_config", "params": {"i": "lvar:tests/lvar1", "k": "mykey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "get_config",
"params": {
"i": "lvar:tests/lvar1",
"k": "mykey"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:142 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '142', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'get_config', 'params': {'i': 'lvar:tests/lvar1', 'k': 'mykey'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 290
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"expires": 0,
"full_id": "tests/lvar1",
"group": "tests",
"id": "lvar1",
"notify_events": 2,
"oid": "lvar:tests/lvar1",
"set_time": 1604185854.291637,
"type": "lvar"
}
}
Parameters:
k API key with master permissions
i lvaar id
Returns:
complete lvar configuration.
list_props - list lvar properties
Get all editable parameters of the lvar confiugration.
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 142
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "list_props",
"params": {
"i": "lvar:tests/lvar1",
"k": "mykey"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 142" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "list_props", "params": {"i": "lvar:tests/lvar1", "k": "mykey"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 142" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "list_props", "params": {"i": "lvar:tests/lvar1", "k": "mykey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "list_props",
"params": {
"i": "lvar:tests/lvar1",
"k": "mykey"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:142 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '142', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'list_props', 'params': {'i': 'lvar:tests/lvar1', 'k': 'mykey'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 295
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"description": "",
"expires": 0,
"mqtt_update": null,
"notify_events": 2,
"set_time": 1604185854.291637,
"update_exec": null,
"update_interval": 0,
"update_timeout": null
}
}
Parameters:
k API key with master permissions
i item id
save_config - save lvar configuration
Saves lvar. configuration on disk (even if it hasn’t been changed)
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 143
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "save_config",
"params": {
"i": "lvar:tests/lvar1",
"k": "mykey"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 143" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "save_config", "params": {"i": "lvar:tests/lvar1", "k": "mykey"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 143" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "save_config", "params": {"i": "lvar:tests/lvar1", "k": "mykey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "save_config",
"params": {
"i": "lvar:tests/lvar1",
"k": "mykey"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:143 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '143', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'save_config', 'params': {'i': 'lvar:tests/lvar1', 'k': 'mykey'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 79
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"ok": true
}
}
Parameters:
k API key with master permissions
i lvar id
set_prop - set lvar property
Set configuration parameters of the lvar.
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 181
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "set_prop",
"params": {
"i": "lvar:tests/lvar1",
"k": "mykey",
"p": "expires",
"v": 15
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 181" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "set_prop", "params": {"i": "lvar:tests/lvar1", "k": "mykey", "p": "expires", "v": 15}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 181" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "set_prop", "params": {"i": "lvar:tests/lvar1", "k": "mykey", "p": "expires", "v": 15}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "set_prop",
"params": {
"i": "lvar:tests/lvar1",
"k": "mykey",
"p": "expires",
"v": 15
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:181 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '181', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'set_prop', 'params': {'i': 'lvar:tests/lvar1', 'k': 'mykey', 'p': 'expires', 'v': 15}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 79
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"ok": true
}
}
Parameters:
k API key with master permissions
i item id
p property name (or empty for batch set)
Optionally:
v propery value (or dict for batch set)
save save configuration after successful call
Decision matrix rules
create_rule - create new rule
Creates new decision rule. Rule id (UUID) is generated automatically unless specified.
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 110
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "create_rule",
"params": {
"k": "mykey"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 110" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "create_rule", "params": {"k": "mykey"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 110" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "create_rule", "params": {"k": "mykey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "create_rule",
"params": {
"k": "mykey"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:110 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '110', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'create_rule', 'params': {'k': 'mykey'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 812
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"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": "7117bf3f-aa34-45f3-9ec0-c1ef459aea1b",
"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/7117bf3f-aa34-45f3-9ec0-c1ef459aea1b",
"priority": 100,
"type": "dmatrix_rule"
}
}
Parameters:
k API key with master permissions
Optionally:
u rule UUID to set
v rule properties (dict) or human-readable input
e enable rule after creation
save save rule configuration immediately
destroy_rule - delete rule
Deletes decision rule.
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 164
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "destroy_rule",
"params": {
"i": "4c6e8c99-56fe-490c-8442-4936ba777498",
"k": "mykey"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 164" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "destroy_rule", "params": {"i": "4c6e8c99-56fe-490c-8442-4936ba777498", "k": "mykey"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 164" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "destroy_rule", "params": {"i": "4c6e8c99-56fe-490c-8442-4936ba777498", "k": "mykey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "destroy_rule",
"params": {
"i": "4c6e8c99-56fe-490c-8442-4936ba777498",
"k": "mykey"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:164 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '164', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'destroy_rule', 'params': {'i': '4c6e8c99-56fe-490c-8442-4936ba777498', 'k': 'mykey'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 79
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"ok": true
}
}
Parameters:
k API key with master permissions
i rule id
get_rule - get rule information
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 160
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "get_rule",
"params": {
"i": "4c6e8c99-56fe-490c-8442-4936ba777498",
"k": "mykey"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 160" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "get_rule", "params": {"i": "4c6e8c99-56fe-490c-8442-4936ba777498", "k": "mykey"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 160" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "get_rule", "params": {"i": "4c6e8c99-56fe-490c-8442-4936ba777498", "k": "mykey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "get_rule",
"params": {
"i": "4c6e8c99-56fe-490c-8442-4936ba777498",
"k": "mykey"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:160 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '160', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'get_rule', 'params': {'i': '4c6e8c99-56fe-490c-8442-4936ba777498', 'k': 'mykey'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 810
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"break_after_exec": false,
"chillout_ends_in": 0,
"chillout_time": 0,
"condition": "",
"description": "",
"enabled": false,
"for_initial": null,
"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:
k valid API key
i rule id
list_rule_props - list rule properties
Get all editable parameters of the decision rule.
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 167
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "list_rule_props",
"params": {
"i": "4c6e8c99-56fe-490c-8442-4936ba777498",
"k": "mykey"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 167" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "list_rule_props", "params": {"i": "4c6e8c99-56fe-490c-8442-4936ba777498", "k": "mykey"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 167" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "list_rule_props", "params": {"i": "4c6e8c99-56fe-490c-8442-4936ba777498", "k": "mykey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "list_rule_props",
"params": {
"i": "4c6e8c99-56fe-490c-8442-4936ba777498",
"k": "mykey"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:167 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '167', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'list_rule_props', 'params': {'i': '4c6e8c99-56fe-490c-8442-4936ba777498', 'k': 'mykey'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 616
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"break_after_exec": false,
"chillout_time": 0,
"condition": "",
"description": "",
"enabled": false,
"for_initial": null,
"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:
k valid API key
i rule id
list_rules - get rules list
Get the list of all available decision rules.
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 109
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "list_rules",
"params": {
"k": "mykey"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 109" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "list_rules", "params": {"k": "mykey"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 109" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "list_rules", "params": {"k": "mykey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "list_rules",
"params": {
"k": "mykey"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:109 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '109', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'list_rules', 'params': {'k': 'mykey'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 3517
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": [
{
"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": "a198960a-d94e-4be1-9f1e-092c140eaa1a",
"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/a198960a-d94e-4be1-9f1e-092c140eaa1a",
"priority": 100,
"type": "dmatrix_rule"
},
{
"break_after_exec": false,
"chillout_ends_in": 0,
"chillout_time": 0,
"condition": "",
"description": "",
"enabled": false,
"for_initial": null,
"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": "9c0ce971-b19f-4b4a-9586-3c4898ca46d8",
"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/9c0ce971-b19f-4b4a-9586-3c4898ca46d8",
"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": "7117bf3f-aa34-45f3-9ec0-c1ef459aea1b",
"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/7117bf3f-aa34-45f3-9ec0-c1ef459aea1b",
"priority": 100,
"type": "dmatrix_rule"
}
]
}
Parameters:
k valid API key
set_rule_prop - set rule parameters
Set configuration parameters of the decision rule.
Note
Master key is required for batch set.
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 237
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "set_rule_prop",
"params": {
"i": "4c6e8c99-56fe-490c-8442-4936ba777498",
"k": "mykey",
"p": "for_initial",
"save": "true",
"v": "any"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 237" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "set_rule_prop", "params": {"i": "4c6e8c99-56fe-490c-8442-4936ba777498", "k": "mykey", "p": "for_initial", "save": "true", "v": "any"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 237" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "set_rule_prop", "params": {"i": "4c6e8c99-56fe-490c-8442-4936ba777498", "k": "mykey", "p": "for_initial", "save": "true", "v": "any"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "set_rule_prop",
"params": {
"i": "4c6e8c99-56fe-490c-8442-4936ba777498",
"k": "mykey",
"p": "for_initial",
"save": "true",
"v": "any"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:237 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '237', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'set_rule_prop', 'params': {'i': '4c6e8c99-56fe-490c-8442-4936ba777498', 'k': 'mykey', 'p': 'for_initial', 'save': 'true', 'v': 'any'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 79
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"ok": true
}
}
Parameters:
k valid API key
i rule id
p property name (or empty for batch set)
Optionally:
v propery value (or dict for batch set)
save save configuration after successful call
Logic cycles
create_cycle - create new cycle
Creates new cycle.
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 144
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "create_cycle",
"params": {
"i": "tests/test_cycle",
"k": "mykey"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 144" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "create_cycle", "params": {"i": "tests/test_cycle", "k": "mykey"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 144" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "create_cycle", "params": {"i": "tests/test_cycle", "k": "mykey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "create_cycle",
"params": {
"i": "tests/test_cycle",
"k": "mykey"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:144 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '144', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'create_cycle', 'params': {'i': 'tests/test_cycle', 'k': 'mykey'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 439
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"description": "",
"full_id": "tests/test_cycle",
"group": "tests",
"ict": 100,
"id": "test_cycle",
"interval": 1,
"iterations": 0,
"macro": null,
"macro_args": [],
"macro_kwargs": {},
"oid": "lcycle:tests/test_cycle",
"on_error": null,
"status": 0,
"type": "lcycle"
}
}
Parameters:
k API key with master permissions
i cycle id
Optionally:
g cycle group
v cycle properties (dict) or human-readable input
destroy_cycle - delete cycle
Deletes cycle. If cycle is running, it is stopped before deletion.
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 145
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "destroy_cycle",
"params": {
"i": "tests/test_cycle",
"k": "mykey"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 145" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "destroy_cycle", "params": {"i": "tests/test_cycle", "k": "mykey"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 145" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "destroy_cycle", "params": {"i": "tests/test_cycle", "k": "mykey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "destroy_cycle",
"params": {
"i": "tests/test_cycle",
"k": "mykey"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:145 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '145', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'destroy_cycle', 'params': {'i': 'tests/test_cycle', 'k': 'mykey'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 79
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"ok": true
}
}
Parameters:
k API key with master permissions
i cycle id
get_cycle - get cycle information
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 141
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "get_cycle",
"params": {
"i": "tests/test_cycle",
"k": "mykey"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 141" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "get_cycle", "params": {"i": "tests/test_cycle", "k": "mykey"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 141" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "get_cycle", "params": {"i": "tests/test_cycle", "k": "mykey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "get_cycle",
"params": {
"i": "tests/test_cycle",
"k": "mykey"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:141 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '141', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'get_cycle', 'params': {'i': 'tests/test_cycle', 'k': 'mykey'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 453
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"description": "",
"full_id": "tests/test_cycle",
"group": "tests",
"ict": 100,
"id": "test_cycle",
"interval": 1,
"iterations": 0,
"macro": "tests/test_macro",
"macro_args": [],
"macro_kwargs": {},
"oid": "lcycle:tests/test_cycle",
"on_error": null,
"status": 0,
"type": "lcycle"
}
}
Parameters:
k valid API key
i cycle id
Returns:
field “value” contains real average cycle interval
groups_cycle - get cycle groups list
Get the list of cycles. Useful e.g. for custom interfaces.
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 111
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "groups_cycle",
"params": {
"k": "mykey"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 111" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "groups_cycle", "params": {"k": "mykey"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 111" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "groups_cycle", "params": {"k": "mykey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "groups_cycle",
"params": {
"k": "mykey"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:111 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '111', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'groups_cycle', 'params': {'k': 'mykey'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 76
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": [
"tests"
]
}
Parameters:
k valid API key
list_cycle_props - get cycle configuration properties
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 148
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "list_cycle_props",
"params": {
"i": "tests/test_cycle",
"k": "mykey"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 148" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "list_cycle_props", "params": {"i": "tests/test_cycle", "k": "mykey"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 148" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "list_cycle_props", "params": {"i": "tests/test_cycle", "k": "mykey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "list_cycle_props",
"params": {
"i": "tests/test_cycle",
"k": "mykey"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:148 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '148', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'list_cycle_props', 'params': {'i': 'tests/test_cycle', 'k': 'mykey'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 302
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"autostart": false,
"description": "",
"ict": 100,
"interval": 1,
"macro": "tests/test_macro",
"macro_args": [],
"macro_kwargs": {},
"notify_events": 2,
"on_error": null
}
}
Parameters:
k API key with master permissions
i cycle id
list_cycles - get cycle list
Get the list of all available cycles.
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 110
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "list_cycles",
"params": {
"k": "mykey"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 110" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "list_cycles", "params": {"k": "mykey"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 110" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "list_cycles", "params": {"k": "mykey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "list_cycles",
"params": {
"k": "mykey"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:110 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '110', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'list_cycles', 'params': {'k': 'mykey'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 973
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": [
{
"description": "",
"full_id": "tests/cycle1",
"group": "tests",
"ict": 100,
"id": "cycle1",
"interval": 1,
"iterations": 0,
"macro": null,
"macro_args": [],
"macro_kwargs": {},
"oid": "lcycle:tests/cycle1",
"on_error": null,
"status": 0,
"type": "lcycle"
},
{
"description": "",
"full_id": "tests/test_cycle",
"group": "tests",
"ict": 100,
"id": "test_cycle",
"interval": 1,
"iterations": 0,
"macro": "tests/test_macro",
"macro_args": [],
"macro_kwargs": {},
"oid": "lcycle:tests/test_cycle",
"on_error": null,
"status": 0,
"type": "lcycle"
}
]
}
Parameters:
k valid API key
Optionally:
g filter by group
reset_cycle_stats - reset cycle statistic
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 149
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "reset_cycle_stats",
"params": {
"i": "tests/test_cycle",
"k": "mykey"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 149" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "reset_cycle_stats", "params": {"i": "tests/test_cycle", "k": "mykey"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 149" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "reset_cycle_stats", "params": {"i": "tests/test_cycle", "k": "mykey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "reset_cycle_stats",
"params": {
"i": "tests/test_cycle",
"k": "mykey"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:149 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '149', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'reset_cycle_stats', 'params': {'i': 'tests/test_cycle', 'k': 'mykey'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 79
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"ok": true
}
}
Parameters:
k valid API key
i cycle id
set_cycle_prop - set cycle property
Set configuration parameters of the cycle.
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 225
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "set_cycle_prop",
"params": {
"i": "tests/test_cycle",
"k": "mykey",
"p": "macro",
"save": "true",
"v": "tests/test_macro"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 225" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "set_cycle_prop", "params": {"i": "tests/test_cycle", "k": "mykey", "p": "macro", "save": "true", "v": "tests/test_macro"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 225" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "set_cycle_prop", "params": {"i": "tests/test_cycle", "k": "mykey", "p": "macro", "save": "true", "v": "tests/test_macro"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "set_cycle_prop",
"params": {
"i": "tests/test_cycle",
"k": "mykey",
"p": "macro",
"save": "true",
"v": "tests/test_macro"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:225 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '225', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'set_cycle_prop', 'params': {'i': 'tests/test_cycle', 'k': 'mykey', 'p': 'macro', 'save': 'true', 'v': 'tests/test_macro'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 79
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"ok": true
}
}
Parameters:
k API key with master permissions
i item id
p property name (or empty for batch set)
Optionally:
v propery value (or dict for batch set)
save save configuration after successful call
start_cycle - start cycle
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 143
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "start_cycle",
"params": {
"i": "tests/test_cycle",
"k": "mykey"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 143" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "start_cycle", "params": {"i": "tests/test_cycle", "k": "mykey"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 143" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "start_cycle", "params": {"i": "tests/test_cycle", "k": "mykey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "start_cycle",
"params": {
"i": "tests/test_cycle",
"k": "mykey"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:143 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '143', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'start_cycle', 'params': {'i': 'tests/test_cycle', 'k': 'mykey'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 79
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"ok": true
}
}
Parameters:
k valid API key
i cycle id
stop_cycle - stop cycle
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 142
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "stop_cycle",
"params": {
"i": "tests/test_cycle",
"k": "mykey"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 142" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "stop_cycle", "params": {"i": "tests/test_cycle", "k": "mykey"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 142" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "stop_cycle", "params": {"i": "tests/test_cycle", "k": "mykey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "stop_cycle",
"params": {
"i": "tests/test_cycle",
"k": "mykey"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:142 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '142', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'stop_cycle', 'params': {'i': 'tests/test_cycle', 'k': 'mykey'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 79
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"ok": true
}
}
Parameters:
k valid API key
i cycle id
Optionally:
wait wait until cycle is stopped
Logic macros
create_macro - create new macro
Creates new macro. Macro code should be put in xc/lm manually.
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 144
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "create_macro",
"params": {
"i": "tests/test_macro",
"k": "mykey"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 144" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "create_macro", "params": {"i": "tests/test_macro", "k": "mykey"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 144" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "create_macro", "params": {"i": "tests/test_macro", "k": "mykey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "create_macro",
"params": {
"i": "tests/test_macro",
"k": "mykey"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:144 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '144', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'create_macro', 'params': {'i': 'tests/test_macro', 'k': 'mykey'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 252
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"action_enabled": true,
"full_id": "tests/test_macro",
"group": "tests",
"id": "test_macro",
"oid": "lmacro:tests/test_macro",
"type": "lmacro"
}
}
Parameters:
k API key with master permissions
i macro id
Optionally:
g macro group
destroy_macro - delete macro
Deletes macro.
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 145
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "destroy_macro",
"params": {
"i": "tests/test_macro",
"k": "mykey"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 145" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "destroy_macro", "params": {"i": "tests/test_macro", "k": "mykey"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 145" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "destroy_macro", "params": {"i": "tests/test_macro", "k": "mykey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "destroy_macro",
"params": {
"i": "tests/test_macro",
"k": "mykey"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:145 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '145', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'destroy_macro', 'params': {'i': 'tests/test_macro', 'k': 'mykey'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 79
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"ok": true
}
}
Parameters:
k API key with master permissions
i macro id
get_macro - get macro information
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 141
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "get_macro",
"params": {
"i": "tests/test_macro",
"k": "mykey"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 141" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "get_macro", "params": {"i": "tests/test_macro", "k": "mykey"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 141" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "get_macro", "params": {"i": "tests/test_macro", "k": "mykey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "get_macro",
"params": {
"i": "tests/test_macro",
"k": "mykey"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:141 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '141', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'get_macro', 'params': {'i': 'tests/test_macro', 'k': 'mykey'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 317
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"action_enabled": true,
"description": "",
"full_id": "tests/test_macro",
"group": "tests",
"id": "test_macro",
"oid": "lmacro:tests/test_macro",
"src": "out='test passed'\n",
"type": "lmacro"
}
}
Parameters:
k valid API key
i macro id
groups_macro - get macro groups list
Get the list of macros. Useful e.g. for custom interfaces.
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 111
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "groups_macro",
"params": {
"k": "mykey"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 111" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "groups_macro", "params": {"k": "mykey"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 111" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "groups_macro", "params": {"k": "mykey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "groups_macro",
"params": {
"k": "mykey"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:111 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '111', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'groups_macro', 'params': {'k': 'mykey'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 76
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": [
"tests"
]
}
Parameters:
k valid API key
list_macro_props - get macro configuration properties
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 148
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "list_macro_props",
"params": {
"i": "tests/test_macro",
"k": "mykey"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 148" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "list_macro_props", "params": {"i": "tests/test_macro", "k": "mykey"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 148" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "list_macro_props", "params": {"i": "tests/test_macro", "k": "mykey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "list_macro_props",
"params": {
"i": "tests/test_macro",
"k": "mykey"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:148 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '148', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'list_macro_props', 'params': {'i': 'tests/test_macro', 'k': 'mykey'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 256
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"action_enabled": true,
"action_exec": null,
"description": "",
"notify_events": 2,
"pass_errors": false,
"send_critical": false,
"src": ""
}
}
Parameters:
k API key with master permissions
i macro id
list_macros - get macro list
Get the list of all available macros.
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 110
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "list_macros",
"params": {
"k": "mykey"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 110" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "list_macros", "params": {"k": "mykey"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 110" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "list_macros", "params": {"k": "mykey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "list_macros",
"params": {
"k": "mykey"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:110 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '110', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'list_macros', 'params': {'k': 'mykey'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 580
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": [
{
"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/test_macro",
"group": "tests",
"id": "test_macro",
"oid": "lmacro:tests/test_macro",
"type": "lmacro"
}
]
}
Parameters:
k valid API key
Optionally:
g filter by group
result - macro execution result
Get macro execution results either by action uuid or by macro id.
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 138
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "result",
"params": {
"i": "tests/test_macro",
"k": "mykey"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 138" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "result", "params": {"i": "tests/test_macro", "k": "mykey"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 138" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "result", "params": {"i": "tests/test_macro", "k": "mykey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "result",
"params": {
"i": "tests/test_macro",
"k": "mykey"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:138 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '138', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'result', 'params': {'i': 'tests/test_macro', 'k': 'mykey'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 55
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": []
}
Parameters:
k valid API key
Optionally:
u action uuid or
i macro id
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
run - execute macro
Execute a macro with the specified arguments.
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 135
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "run",
"params": {
"i": "tests/test_macro",
"k": "mykey"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 135" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "run", "params": {"i": "tests/test_macro", "k": "mykey"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 135" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "run", "params": {"i": "tests/test_macro", "k": "mykey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "run",
"params": {
"i": "tests/test_macro",
"k": "mykey"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:135 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '135', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'run', 'params': {'i': 'tests/test_macro', 'k': 'mykey'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 628
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"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": "queued",
"time": {
"created": 1604185854.8309932,
"pending": 1604185854.8320856,
"queued": 1604185854.8345957
},
"uuid": "117b6422-f9a1-47be-9158-a4f34d9f5202"
}
}
Parameters:
k valid API key
i macro id
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
u action UUID (will be auto generated if none specified)
p queue priority (default is 100, lower is better)
q global queue timeout, if expires, action is marked as “dead”
set_macro_prop - set macro configuration property
Set configuration parameters of the macro.
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 219
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "set_macro_prop",
"params": {
"i": "tests/test_macro",
"k": "mykey",
"p": "pass_errors",
"save": "true",
"v": "true"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 219" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "set_macro_prop", "params": {"i": "tests/test_macro", "k": "mykey", "p": "pass_errors", "save": "true", "v": "true"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 219" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "set_macro_prop", "params": {"i": "tests/test_macro", "k": "mykey", "p": "pass_errors", "save": "true", "v": "true"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "set_macro_prop",
"params": {
"i": "tests/test_macro",
"k": "mykey",
"p": "pass_errors",
"save": "true",
"v": "true"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:219 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '219', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'set_macro_prop', 'params': {'i': 'tests/test_macro', 'k': 'mykey', 'p': 'pass_errors', 'save': 'true', 'v': 'true'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 79
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"ok": true
}
}
Parameters:
k API key with master permissions
i item id
p property name (or empty for batch set)
Optionally:
v propery value (or dict for batch set)
save save configuration after successful call
Macro extensions
get_ext - get loaded extension information
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 129
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "get_ext",
"params": {
"i": "test_a",
"k": "mykey"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 129" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "get_ext", "params": {"i": "test_a", "k": "mykey"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 129" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "get_ext", "params": {"i": "test_a", "k": "mykey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "get_ext",
"params": {
"i": "test_a",
"k": "mykey"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:129 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '129', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'get_ext', 'params': {'i': 'test_a', 'k': 'mykey'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 824
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"api": 7,
"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\nIf external playback command is not specified, \"sounddevice\" and \"soundfile\"\npython modules must be present in system.\n\nParams for external command: %f - file, %g - gain, e.g. \"play %f gain %g\", if\nno %f is specified, file name is automatically added to the end.\n",
"id": "test_a",
"license": "Apache License 2.0",
"mod": "audio",
"mods_required": [],
"version": "1.3.0"
}
}
Parameters:
k API key with master permissions
i extension ID
list_ext - get list of available macro extensions
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 107
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "list_ext",
"params": {
"k": "mykey"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 107" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "list_ext", "params": {"k": "mykey"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 107" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "list_ext", "params": {"k": "mykey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "list_ext",
"params": {
"k": "mykey"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:107 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '107', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'list_ext', 'params': {'k': 'mykey'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 135
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": [
{
"id": "test_a",
"mod": "audio"
}
]
}
Parameters:
k API key with master permissions
Optionally:
full get full information
list_ext_mods - get list of available extension modules
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 112
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "list_ext_mods",
"params": {
"k": "mykey"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 112" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "list_ext_mods", "params": {"k": "mykey"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 112" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "list_ext_mods", "params": {"k": "mykey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "list_ext_mods",
"params": {
"k": "mykey"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:112 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '112', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'list_ext_mods', 'params': {'k': 'mykey'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 3342
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": [
{
"api": 7,
"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\nIf external playback command is not specified, \"sounddevice\" and \"soundfile\"\npython modules must be present in system.\n\nParams for external command: %f - file, %g - gain, e.g. \"play %f gain %g\", if\nno %f is specified, file name is automatically added to the end.\n",
"id": null,
"license": "Apache License 2.0",
"mod": "audio",
"mods_required": [],
"version": "1.3.0"
},
{
"api": 7,
"author": "Altertech Group, https://www.altertech.com/",
"description": "Generic macro extension, don't use",
"help": "\nThis is generic extension for using as a base for all other LM PLC macro\nextensions. For a list of the available functions look directly into\nthe extension code or to EVA ICS documentation.\n",
"id": null,
"license": "Apache License 2.0",
"mod": "generic",
"mods_required": [],
"version": "3.3.2"
},
{
"api": 7,
"author": "Altertech Group, https://www.altertech.com/",
"description": "Autotest",
"help": "\nTest ext\n",
"id": null,
"license": "Apache License 2.0",
"mod": "myext",
"mods_required": [],
"version": "1.0.1"
},
{
"api": 7,
"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.4.0"
},
{
"api": 7,
"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.3.0"
},
{
"api": 7,
"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\nParams for external command: %f - file, if no %f is specified, file name is\nautomatically added to the end.\n",
"id": null,
"license": "Apache License 2.0",
"mod": "tts",
"mods_required": [
"ttsbroker"
],
"version": "1.3.0"
}
]
}
Parameters:
k API key with master permissions
load_ext - load extension module
Loads:doc:macro extension<../lm/ext>.
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 211
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "load_ext",
"params": {
"c": "sdir=/opt/data/snd",
"i": "test_a",
"k": "mykey",
"m": "audio",
"save": "true"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 211" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "load_ext", "params": {"c": "sdir=/opt/data/snd", "i": "test_a", "k": "mykey", "m": "audio", "save": "true"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 211" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "load_ext", "params": {"c": "sdir=/opt/data/snd", "i": "test_a", "k": "mykey", "m": "audio", "save": "true"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "load_ext",
"params": {
"c": "sdir=/opt/data/snd",
"i": "test_a",
"k": "mykey",
"m": "audio",
"save": "true"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:211 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '211', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'load_ext', 'params': {'c': 'sdir=/opt/data/snd', 'i': 'test_a', 'k': 'mykey', 'm': 'audio', 'save': 'true'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 824
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"api": 7,
"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\nIf external playback command is not specified, \"sounddevice\" and \"soundfile\"\npython modules must be present in system.\n\nParams for external command: %f - file, %g - gain, e.g. \"play %f gain %g\", if\nno %f is specified, file name is automatically added to the end.\n",
"id": "test_a",
"license": "Apache License 2.0",
"mod": "audio",
"mods_required": [],
"version": "1.3.0"
}
}
Parameters:
k API key with master permissions
i extension ID
m extension module
Optionally:
c extension configuration
save save extension configuration after successful call
modhelp_ext - get extension usage help
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 158
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "modhelp_ext",
"params": {
"c": "functions",
"k": "mykey",
"m": "audio"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 158" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "modhelp_ext", "params": {"c": "functions", "k": "mykey", "m": "audio"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 158" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "modhelp_ext", "params": {"c": "functions", "k": "mykey", "m": "audio"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "modhelp_ext",
"params": {
"c": "functions",
"k": "mykey",
"m": "audio"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:158 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '158', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'modhelp_ext', 'params': {'c': 'functions', 'k': 'mykey', 'm': 'audio'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 124
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"play(soundfile, gain=0, wait=True)": "Play audio file"
}
}
Parameters:
k API key with master permissions
m extension name (without .py extension)
c help context (cfg or functions)
modinfo_ext - get extension module info
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 132
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "modinfo_ext",
"params": {
"k": "mykey",
"m": "audio"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 132" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "modinfo_ext", "params": {"k": "mykey", "m": "audio"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 132" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "modinfo_ext", "params": {"k": "mykey", "m": "audio"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "modinfo_ext",
"params": {
"k": "mykey",
"m": "audio"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:132 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '132', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'modinfo_ext', 'params': {'k': 'mykey', 'm': 'audio'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 736
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"api": 7,
"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\nIf external playback command is not specified, \"sounddevice\" and \"soundfile\"\npython modules must be present in system.\n\nParams for external command: %f - file, %g - gain, e.g. \"play %f gain %g\", if\nno %f is specified, file name is automatically added to the end.\n",
"license": "Apache License 2.0",
"mod": "audio",
"mods_required": [],
"version": "1.3.0"
}
}
Parameters:
k API key with master permissions
m extension module name (without .py extension)
set_ext_prop - set extension configuration property
appends property to extension configuration and reloads module
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 192
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "set_ext_prop",
"params": {
"i": "test_a",
"k": "mykey",
"p": "d",
"save": "true",
"v": 2
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 192" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "set_ext_prop", "params": {"i": "test_a", "k": "mykey", "p": "d", "save": "true", "v": 2}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 192" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "set_ext_prop", "params": {"i": "test_a", "k": "mykey", "p": "d", "save": "true", "v": 2}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "set_ext_prop",
"params": {
"i": "test_a",
"k": "mykey",
"p": "d",
"save": "true",
"v": 2
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:192 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '192', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'set_ext_prop', 'params': {'i': 'test_a', 'k': 'mykey', 'p': 'd', 'save': 'true', 'v': 2}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 79
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"ok": true
}
}
Parameters:
k API key with master permissions
i extension id
p property name (or empty for batch set)
Optionally:
v propery value (or dict for batch set)
save save configuration after successful call
unload_ext - unload macro extension
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 132
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "unload_ext",
"params": {
"i": "test_a",
"k": "mykey"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 132" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "unload_ext", "params": {"i": "test_a", "k": "mykey"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 132" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "unload_ext", "params": {"i": "test_a", "k": "mykey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "unload_ext",
"params": {
"i": "test_a",
"k": "mykey"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:132 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '132', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'unload_ext', 'params': {'i': 'test_a', 'k': 'mykey'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 79
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"ok": true
}
}
Parameters:
k API key with master permissions
i extension ID
Remote controllers
append_controller - connect remote UC via HTTP
Connects remote UC controller to the local.
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 192
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "append_controller",
"params": {
"a": "secretkey",
"k": "mykey",
"save": "true",
"u": "localhost"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 192" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "append_controller", "params": {"a": "secretkey", "k": "mykey", "save": "true", "u": "localhost"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 192" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "append_controller", "params": {"a": "secretkey", "k": "mykey", "save": "true", "u": "localhost"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "append_controller",
"params": {
"a": "secretkey",
"k": "mykey",
"save": "true",
"u": "localhost"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:192 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '192', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'append_controller', 'params': {'a': 'secretkey', 'k': 'mykey', 'save': 'true', 'u': 'localhost'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 624
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"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:
k 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_controller - disable connected controller
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 167
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "disable_controller",
"params": {
"i": "uc/ws1-v1",
"k": "mykey",
"save": "true"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 167" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "disable_controller", "params": {"i": "uc/ws1-v1", "k": "mykey", "save": "true"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 167" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "disable_controller", "params": {"i": "uc/ws1-v1", "k": "mykey", "save": "true"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "disable_controller",
"params": {
"i": "uc/ws1-v1",
"k": "mykey",
"save": "true"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:167 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '167', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'disable_controller', 'params': {'i': 'uc/ws1-v1', 'k': 'mykey', 'save': 'true'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 79
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"ok": true
}
}
Parameters:
k API key with master permissions
i controller id
Optionally:
save save configuration after successful call
enable_controller - enable connected controller
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 166
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "enable_controller",
"params": {
"i": "uc/ws1-v1",
"k": "mykey",
"save": "true"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 166" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "enable_controller", "params": {"i": "uc/ws1-v1", "k": "mykey", "save": "true"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 166" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "enable_controller", "params": {"i": "uc/ws1-v1", "k": "mykey", "save": "true"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "enable_controller",
"params": {
"i": "uc/ws1-v1",
"k": "mykey",
"save": "true"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:166 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '166', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'enable_controller', 'params': {'i': 'uc/ws1-v1', 'k': 'mykey', 'save': 'true'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 79
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"ok": true
}
}
Parameters:
k API key with master permissions
i controller id
Optionally:
save save configuration after successful call
get_controller - get connected controller information
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 139
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "get_controller",
"params": {
"i": "uc/ws1-v1",
"k": "mykey"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 139" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "get_controller", "params": {"i": "uc/ws1-v1", "k": "mykey"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 139" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "get_controller", "params": {"i": "uc/ws1-v1", "k": "mykey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "get_controller",
"params": {
"i": "uc/ws1-v1",
"k": "mykey"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:139 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '139', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'get_controller', 'params': {'i': 'uc/ws1-v1', 'k': 'mykey'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 512
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"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:
k API key with master permissions
i controller id
list_controller_props - get controller connection parameters
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 146
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "list_controller_props",
"params": {
"i": "uc/ws1-v1",
"k": "mykey"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 146" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "list_controller_props", "params": {"i": "uc/ws1-v1", "k": "mykey"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 146" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "list_controller_props", "params": {"i": "uc/ws1-v1", "k": "mykey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "list_controller_props",
"params": {
"i": "uc/ws1-v1",
"k": "mykey"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:146 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '146', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'list_controller_props', 'params': {'i': 'uc/ws1-v1', 'k': 'mykey'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 431
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"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:
k API key with master permissions
i controller id
list_controllers - get controllers list
Get the list of all connected UC controllers.
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 115
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "list_controllers",
"params": {
"k": "mykey"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 115" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "list_controllers", "params": {"k": "mykey"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 115" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "list_controllers", "params": {"k": "mykey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "list_controllers",
"params": {
"k": "mykey"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:115 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '115', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'list_controllers', 'params': {'k': 'mykey'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 529
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": [
{
"build": "2020103101",
"connected": true,
"description": "",
"enabled": true,
"full_id": "uc/lab-ws2",
"group": "uc",
"id": "lab-ws2",
"managed": false,
"mqtt_update": "eva_1",
"oid": "remote_uc:uc/lab-ws2",
"proto": "mqtt",
"static": true,
"type": "remote_uc",
"version": "3.3.2"
}
]
}
Parameters:
k API key with master permissions
list_remote - 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
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 136
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "list_remote",
"params": {
"i": "uc/ws1-v1",
"k": "mykey"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 136" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "list_remote", "params": {"i": "uc/ws1-v1", "k": "mykey"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 136" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "list_remote", "params": {"i": "uc/ws1-v1", "k": "mykey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "list_remote",
"params": {
"i": "uc/ws1-v1",
"k": "mykey"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:136 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '136', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'list_remote', 'params': {'i': 'uc/ws1-v1', 'k': 'mykey'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 1628
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result":
[
{
"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:
k API key with master permissions
Optionally:
i controller id
g filter by item group
p filter by item type
reload_controller - reload controller
Reloads items from connected UC
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 142
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "reload_controller",
"params": {
"i": "uc/ws1-v1",
"k": "mykey"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 142" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "reload_controller", "params": {"i": "uc/ws1-v1", "k": "mykey"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 142" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "reload_controller", "params": {"i": "uc/ws1-v1", "k": "mykey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "reload_controller",
"params": {
"i": "uc/ws1-v1",
"k": "mykey"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:142 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '142', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'reload_controller', 'params': {'i': 'uc/ws1-v1', 'k': 'mykey'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 79
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"ok": true
}
}
Parameters:
k API key with master permissions
i controller id
remove_controller - disconnect controller
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 142
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "remove_controller",
"params": {
"i": "uc/ws1-v1",
"k": "mykey"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 142" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "remove_controller", "params": {"i": "uc/ws1-v1", "k": "mykey"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 142" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "remove_controller", "params": {"i": "uc/ws1-v1", "k": "mykey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "remove_controller",
"params": {
"i": "uc/ws1-v1",
"k": "mykey"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:142 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '142', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'remove_controller', 'params': {'i': 'uc/ws1-v1', 'k': 'mykey'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 79
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"ok": true
}
}
Parameters:
k API key with master permissions
i controller id
set_controller_prop - set controller connection parameters
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 217
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "set_controller_prop",
"params": {
"i": "uc/ws1-v1",
"k": "mykey",
"p": "reload_interval",
"save": "true",
"v": 60
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 217" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "set_controller_prop", "params": {"i": "uc/ws1-v1", "k": "mykey", "p": "reload_interval", "save": "true", "v": 60}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 217" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "set_controller_prop", "params": {"i": "uc/ws1-v1", "k": "mykey", "p": "reload_interval", "save": "true", "v": 60}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "set_controller_prop",
"params": {
"i": "uc/ws1-v1",
"k": "mykey",
"p": "reload_interval",
"save": "true",
"v": 60
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:217 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '217', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'set_controller_prop', 'params': {'i': 'uc/ws1-v1', 'k': 'mykey', 'p': 'reload_interval', 'save': 'true', 'v': 60}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 79
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"ok": true
}
}
Parameters:
k API key with master permissions
i controller id
p property name (or empty for batch set)
Optionally:
v propery value (or dict for batch set)
save save configuration after successful call
test_controller - test connection to remote controller
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 140
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "test_controller",
"params": {
"i": "uc/ws1-v1",
"k": "mykey"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 140" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "test_controller", "params": {"i": "uc/ws1-v1", "k": "mykey"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 140" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "test_controller", "params": {"i": "uc/ws1-v1", "k": "mykey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "test_controller",
"params": {
"i": "uc/ws1-v1",
"k": "mykey"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:140 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '140', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'test_controller', 'params': {'i': 'uc/ws1-v1', 'k': 'mykey'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 79
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"ok": true
}
}
Parameters:
k API key with master permissions
i controller id
upnp_rescan_controllers - rescan controllers via UPnP
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 122
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "upnp_rescan_controllers",
"params": {
"k": "mykey"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 122" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "upnp_rescan_controllers", "params": {"k": "mykey"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 122" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "upnp_rescan_controllers", "params": {"k": "mykey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "upnp_rescan_controllers",
"params": {
"k": "mykey"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:122 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '122', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'upnp_rescan_controllers', 'params': {'k': 'mykey'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 79
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"ok": true
}
}
Parameters:
k API key with master permissions
Scheduled jobs
create_job - create new job
Creates new scheduled job. Job id (UUID) is generated automatically unless specified.
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 109
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "create_job",
"params": {
"k": "mykey"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 109" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "create_job", "params": {"k": "mykey"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 109" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "create_job", "params": {"k": "mykey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "create_job",
"params": {
"k": "mykey"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:109 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '109', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'create_job', 'params': {'k': 'mykey'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 373
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"description": "",
"enabled": false,
"every": "",
"id": "b09cc59d-4be0-4797-b98d-f43b0bcef355",
"last": null,
"macro": null,
"macro_args": [],
"macro_kwargs": {},
"oid": "job:jobs/b09cc59d-4be0-4797-b98d-f43b0bcef355",
"type": "job"
}
}
Parameters:
k API key with master permissions
Optionally:
u job UUID to set
v job properties (dict) or human-readable input
e enable job after creation
save save job configuration immediately
destroy_job - delete job
Deletes scheduled job.
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 163
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "destroy_job",
"params": {
"i": "9c6e8c99-56fe-490c-8442-4936ba777499",
"k": "mykey"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 163" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "destroy_job", "params": {"i": "9c6e8c99-56fe-490c-8442-4936ba777499", "k": "mykey"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 163" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "destroy_job", "params": {"i": "9c6e8c99-56fe-490c-8442-4936ba777499", "k": "mykey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "destroy_job",
"params": {
"i": "9c6e8c99-56fe-490c-8442-4936ba777499",
"k": "mykey"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:163 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '163', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'destroy_job', 'params': {'i': '9c6e8c99-56fe-490c-8442-4936ba777499', 'k': 'mykey'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 79
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"ok": true
}
}
Parameters:
k API key with master permissions
i job id
get_job - get job information
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 159
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "get_job",
"params": {
"i": "9c6e8c99-56fe-490c-8442-4936ba777499",
"k": "mykey"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 159" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "get_job", "params": {"i": "9c6e8c99-56fe-490c-8442-4936ba777499", "k": "mykey"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 159" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "get_job", "params": {"i": "9c6e8c99-56fe-490c-8442-4936ba777499", "k": "mykey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "get_job",
"params": {
"i": "9c6e8c99-56fe-490c-8442-4936ba777499",
"k": "mykey"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:159 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '159', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'get_job', 'params': {'i': '9c6e8c99-56fe-490c-8442-4936ba777499', 'k': 'mykey'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 401
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"description": "",
"enabled": false,
"every": "",
"id": "9c6e8c99-56fe-490c-8442-4936ba777499",
"last": null,
"macro": null,
"macro_args": [
"test"
],
"macro_kwargs": {},
"oid": "job:jobs/9c6e8c99-56fe-490c-8442-4936ba777499",
"type": "job"
}
}
Parameters:
k API key with master permissions
i job id
list_job_props - list job properties
Get all editable parameters of the scheduled job.
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 166
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "list_job_props",
"params": {
"i": "9c6e8c99-56fe-490c-8442-4936ba777499",
"k": "mykey"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 166" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "list_job_props", "params": {"i": "9c6e8c99-56fe-490c-8442-4936ba777499", "k": "mykey"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 166" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "list_job_props", "params": {"i": "9c6e8c99-56fe-490c-8442-4936ba777499", "k": "mykey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "list_job_props",
"params": {
"i": "9c6e8c99-56fe-490c-8442-4936ba777499",
"k": "mykey"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:166 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '166', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'list_job_props', 'params': {'i': '9c6e8c99-56fe-490c-8442-4936ba777499', 'k': 'mykey'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 266
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"description": "",
"enabled": false,
"every": "",
"macro": null,
"macro_args": [
"test"
],
"macro_kwargs": {},
"notify_events": 2
}
}
Parameters:
k API key with master permissions
i job id
list_jobs - get jobs list
Get the list of all available scheduled jobs.
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 108
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "list_jobs",
"params": {
"k": "mykey"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 108" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "list_jobs", "params": {"k": "mykey"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 108" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "list_jobs", "params": {"k": "mykey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "list_jobs",
"params": {
"k": "mykey"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:108 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '108', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'list_jobs', 'params': {'k': 'mykey'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 1965
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": [
{
"description": "",
"enabled": false,
"every": "",
"id": "66c93cce-501f-4002-8141-c7e51f584d6f",
"last": null,
"macro": null,
"macro_args": [],
"macro_kwargs": {},
"oid": "job:jobs/66c93cce-501f-4002-8141-c7e51f584d6f",
"type": "job"
},
{
"description": "",
"enabled": false,
"every": "",
"id": "484ed7f9-0fed-4502-8f01-9f9dd2d78108",
"last": null,
"macro": null,
"macro_args": [],
"macro_kwargs": {},
"oid": "job:jobs/484ed7f9-0fed-4502-8f01-9f9dd2d78108",
"type": "job"
},
{
"description": "",
"enabled": false,
"every": "",
"id": "3c8b8a7c-b4d8-411b-8d3e-cd64bd2734cd",
"last": null,
"macro": null,
"macro_args": [],
"macro_kwargs": {},
"oid": "job:jobs/3c8b8a7c-b4d8-411b-8d3e-cd64bd2734cd",
"type": "job"
},
{
"description": "",
"enabled": false,
"every": "",
"id": "9c6e8c99-56fe-490c-8442-4936ba777499",
"last": null,
"macro": null,
"macro_args": [
"test"
],
"macro_kwargs": {},
"oid": "job:jobs/9c6e8c99-56fe-490c-8442-4936ba777499",
"type": "job"
},
{
"description": "",
"enabled": false,
"every": "",
"id": "b09cc59d-4be0-4797-b98d-f43b0bcef355",
"last": null,
"macro": null,
"macro_args": [],
"macro_kwargs": {},
"oid": "job:jobs/b09cc59d-4be0-4797-b98d-f43b0bcef355",
"type": "job"
}
]
}
Parameters:
k API key with master permissions
set_job_prop - set job parameters
Set configuration parameters of the scheduled job.
http
POST /jrpc HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 236
Host: localhost:8817
{
"id": 1,
"jsonrpc": "2.0",
"method": "set_job_prop",
"params": {
"i": "9c6e8c99-56fe-490c-8442-4936ba777499",
"k": "mykey",
"p": "macro_args",
"save": "true",
"v": "test"
}
}
curl
curl -i -X POST http://localhost:8817/jrpc -H "Accept: application/json" -H "Content-Length: 236" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "set_job_prop", "params": {"i": "9c6e8c99-56fe-490c-8442-4936ba777499", "k": "mykey", "p": "macro_args", "save": "true", "v": "test"}}'
wget
wget -S -O- http://localhost:8817/jrpc --header="Accept: application/json" --header="Content-Length: 236" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "set_job_prop", "params": {"i": "9c6e8c99-56fe-490c-8442-4936ba777499", "k": "mykey", "p": "macro_args", "save": "true", "v": "test"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "set_job_prop",
"params": {
"i": "9c6e8c99-56fe-490c-8442-4936ba777499",
"k": "mykey",
"p": "macro_args",
"save": "true",
"v": "test"
}
}' | http POST http://localhost:8817/jrpc Accept:application/json Content-Length:236 Content-Type:application/json
python-requests
requests.post('http://localhost:8817/jrpc', headers={'Accept': 'application/json', 'Content-Length': '236', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'set_job_prop', 'params': {'i': '9c6e8c99-56fe-490c-8442-4936ba777499', 'k': 'mykey', 'p': 'macro_args', 'save': 'true', 'v': 'test'}})
response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 79
Content-Type: application/json
Expires: 0
Pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"ok": true
}
}
Parameters:
k API key with master permissions
i job id
p property name (or empty for batch set)
Optionally:
v propery value (or dict for batch set)
save save configuration after successful call