Use the Delete Zone API to delete the zone record from the PDNS server. This will delete both the records and domains associated with the record from the PowerDNS servers database. The API response will contain "done" as "true" after successful removal of the zone.
HTTP Request
https://hostname:4085/index.php?act=domains&pdnsid=PDNSID
Parameters
Name | Method | Value | Description | Required |
---|---|---|---|---|
act | GET | domains | The action will be return the result after deleting the specified zone | Yes |
pdnsid | POST | Int | The zone of the respective pdns server that needs to be deleted | Yes |
del | POST | Int | The ID of the zone that needs to be deleted. For deleting multiple zones pass in the IDs as comma separated values | Yes |
Sample Code
<?php
require_once('/usr/local/virtualizor/sdk/admin.php');
$key = 'your_api_key';
$pass = 'your_api_pass';
$ip = 'your_server_ip';
$admin = new Virtualizor_Admin_API($ip, $key, $pass);
$page= 1;
$reslen = 1;
$post=array();
$post['pdnsid'] = 1;
$post['del'] = 15;
$output = $admin->domains($page, $reslen, $post);
print_r(json_encode($output));
?>
Output
{
"title": "DNS Zones",
"done": "true",
"domains": "null",
"timenow": "1480920783",
"time_taken": "0.115"
}