# Create zone

## createZone()

This should create the DNS zone at the given 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</td></tr><tr><td>string</td><td>$zoneName</td><td>The name of the zone. Usually needed for zone creation.</td></tr><tr><td>array</td><td>$nameservers</td><td>The nameservers which may (!) be required for zone creation</td></tr></tbody></table>

None.

### Response

Instance of ZoneDetails() class.

<table><thead><tr><th width="142">Type</th><th width="166">Name</th><th>Description</th></tr></thead><tbody><tr><td>mixed</td><td>id</td><td>The ID of the zone. Sometimes an ID, UUID or string.</td></tr><tr><td>string</td><td>$name</td><td>The name of the zone in the integration.</td></tr><tr><td>mixed</td><td>$serial</td><td>The serial ID of the integration. Not used anywhere, just informational.</td></tr><tr><td>array or null</td><td>$nameservers</td><td>The array of nameservers which are required by the domain to point to the dns zone.</td></tr><tr><td>array</td><td>$records</td><td>Should be empty.</td></tr></tbody></table>

### Example Code

```php
public function createZone(IpamRdnsHost $ipamRdnsHost, string $zoneName, ?array $nameservers = null): ZoneDetails {
	try {
		$response = $this->_sendRequest($ipamRdnsHost, "zones", "POST", [
			"name" => $this->getZoneName($zoneName, $ipamRdnsHost, false),
			"type" => "full",
		]);

		return new ZoneDetails(
			$response->result->id,
			$response->result->name,
			null,
			$response->result->name_servers
		);
	} catch (ClientException $e) {
		throw new Exception($this->_getErrorMessage($e));
	}
}
```

### Testing

\-
