Use the Add DNS Plans to create DNS Plans on the Virtualizor panel. A DNS plan contains information about the DNS server, the number of records that the DNS server can hold, the maximum number of domains that the DNS server can have and the TTL given to the records. The API response will contain "done" as "true" if the plan is created successfully.
For more information, you can refer this Configure PowerDNS guide.
HTTP Request
https://hostname:4085/index.php?act=adddnsplans
Parameters
Name | Method | Value | Description | Required |
---|---|---|---|---|
act | GET | adddnsplans | Specified action adds a dns plan and returns true on success | Yes |
plan_name | POST | text | Unique name of the Plan | Yes |
dnsserverid | POST | Int | ID of DNS Server on which plan is to be created | Yes |
maxdomains | POST | Int | Maximum number of Domains | Yes |
maxdomainsrec | POST | Int | Maximum number of Records for Domain | Yes |
ttl | POST | Int | Time To Live value | Yes |
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();
$post['plan_name'] = 'test';
$post['dnsserverid'] = 10;
$post['maxdomains'] = 1000;
$post['maxdomainsrec'] = 1999;
$post['ttl'] = 10000;
$output = $admin->adddnsplan($post);
print_r(json_encode($output));
?>
Output
{
"title": "Add DNS Plan",
"done": 343, //DNS plan ID
"timenow": 1535716893,
"time_taken": "0.207"
}