Get Virtualizor

Edit DNS Records

Use the Edit DNS Records API to update a DNS record on the PowerDNS server.

HTTP Request

https://hostname:4085/index.php?act=add_dnsrecord&pdnsid=PDNSID&edit=DNSID

Parameters

NameMethodValueDescriptionRequired
actGETadd_dnsrecordThe action will allow to edit the dns recordYes
pdnsidGETIntThe ID of the PDNS Server which has the recordYes
editGETIntThe ID of the DNS record to be editedYes
hostPOSTtextThe hostname of the dns recordYes
contentPOSTtextThe content of the dns recordYes
prioPOSTIntThe priority of the dns recordNo
ttlPOSTIntThe value for which the record will be activeYes

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'] = 6;
    $post['edit'] = 3 ;
    $post['host'] = '35.189.107.in-addr.arpa';
    $post['content'] = '4.2.2.2';
    $post['ttl'] = 90000;

    $output = $admin->edit_dnsrecord($post);

    print_r(json_encode($output));

?>

Output

{
    "title": "Virtualizor",
    "timenow": "1480924964",
    "time_taken": "0.166"
}
    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list