Use Bandwidth API to get complete details of VPS bandwidth of your server.
HTTP Request
https://hostname:4083/index.php?act=bandwidth&svs=VPSID&show=month
Parameters
Name | Type | Value | Description | Required |
---|---|---|---|---|
act | GET | ram | The action which will return data belonging to a particular page | Yes |
svs | POST | VPSID | Provide vpsid of which you want the information. | Yes |
show | POST | int | Provide month and year of which you want bandwidth information ( for eg if you want detail for july of 2019 then give 201907 ) | No |
Sample Code
PHP
<?php
require_once('./virt/virtualizor/sdk/enduser.php');
$key = 'your_api_key';
$pass = 'your_api_pass';
$ip = 'host_ip';
$v = new Virtualizor_Enduser_API($ip, $key, $pass);
$vid = 6710; //vpsid
$month = 201907;// year and month
$vps = $v->bandwidth($vid,$month);
print_r(json_encode($vps));
?>
Curl
curl -k -X POST -d "show=201907" -L "https://kvm.nuftp.com:4083/index.php?act=bandwidth&svs=6710&api=json&apikey=your_api_key&apipass=your_api_pass"
Output
{
"uid":"600",
"act":"bandwidth",
"timezone":2,
"timenow":"July 24, 2019, 1:15 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",
"bandwidth":{
"limit":0,
"used":806.9,
"usage":{
"20190717":516.77,
"20190718":67.01,
"20190719":35.49,
"20190720":55.58,
"20190721":35.59,
"20190722":37.17,
"20190723":35.56,
"20190724":23.73,
"20190725":0,
"20190726":0,
"20190727":0,
"20190728":0,
"20190729":0,
"20190730":0,
"20190731":0,
"20190801":0,
"20190802":0,
"20190803":0,
"20190804":0,
"20190805":0,
"20190806":0,
"20190807":0,
"20190808":0,
"20190809":0,
"20190810":0,
"20190811":0,
"20190812":0,
"20190813":0,
"20190814":0,
"20190815":0,
"20190816":0
},
"limit_gb":0,
"used_gb":0.79,
"in":{
"20190717":507.14,
"20190718":38.9,
"20190719":20.41,
"20190720":40.43,
"20190721":20.5,
"20190722":20.74,
"20190723":20.52,
"20190724":13.19,
"20190725":0,
"20190726":0,
"20190727":0,
"20190728":0,
"20190729":0,
"20190730":0,
"20190731":0,
"20190801":0,
"20190802":0,
"20190803":0,
"20190804":0,
"20190805":0,
"20190806":0,
"20190807":0,
"20190808":0,
"20190809":0,
"20190810":0,
"20190811":0,
"20190812":0,
"20190813":0,
"20190814":0,
"20190815":0,
"20190816":0
},
"out":{
"20190717":9.63,
"20190718":28.11,
"20190719":15.08,
"20190720":15.15,
"20190721":15.08,
"20190722":16.44,
"20190723":15.04,
"20190724":10.55,
"20190725":0,
"20190726":0,
"20190727":0,
"20190728":0,
"20190729":0,
"20190730":0,
"20190731":0,
"20190801":0,
"20190802":0,
"20190803":0,
"20190804":0,
"20190805":0,
"20190806":0,
"20190807":0,
"20190808":0,
"20190809":0,
"20190810":0,
"20190811":0,
"20190812":0,
"20190813":0,
"20190814":0,
"20190815":0,
"20190816":0
},
"yr_bandwidth":null,
"free":0,
"free_gb":0,
"percent":0,
"percent_free":100
},
"month":{
"yr":"2019",
"month":"07",
"mth_txt":"17 Jul 2019<br>16 Aug 2019",
"days":"31",
"prev":"201906",
"next":"201908"
},
"band":null,
"speed":null,
"time_taken":"1.945"
}