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
Name | Method | Value | Description | Required |
---|---|---|---|---|
act | GET | pdns | Returns all the pdns servers | Yes |
page | GET | Int | If not specified, then only first 50 records are returned | No |
reslen | GET | Int | Number of records to be returned, default is 50 | No |
pdns_name | POST | text | This lists the dns server according to the server name | No |
pdns_ipaddress | POST | text | This list the pdns server according to the ip address | No |
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"
}