Search DNS Records

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

NameMethodValueDescriptionRequired
actGETdnsrecordsThe action will list all the dns recordsYes
pdnsidGETIntThe pdnsid whose dns records needs to be listedYes
domainGETIntThe dns records will be searched on the basis of domain_id specifiedNo
dns_nameGETtextThe dns records will be searched on the basis of the dns name specifiedNo
dns_domainGETtextThe dns records will be searched on the basis of dns domain specifiedNo
record_typeGETtextThe dns records will be searched on the basis of record type specified, refer below table for valid valuesNo
reslenGETIntNumber of records to be returned, default is 50No
pageGETIntPage number, each page show 50 recordsNo

Record Type

NameValue
soa_recordSOA
ptr_recordPTR
a_recordA (host)
cname_recordCNAME (Aliases)
mx_recordMX (Mail Exchange)
txt_recordTXT (Text)
ns_recordNS (Name Servers)
aaaa_recordAAAA (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"
}
Was this helpful to you?