Use the Edit DNS Server API to update the DNS server configuration on the Virtualizor panel. Make sure you test the connection of the PowerDNS after updating the information.
HTTP Request
https://hostname:4085/index.php?act=editpdns&pdnsid=PDNSID
Parameters
Name | Method | Value | Description | Required |
---|---|---|---|---|
act | GET | editpdns | The action specified to perform the operation | Yes |
pdnsid | POST | Int | ID of the power dns 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 |
sqldb | POST | text | Specifying the SQL database name | Yes |
sqlpassword | POST | text | Specifying the SQL Password | Yes |
encrypt_sql_pass | POST | 1/0 | This will encrypt the user password | No |
sqlport | POST | Int | Port given to the server for remote connection | Yes |
sqlusername | POST | text | Specifying username of the sql database in the dns server | Yes |
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['pdnsid'] = 15;
$post['name'] = 'api-test-edit';
$post['descr'] = 'edited';
$post['ipaddress'] = '127.0.5.5';
$post['sqldb'] = 'apidb';
$post['sqlpassword'] = 'passsword';
$post['encrypt_sql_pass'] = 1;
$post['sqlport'] = '3306';
$post['sqlusername'] = 'user';
$post['use_ssl'] = 1;
$output = $admin->editpdns($post);
print_r(json_encode($output));
?>
Output
{
"title": "Edit PDNS Server",
"done": "true",
"timenow": "1480594044",
"time_taken": "0.081"
}