DNS - Add DNS Server


This article provides a guide for a VPS User to add DNS server using the VPS User API.

Use Add DNS API to add DNS server on your server.

HTTP Request

https://vm1.apivps.com:4083/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://vm1.apivps.com: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, 2023, 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:\/\/apivps.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"
}
  • vps api, vps guide, dns server
  • 0 Kasutajad peavad seda kasulikuks
Kas see vastus oli kasulik?

Related Articles

DNS - List DNS Server

This article provides a guide for a VPS User to list DNS server info using the VPS User API. Use...

DNS Record - Zone Info

This article provides a guide for a VPS User to get DNS record zone info using the VPS User API....

DNS - Delete DNS Server

This article provides a guide for a VPS User to delete DNS server using the VPS User API. Use...

DNS Record - Add DNS Record

This article provides a guide for a VPS User to add DNS record using the VPS User API. Use Add...

DNS Record - Edit DNS Record

This article provides a guide for a VPS User to edit DNS record using the VPS User API. Use Edit...