Use the Domains API to list the domain information on the PowerDNS servers. These are the domain entries made in the PDNS server database, which are listed according to their IDs. To filter or limit the size of the list, you can specify one or more query parameters.
HTTP Request
https://hostname:4085/index.php?act=domains&pdnsid=PDNSID
Parameters
Name | Method | Value | Description | Required |
---|---|---|---|---|
act | GET | domains | The action will return the domains of a particular pdns | Yes |
reslen | GET | Int | Number of records to be returned, default is 50 | No |
page | GET | Int | Page number, each page show 50 records | No |
pdnsid | GET | Int | The pdnsid whose domains need to be listed | Yes |
domain_name | POST | text | Filter the list using the domain name | 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);
$page = 1;
$reslen = 3;
$post = array();
$post['pdnsid'] = 1;
$post['domain_name'] = '';
$output = $admin->domains($page, $reslen, $post);
print_r(json_encode($output));
?>
Output
{
"title": "DNS Zones",
"domains": {
"1": {
"id": "1",
"name": "3.2.1.in-addr.arpa",
"master": null,
"last_check": null,
"type": "NATIVE",
"notified_serial": null,
"account": null,
"virtualizor_uid": "0"
},
"2": {
"id": "2",
"name": "4.2.1.in-addr.arpa",
"master": null,
"last_check": null,
"type": "NATIVE",
"notified_serial": null,
"account": null,
"virtualizor_uid": "0"
},
"3": {
"id": "3",
"name": "35.189.107.in-addr.arpa",
"master": null,
"last_check": null,
"type": "NATIVE",
"notified_serial": null,
"account": null,
"virtualizor_uid": "0"
}
},
"timenow": 1537357121,
"time_taken": "0.075"
}