This article provides a guide for a VPS User to add DNS record using the VPS User API.
Use Add DNS Record API to add DNS record on VPS of your server.
HTTP Request
https://vm1.apivps.com:4083/index.php?act=managezone&domainid=DID
Parameters
Name | Type | Value | Description | Required |
---|---|---|---|---|
act | GET | managezone | The action which will return data belonging to a particular page | Yes |
domainid | POST | int | Provide domain ID of which you want the information. | Yes |
add | POST | int | Provide value as 1. | Yes |
name | POST | text | Provide hostname of record. | Yes |
type | POST | text | Provide record type | Yes |
content | POST | text | Provide IP. | Yes |
prio | POST | text | Provide priority of the record. | Yes |
ttl | POST | text | Provide time to live. | Yes |
Type Option
( A | CNAME | MX | NS | AAAA | TXT | SRV )
Sample Code
PHP
<?php require_once('/usr/local/virtualizor/sdk/enduser.php'); $key = 'your_api_key'; $pass = 'your_api_pass'; $ip = 'host_ip'; $v = new Virtualizor_Enduser_API($ip, $key, $pass); $did = 4; $post['add'] = 1; $post['name'] = 'domain'; $post['type'] = 'A';//A | CNAME | MX | NS | AAAA | TXT | SRV $post['content'] = 'xx.xx.xx.xx'; $post['prio'] = '1'; $post['ttl'] = '6400'; $vps = $v->managezone($did,$post); print_r(json_encode($vps)); ?>
Curl
curl -k -X POST -d "add=1&name=testq&type=A&content=xx.xx.xx.xx&prio=1&ttl=6400" -L "https://vm1.apivps.com:4083/index.php?act=managezone&domainid=DID&api=json&apikey=your_api_key&apipass=your_api_pass"
Output
{ "uid":"1", "act":"managezone", "timezone":0, "timenow":"July 26, 2023, 1:08 pm", "vpsid":"7", "username":"abc@abc.com", "user_type":"2", "preferences":{ "fname":"joe", "lname":"doe", "theme":"default", "language":"english", "timezone":0 }, "url":"index.php?", "rdns":{ "pdnsid":"1" }, "pdns":{ "pdnsid":"1" }, "title":"APIVPS", "add_done":true, "domain":{ "4":{ "id":"4", "name":"myzone", "master":null, "last_check":null, "type":"MASTER", "notified_serial":null, "account":null, "virtualizor_uid":"1" } }, "domains":{ "3":{ "id":"3", "name":"testzone", "master":null, "last_check":null, "type":"MASTER", "notified_serial":null, "account":null, "virtualizor_uid":"1" }, "4":{ "id":"4", "name":"myzone", "master":null, "last_check":null, "type":"MASTER", "notified_serial":null, "account":null, "virtualizor_uid":"1" } }, "records":null, "manage_type":[ "A", "CNAME", "MX", "NS", "AAAA", "TXT", "SRV" ], "domainid":4, "done":{ "msg":"The record has been added successfully", "goto":"act=managezone&domainid=4" }, "time_taken":"0.124" }