2 KiB
#Remote Application Programming Interface (API) {#API}
VILLASnode can be controlled remotely over a HTTP REST / WebSocket API. This page documents this API.
Transports
The API is accessible via multiple transports:
- via HTTP POST requests
- via a WebSocket protocol
- via a Unix socket
All transports use the same JSON based protocol to handle requests.
HTTP REST
Endpoint URL: http[s]://localhost:80/api/v1 HTTP Method: POST
WebSockets
WebSocket Protocol: api
Unix socket
This transport is not implemented yet
Commands
restart
Restart VILLASnode with a new configuration file.
Request: application/json
{
"request": "restart",
"id": "66675eb4-6a0b-49e6-8e82-64d2b2504e7a"
"args" : {
"configuration": "smb://MY-WINDOWS-HOST/SHARE1/path/to/config.conf"
}
}
Response: application/json
{
"response": "reload",
"id": "66675eb4-6a0b-49e6-8e82-64d2b2504e7a"
}
config
Retrieve the contents of the current configuration.
Request: application/json
{
"request": "config",
"id": "66675eb4-6a0b-49e6-8e82-64d2b2504e7a"
}
Response: application/json
{
"response": "config",
"id": "66675eb4-6a0b-49e6-8e82-64d2b2504e7a",
"response" : {
"nodes" : {
"socket_node" : {
"type": "socket",
"layer": "udp",
...
}
},
"paths" : [
{
"in": "socket_node",
"out": "socket_node"
}
]
}
}
nodes
Get a list of currently active nodes.
Request: application/json
{
"request": "nodes",
"id": "5a786626-fbc6-4c04-98c2-48027e68c2fa"
}
Response: application/json
{
"command": "nodes",
"response": [
{
"name": "ws",
"state": 4,
"vectorize": 1,
"affinity": 0,
"id": 0,
"type": "websocket",
"description": "Demo Channel"
}
],
"id": "5a786626-fbc6-4c04-98c2-48027e68c2fa"
}
paths
Get a list of currently active paths.
This request is not implemented yet
status
The the status of this VILLASnode instance.
This request is not implemented yet