Add Reverse DNS zone

Use the Add Reverse DNS zone API for adding the reverse dns zone to the PowerDNS server’s database. These reverse DNS zone allow resolution of the IP address to a valid domain name. Both IPv4 and IPv6 type of zone records can be added using this API. The API response will contain “done” as “true” after the record is added successfully.

HTTP Request

https://hostname:4085/index.php?act=rdns

Parameters

NameMethodValueDescriptionRequired
actGETrdnsThe action will add a rdns zoneYes
zone_namePOSTtextWe specify the zone name here, refer below table for valid valuesYes
ns1POSTtextThis takes the nameserver valueYes
ns2POSTtextThis takes the nameserver valueYes
ns3POSTtextThis takes the nameserver valueNo
ns4POSTtextThis takes the nameserver valueNo
pdnsidPOSTIntThis specifies the pdnsid that has to be included with the rdnsYes

Zone Name Specification

IPZone
1.2.3.xxx3.2.1.in-addr.arpa
2001:41d0:0008:53ff:0000:0000:xxxx:xxxx0.0.0.0.0.0.0.0.f.f.3.5.8.0.0.0.0.d.1.4.1.0.0.2.ip6.arpa

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['pdnsid'] = 1;
    $post['rdns'] = 1;
    $post['ns1'] = '4.2.2.1';
    $post['ns2'] = '4.2.2.1';   
    $post['zone_name'] = '35.189.107.in-addr.arpa';
    $post['hostmasteremail'] = 'test@test.com';

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

    print_r(json_encode($output));  

?>

Output

{
    "title": "Add Reverse DNS Zone",
    "done": "true",
    "timenow": "1480659350",
    "time_taken": "0.130"
}
Was this helpful to you?