-
Notifications
You must be signed in to change notification settings - Fork 211
REST API
Illarion Kovalchuk edited this page Aug 21, 2018
·
12 revisions
You can enable/disable and configure REST API port in gobetween config file in [api]
section:
[api]
enabled = true # true | false
bind = ":8888" # bind host:port
# uncomment to enable
#[api.basic_auth] # (optional) Enable HTTP Basic Auth
#login = "admin" # HTTP Auth Login
#password = "1111" # HTTP Auth Password
# uncomment to enable
#[api.tls] # (optional) Enable HTTPS
#cert_path = "/path/to/cert.pem" # Path to certificate
#key_path = "/path/to/key.pem" # Path to key
API responds with typical HTTP codes representing success of failure of the operation:
- 200 OK
- 400 Bad Request
- 409 Conflict
- 500 Internal Server Error
Returns system information about gobetween process.
{
"configuration": {
"kind" : String
// ...
// kind-specific data
},
"pid": Integer,
"startTime": String,
"time": String,
"uptime": Duration,
"version": String
}
- format - "toml" (default) | "json"
# TOML or JSON formatted current config
{
// server definition of the same structure and format as `[servers.<name>]`
// entry in config TOML file but JSON encoded.
}
{
// Represents the same structure and format as `[servers]` entries in config TOML file.
"<name>": {
// server definition of the same structure and format as `[servers.<name>]`
// entry in config TOML file but JSON encoded.
},
// other servers
}
{
// server definition of the same structure and format as `[servers.<name>]`
// entry in config TOML file but JSON encoded.
}
{
"active_connections": Integer,
"rx_total": Integer, // bytes
"tx_total": Integer, // bytes
"rx_second": Integer, // bytes/second
"tx_second": Integer, // bytes/second
"backends": [
{
"host": String,
"port": String,
"priority": Integer,
"weight": Integer,
"stats": {
"live": Boolean,
"discovered": Boolean,
"total_connections": Integer,
"active_connections": Integer,
"refused_connections": Integer,
"rx": Integer, // bytes
"tx": Integer // bytes
"rx_second": Integer, // bytes/second
"tx_second": Integer, // bytes/second
}
},
// ... other backends ...
]
}
"OK"