Network API Configuration
This document details the endpoints available for managing and retrieving network API configurations. These endpoints allow for fine-grained control over various network-related settings and parameters.
Endpoints
Get Current Configuration
GET/net/api/configRetrieves the current active network API configuration. This endpoint returns a JSON object representing all configured parameters.
Response (200 OK)
{
"version": "1.2.0",
"enabled": true,
"ports": {
"http": 80,
"https": 443,
"admin": 8080
},
"timeout_seconds": 60,
"logging": {
"level": "INFO",
"file": "/var/log/network-api.log"
},
"rate_limit": {
"enabled": true,
"requests_per_minute": 1000
},
"allowed_ips": [
"192.168.1.0/24",
"10.0.0.1"
]
}
Update Configuration
PUT/net/api/configUpdates the network API configuration with the provided values. The request body should be a JSON object containing the parameters to be modified.
Note: Not all parameters may be modifiable via this endpoint. Refer to the parameter table below for details.
Request Body Example
{
"timeout_seconds": 30,
"logging": {
"level": "DEBUG"
},
"rate_limit": {
"requests_per_minute": 1500
}
}
Response (200 OK)
Returns the updated configuration.
Response (400 Bad Request)
If the request body is malformed or invalid.
Response (403 Forbidden)
If the user does not have permission to modify the configuration.
Reset Configuration
POST/net/api/config/resetResets the network API configuration to its default values. This action is irreversible.
Response (200 OK)
Indicates that the configuration has been reset.
Response (403 Forbidden)
If the user does not have permission to reset the configuration.
Configuration Parameters
| Parameter | Type | Description | Modifiable | Default Value |
|---|---|---|---|---|
version |
String | The current version of the API configuration schema. | No | N/A |
enabled |
Boolean | Determines if the network API is currently active and accepting requests. | Yes | true |
ports |
Object | An object defining the ports used by the API (e.g., http, https, admin). | Yes | {"http": 80, "https": 443, "admin": 8080} |
ports.http |
Integer | The port for HTTP traffic. | Yes | 80 |
ports.https |
Integer | The port for HTTPS traffic. | Yes | 443 |
ports.admin |
Integer | The port for administrative access. | Yes | 8080 |
timeout_seconds |
Integer | The maximum time in seconds to wait for a request to complete. | Yes | 60 |
logging |
Object | Logging configuration settings. | Yes | {"level": "INFO", "file": "/var/log/network-api.log"} |
logging.level |
String | The logging verbosity level (e.g., DEBUG, INFO, WARN, ERROR). | Yes | "INFO" |
logging.file |
String | The path to the log file. | Yes | "/var/log/network-api.log" |
rate_limit |
Object | Rate limiting configuration. | Yes | {"enabled": true, "requests_per_minute": 1000} |
rate_limit.enabled |
Boolean | Enables or disables rate limiting. | Yes | true |
rate_limit.requests_per_minute |
Integer | The maximum number of requests allowed per minute. | Yes | 1000 |
allowed_ips |
Array of Strings | A list of IP addresses or CIDR blocks that are allowed to access the API. If empty, all IPs are allowed. | Yes | [] |