# Get zone details

## getZoneDetails()

This gets called when a customer opens a domain and the dns manager in the storefront. This gets called in the following file:

```php
app/Http/Controllers/Storefront/Account/AccountDomainController.php Line 96
```

### 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 zone name</td></tr></tbody></table>

### Response

ZoneDetails() class. See [create-zone](https://docs.hostware.io/developer-documentation/module/dns-integrations/create-zone "mention")

The ZoneDetails() should contain an array of DnsRecordItem():

<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>ID of the record, if any. Can be null.</td></tr><tr><td>string</td><td>$type</td><td>The DNS type</td></tr><tr><td>string </td><td>$hostname</td><td>The hostname</td></tr><tr><td>string</td><td>$content</td><td>The content</td></tr><tr><td>Int or Null</td><td>$ttl</td><td>The TTL</td></tr><tr><td>String or null</td><td>$priority</td><td>The priority (only for MX records)</td></tr></tbody></table>

### Example Code

```php
public function getZoneDetails(IpamRdnsHost $ipamRdnsHost, string $zoneName): ZoneDetails {
	$dnsRecords = [];
	$zoneName = $this->getZoneName($zoneName, $ipamRdnsHost);

	try {
		$zoneResponse = $this->_sendRequest($ipamRdnsHost, "zones/{$zoneName}");
		$recordsResponse = $this->_sendRequest($ipamRdnsHost, "zones/{$zoneName}/dns_records");
	} catch (ClientException $e) {
		throw new Exception($this->_getErrorMessage($e));
	}

	foreach ($recordsResponse->result as $record) {
		$dnsRecords[] = new DnsRecordItem(
			$record->id,
			$record->type,
			$record->name,
			$record->content,
			$record->ttl,
		);
	}

	return new ZoneDetails(
		$zoneResponse->result->id,
		$zoneResponse->result->name,
		null,
		$zoneResponse->result->name_servers,
		$dnsRecords
	);
}
```

### Testing

You can test this function by creating a ticket in the storefront.
