DNS integrations

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:

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

Parameters

Type

Name

Description

IpamRdnsHost

$ipamRdnsHost,

The DNS host

String

$zoneName

The zone name

Response

ZoneDetails() class. See Create zone

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

Type

Name

Description

mixed

$id

ID of the record, if any. Can be null.

string

$type

The DNS type

string

$hostname

The hostname

string

$content

The content

Int or Null

$ttl

The TTL

String or null

$priority

The priority (only for MX records)

Example Code

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.

Was this helpful?