List DNS Server

Use the List DNS Server API to list all the Power DNS servers present on the node. The list would contain the information about the PDNS server such as the server name and its IP address, which will be listing according to the ID of the PDNS servers. To filter or limit the size of the list, pass in one or more query parameters.

HTTP Request

https://hostname:4085/index.php?act=pdns&page=PAGE&reslen=RESLEN

Parameters

NameMethodValueDescriptionRequired
actGETpdnsReturns all the pdns serversYes
pageGETIntIf not specified, then only first 50 records are returnedNo
reslenGETIntNumber of records to be returned, default is 50No
pdns_namePOSTtextThis lists the dns server according to the server nameNo
pdns_ipaddressPOSTtextThis list the pdns server according to the ip addressNo

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();
    $page = 1;
    $reslen = 20;
    $post['pdns_name'] = '';
    $post['pdns_ipaddress'] = '';

    $output = $admin->pdns($page, $reslen, $post);

    print_r(json_encode($output));

?>

Output

{
    "title": "Power DNS",
    "pdns": {
        "7": {
            "id": "7",
            "name": "My dns",
            "description": "",
            "sql_ipaddress": "ip address of the server",
            "sql_port": "port no",
            "sql_username": "root",
            "sql_password": "",
            "sql_database": "powerdns",
            "use_ssl": "1",
            "encrypt_sql_pass": "0",
            "salt": ""
        },
        "10": {
            "id": "10",
            "name": "dns2",
            "description": "",
            "sql_ipaddress": "ip address of the server",
            "sql_port": "port no",
            "sql_username": "root",
            "sql_password": "",
            "sql_database": "powerdns",
            "use_ssl": "0",
            "encrypt_sql_pass": "0",
            "salt": "otantjf9"
        }
    },
    "timenow": "1471398001",
    "time_taken": "0.095"
}
Was this helpful to you?