# Get all zones

## getAllZones()

This should return all zones which are present in the dns integration.

### Parameters

<table><thead><tr><th width="142">Type</th><th width="166">Name</th><th>Description</th></tr></thead><tbody><tr><td>IpamRdnsHost</td><td>$ipamRdnsHost</td><td>The DNS host containing the credentials</td></tr></tbody></table>

### Response

Array of ZoneDetails() classes. Each class resembles a zone contains the following attributes: See [create-zone](https://docs.hostware.io/developer-documentation/module/dns-integrations/create-zone "mention")

### Example Code

```php
public function getAllZones(IpamRdnsHost $ipamRdnsHost): array {
	$return = [];

	try {
		$zoneResponse = $this->_sendRequest($ipamRdnsHost, "zones?per_page=50");
	} catch (ClientException $e) {
		throw new Exception($this->_getErrorMessage($e));
	}

	foreach ($zoneResponse->result as $zone) {
		$return[] = new ZoneDetails(
			$zone->id,
			$zone->name,
			null,
			$zone->name_servers
		);
	}
	
	return $return;
}
```

### Testing

You can test this function when opening the admin area. Settings > DNS Hosts > All zones. The requests is done sync.
