Use the Search DNS Records API to search for a particular DNS record. The API response contains the list of the details of the DNS records, which are listed according to their IDs.
HTTP Request
https://hostname:4085/index.php?act=dnsrecords&pdnsid=PDNSID&domain_id=DOMAIN_ID&dns_name=DNS_NAME&dns_domain=DNS_DOMAIN&record_type=RECORD_TYPE&page=PAGE&reslen=RESLEN
Parameters
Name Method Value Description Required act GET dnsrecords The action will list all the dns records Yes pdnsid GET Int The pdnsid whose dns records needs to be listed Yes domain GET Int The dns records will be searched on the basis of domain_id specified No dns_name GET text The dns records will be searched on the basis of the dns name specified No dns_domain GET text The dns records will be searched on the basis of dns domain specified No record_type GET text The dns records will be searched on the basis of record type specified, refer below table for valid values No reslen GET Int Number of records to be returned, default is 50 No page GET Int Page number, each page show 50 records No
Record Type
Name Value soa_record SOA ptr_record PTR a_record A (host) cname_record CNAME (Aliases) mx_record MX (Mail Exchange) txt_record TXT (Text) ns_record NS (Name Servers) aaaa_record AAAA (IPV6 Hosts)
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['domain_id'] = 6;
$post['dns_name'] = '';
$post['dns_domain'] = '';
$post['type'] = '';
$output = $admin->search_dnsrecords($page,$reslen,$post);
print_r(json_encode($output));
?>
Output
{
"title": "DNS Records",
"dns_records": {
"1": {
"id": "1",
"domain_id": "6",
"name": "35.189.107.in-addr.arpa.",
"type": "A",
"content": "4.2.2.2",
"ttl": "90000",
"prio": "0",
"change_date": "1537349313",
"disabled": "0",
"ordername": null,
"auth": "1"
}
},
"timenow": 1482565989,
"time_taken": "0.110"
}