Delete DNS Records

Use the Delete DNS Records API to delete DNS record from the PowerDNS server. The API response will contain “done” as the array of the IDs of the deleted DNS records.

HTTP Request

https://hostname:4085/index.php?act=dnsrecords&pdnsid=PDNSID

Parameters

NameMethodValueDescriptionRequired
actGETdnsrecordsThe action will return list of IDs of the deleted dns recordsYes
delPOSTIntThe DNS record ID that needs to be deleted. For deleting multiple records pass in the IDs as comma separated valuesYes
pdnsidGETIntThe ID of the respective pdns server whose dns records need to be deletedYes

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);

    $post = array();
    $post['del'] = 1;
    $post['del'] = '4,5'; // for deleting multiple values
    $post['pdnsid'] = 6 ;

    $output = $admin->delete_dnsrecords($post);

    print_r(json_encode($output));

?>

Output

{
    "title": "DNS Records",
    "done": [
        4,
        5
    ],
    "dns_records": null,
    "timenow": 1537354895,
    "time_taken": "0.140"
}
Was this helpful to you?