Use Add API Key API to add new API credentials for VPS of your server.
HTTP Request
https://hostname:4083/index.php?act=apikey&do=add
Parameters
Name | Type | Value | Description | Required |
---|---|---|---|---|
act | GET | apikey | The action which will return data belonging to a particular page | Yes |
do | POST | add | The action which will add new api key for VPS. | Yes |
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);
$vps = $v->addapikey();
print_r(json_encode($vps));
?>
Curl
curl -k -L "https://hostname:4083/index.php?act=apikey&do=add&api=json&apikey=your_api_key&apipass=your_api_pass"
Output
{
"uid":"600",
"act":"apikey",
"timezone":2,
"timenow":"July 24, 2019, 1:28 pm",
"vpsid":"6710",
"username":"a@a.com",
"user_type":"2",
"preferences":{
"theme":"default",
"language":"english",
"timezone":2
},
"url":"index.php?",
"rdns":{
"pdnsid":null
},
"support_link":"http:\/\/softaculous.com",
"enable_eu_iso":1,
"billing_symbol":"$",
"enable_registration":0,
"inhouse_billing":"0",
"title":"KVMTestServer",
"done":{
"msg":"API key pair has been added",
"goto":"act=apikey"
},
"apikeys":{
"31":{
"idapi":"31",
"uid":"600",
"apikey":"4CAOZECACKLD6LSK",
"apipass":"be3br4js6gsn3c9jlvtt4zdkevuatfne",
"data":""
},
"36":{
"idapi":"36",
"uid":"600",
"apikey":"JCQHNCTTZKLFKJGU",
"apipass":"tiitma09tviomzsdmig7lblkop2f0gk8",
"data":""
}
},
"time_taken":"0.101"
}