Skip to main content
Skip table of contents

List of DHCP pools

Getting the list of DHCP pools

Retrieve all DHCP pools within a single group

GET /api/admin/v1/dhcp-subnets

Method parameters

int page, pagination page number


int per_page, number of items per pagination page. Default is 25


integer dhcp_subnet_group_id, ID of the DHCP subnet group from which we want to retrieve all DHCP pools


string pool, search for a DHCP pool where the desired IP address is between the start and end IP

200 OK

Successful response

JSON
{
    "data": [
        {
            "id": 1807,
            "subnet": "192.168.204.0/24",
            "relay": "[\"192.168.204.1\"]",
            "option_routers": "192.168.204.1",
            "pools": [
                {
                    "id": 1862,
                    "start_address": "192.168.204.240",
                    "end_address": "192.168.204.253"
                }
            ]
        }
    ],
    "links": {
        "first": "https://vms.local/api/admin/v1/dhcp-subnets?dhcp_subnet_group_id=65&per_page=25&page=1",
        "last": "https://vms.local/api/admin/v1/dhcp-subnets?dhcp_subnet_group_id=65&per_page=25&page=1",
        "prev": null,
        "next": null
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "links": [
            {
                "url": null,
                "label": "pagination.previous",
                "active": false
            },
            {
                "url": "https://vms.local/api/admin/v1/dhcp-subnets?dhcp_subnet_group_id=65&per_page=25&page=1",
                "label": "1",
                "active": true
            },
            {
                "url": null,
                "label": "pagination.next",
                "active": false
            }
        ],
        "path": "https://vms.local/api/admin/v1/dhcp-subnets",
        "per_page": "25",
        "to": 1,
        "total": 1
    }
}

401 Unauthorized

Authorization token is not provided or is invalid. Obtaining a token

cURL
BASH
curl -k --request POST \
	--url 'https://your-domain/api/admin/v1/dhcp-subnets' \
	--header 'Content-Type: application/json' \
	--header 'Accept: application/json' \
	--data '{
    "page": 0,
    "per_page": 0,
    "dhcp_subnet_group_id": "integer",
    "pool": "string"
}'
PHP
PHP
$data = array (
  'page' => 0,
  'per_page' => 0,
  'dhcp_subnet_group_id' => 'integer',
  'pool' => 'string',
);
$context = stream_context_create([
	'ssl'=>['verify_peer' => false],
	'http' => [
		'method' => 'GET',
		'header' => "Content-Type: application/json\r
Accept: application/json",
		'content'=>json_encode($data)
	]
]);
$result = file_get_contents('https://your-domain/api/admin/v1/dhcp-subnets', false, $context);
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.