Domains

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

NameMethodValueDescriptionRequired
actGETdomainsThe action will return the domains of a particular pdnsYes
reslenGETIntNumber of records to be returned, default is 50No
pageGETIntPage number, each page show 50 recordsNo
pdnsidGETIntThe pdnsid whose domains need to be listedYes
domain_namePOSTtextFilter the list using the domain nameNo

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"
}
Was this helpful to you?