Delete Zone

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

NameMethodValueDescriptionRequired
actGETdomainsThe action will be return the result after deleting the specified zoneYes
pdnsidPOSTIntThe zone of the respective pdns server that needs to be deletedYes
delPOSTIntThe ID of the zone that needs to be deleted. For deleting multiple zones pass in the IDs as comma separated valuesYes

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"
}
Was this helpful to you?