Create Subnet
Create a new subnet for a specified subnet group.
Required Permissions
Requires the ADMIN role or higher.
HTTP Request
POST /api/sonar/subnet-groups/:guid/subnets
cURL Example
curl -H "Authorization: Bearer <API_KEY>" \
-d start_ip="192.168.253.1" \
-d end_ip="192.168.253.255" \
-X POST \
https://HOSTNAME/api/sonar/subnet-groups/b76c3c81-c961-404f-a0eb-fae2f12f5bd8/subnets
Request Parameters
| Key | Required | Type | Description | Note |
|---|---|---|---|---|
| guid | O | String | Subnet group GUID | 36 characters |
| start_ip | O | String | Starting IP address | Minumum 7 to maximum 15 characters |
| end_ip | X | String | Ending IP address | Minumum 7 to maximum 15 characters |
| cidr | X | 32-bit integer | CIDR | Minimum 0 to maximum 32 |
| description | X | String | Subnet description | Maximum 255 characters |
Note
At least one of end_ip and cidr must be provided.
Success Response
{}
Error Responses
Required argument is missing
HTTP status code 400.
{
"error_code": "null-argument",
"error_msg": "start_ip should be not null"
}
Invalid argument length
HTTP status code 400.
{
"error_code": "invalid-argument",
"error_msg": "'start_ip' must be less than or equal to 15 characters."
}
cidr is not an integer
HTTP status code 400.
{
"error_code": "invalid-argument",
"error_msg": "'cidr' parameter should be int type"
}
No privilege to create a subnet
HTTP status code 500 .
{
"error_code": "illegal-state",
"error_msg": "no-permission"
}