REST API CI
Dynamic Configuration Interface based on REST API.
Supports only synchronous requests
Can be used from all machines in network
Configuration
Minimal working configuration
{
...SDK config params...
"ci_rest" : {
"token" : "your_secret_token"
}
}
All configuration parameters
"token"
Authorization token used to restrict access.
"host"
IP address on which REST API should listen.
Default: "127.0.0.1"
"port"
Port to listen on.
Default: 61438
"disabled"
Handy flag to fast disable dynamic interface not removing "ci_rest"
configuration section
Default: 0
Response codes
500 - internal error. Allocation errors, internal exceptions.
200 - success.
404 - request unrecognized.
400 - bad request. Required request parameters are missing.
413 - request body is too long.
To provide detailed information "status"
field is also available in response body.
Requests examples
Ping
<host>:<port>/api/ping
Type: POST
Body: { "token" : "your_secret_token" }
Protect IP address
<host>:<port>/api/protected_ip
Type: POST
Body: { "token" : "your_secret_token", "ip_addr" : "192.168.50.149", "vl" : "ca-ontario-toronto" }
Unprotect IP
<host>:<port>/api/protected_ip
Type: PUT
Body: { "token" : "your_secret_token", "ip_addr" : "192.168.50.149" }
Protect MAC
<host>:<port>/api/protected_mac
Type: POST
Body: { "token" : "your_secret_token", "mac_addr" : "08:00:27:aa:d7:17", "vl" : "ca-ontario-toronto" }
Unprotect MAC
<host>:<port>/api/protected_mac
Type: PUT
Body: { "token" : "your_secret_token", "mac_addr" : "08:00:27:aa:d7:17" }
Protect interface
<host>:<port>/api/protected_iface
Type: POST
Body: { "token" : "your_secret_token", "iface" : "eth2", "vl" : "ca-ontario-toronto" }
Unprotect interface
<host>:<port>/api/protected_iface
Type: PUT
Body: { "token" : "your_secret_token", "iface" : "eth2" }
Dump config file
<host>:<port>/api/dump_config
Type: POST
Body: { "token" : "your_secret_token", "config_path" : "/etc/afwrt/afwrt-ci.conf" }
Get available countries
<host>:<port>/api/countries
Type: POST
Body: { "token" : "your_secret_token" }
Last updated
Was this helpful?