Use Add DNS API to add dns server on your server.
HTTP Request
https://hostname:4085/index.php?act=pdns
Parameters
Name | Type | Value | Description | Required |
---|---|---|---|---|
act | GET | pdns | The action will add a DNS Zone | Yes |
addzone | POST | Int | To add the zone it will be 1 | Yes |
zone_name | POST | Text | Zone name as per requirement | Yes |
pdns_server | POST | Int | Power DNS server id to be selected | Yes |
Sample Code
PHP
<?php
require_once('/usr/local/virtualizor/sdk/enduser.php');
$key = 'your_api_key';
$pass = 'your_api_pass';
$ip = 'your_server_ip';
$admin = new Virtualizor_Enduser_API($ip, $key, $pass);
$post = array(
'addzone' => 1,
'zone_name' => 'virtualizor.com',
'hostmaster_email' => 'admin@virtualizor.com',
'pdns_server' => 32,
);
//$id['del'] = '';*/
$output = $admin->pdns($post);
print_r(json_encode($output));
?>
Curl
curl -k -X POST -d "addzone=1&zone_name=test1.com" -L
"https://hostname:4083/index.php?act=pdns&
api=json&apikey=your_api_key&apipass=your_api_pass"
Output
{
"uid": "5",
"act": "pdns",
"timezone": 1,
"timenow": "October 17, 2016, 9:17 am",
"vpsid": "3587",
"username": "test@test.com",
"user_type": "2",
"preferences": {
"fname": "",
"lname": "",
"theme": "default",
"language": "english",
"timezone": 1
},
"url": "index.php?",
"rdns": {
"pdnsid": "1"
},
"pdns": {
"pdnsid": "1"
},
"support_link": "http:\/\/softaculous.com",
"disable_login_logo": 1,
"title": "DNS Management",
"add_done": 6,
"done": {
"msg": "The Zone has been added successfully",
"goto": "act=pdns"
},
"domains": {
"2": {
"id": "2",
"name": "test123.com",
"master": null,
"last_check": null,
"type": "MASTER",
"notified_serial": null,
"account": null,
"solusvm_cid": "5"
},
"6": {
"id": "6",
"name": "test234.com",
"master": null,
"last_check": null,
"type": "MASTER",
"notified_serial": null,
"account": null,
"solusvm_cid": "5"
}
},
"time_taken": "0.203"
}