Use the Add DNS Server API to add a new PowerDNS Server to the Virtualizor panel. PowerDNS servers allows you to manage your zones and records. Virtualizor uses repository provided by PowerDNS itself. The VPS should have Power DNS installed on it, before it is added to the Virtualizor panel. The API response will contain "done" as "true" after the server is added successfully.
For installation, please refer Configure PowerDNS guide.
HTTP Request
https://hostname:4085/index.php?act=addpdns
Parameters
Name | Method | Value | Description | Required |
---|---|---|---|---|
act | GET | addpdns | The action specified to perform the operation and return "done" as "true" on successful addition of the server | Yes |
name | POST | text | Name given to the server | Yes |
descr | POST | text | A short description given to the server | No |
ipaddress | POST | text | IP Address to be given for connection | Yes |
sqlport | POST | Int | Port given to the server for remote connection | Yes |
sqlusername | POST | text | Specifying username of the sql database in the PDNS server | Yes |
sqlpassword | POST | text | Specifying the SQL Password of the PDNS server | Yes |
sqldb | POST | text | Specifying the SQL database name | Yes |
encrypt_sql_pass | POST | 1/0 | This will encrypt the user password | No |
use_ssl | POST | 1/0 | The powerdns using a secure connection | 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();
$post['name'] = 'api-test';
$post['descr'] = 'apidesc';
$post['ipaddress'] = '127.0.5.5';
$post['sqldb'] = 'apidb';
$post['sqlpassword'] = 'password';
$post['encrypt_sql_pass'] = 1;
$post['sqlport'] = '3306';
$post['sqlusername'] = 'user';
$post['use_ssl'] = 1;
$output = $admin->addpdns($post);
print_r(json_encode($output));
?>
Output
{
"title": "Add DNS Server",
"done": 545, //DNS server ID
"timenow": "1471398668",
"time_taken": "0.112"
}