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
Name Method Value Description Required act GET rdns The action will add a rdns zone Yes zone_name POST text We specify the zone name here, refer below table for valid values Yes ns1 POST text This takes the nameserver value Yes ns2 POST text This takes the nameserver value Yes ns3 POST text This takes the nameserver value No ns4 POST text This takes the nameserver value No pdnsid POST Int This specifies the pdnsid that has to be included with the rdns Yes
Zone Name Specification
IP Zone 1.2.3.xxx 3.2.1.in-addr.arpa 2001:41d0:0008:53ff:0000:0000:xxxx:xxxx 0.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'] = '[email protected] ';
$output = $admin->rdns($post);
print_r(json_encode($output));
?>
Output
{
"title": "Add Reverse DNS Zone",
"done": "true",
"timenow": "1480659350",
"time_taken": "0.130"
}