Edit DNS Server

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

NameMethodValueDescriptionRequired
actGETeditpdnsThe action specified to perform the operationYes
pdnsidPOSTIntID of the power dns serverYes
namePOSTtextName given to the serverYes
descrPOSTtextA short description given to the serverNo
ipaddressPOSTtextIP Address to be given for connectionYes
sqldbPOSTtextSpecifying the SQL database nameYes
sqlpasswordPOSTtextSpecifying the SQL PasswordYes
encrypt_sql_passPOST1/0This will encrypt the user passwordNo
sqlportPOSTIntPort given to the server for remote connectionYes
sqlusernamePOSTtextSpecifying username of the sql database in the dns serverYes
use_sslPOST1/0The powerdns using a secure connectionNo

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",
    "timenow": "1480594044",
    "time_taken": "0.081"
}
Was this helpful to you?