Skip to main content

usagestatistics

Get  Eenos Accounts usage metrics

To  get all Eenos hosting accounts  usage metrics via api. This will returns account information , bandwidth usage  and diskusage

Required Parameters

Field Description Example
apiuser API user  name eenos_api
apiauth API  user password eenos123

Status  Codes

Code Description
200 OK, Success
500 Server Error
403 Forbidden 
400 Bad request

Request URL

Post url  = /usagestatistics/

Default Full URL =  https://your-host-name:5555/api/usagestatistics/

Version Full URL =  https://your-host-name:5555/api/v1/usagestatistics/

Sample Curl Code

#!/bin/bash
REQUEST_URL="/usagestatistics/"
BASE_URL="https://your-host-name:5555/api/v1"
# Default base url
# BASE_URL="https://your-host-name:5555/api"
# Version specific base url
# BASE_URL="https://your-host-name:5555/api/v1"
API_URL="$BASE_URL$REQUEST_URL"
/usr/bin/curl -X POST $API_URL \
    -d "apiuser=eenos_api" \
    -d "apiauth=eenos123" 

Sample Output

{
   "data" : {
      "accounts" : {
         "a111user" : {
            "addondomains" : "unlimited",
            "bandwidth" : "1048576",
            "contactemail" : "sdsd@sdsds.com",
            "dedicatedip" : {
               "ipv4" : "x.x.x.x",
               "ipv6" : "x:x:x:x:bbbb:0000:0000:x",
               "status" : "off",
               "status6" : "on"
            },
            "dkim" : "off",
            "domain" : "0000testongfor.com",
            "email" : "unlimited",
            "feature" : "Xls",
            "ftp" : "unlimited",
            "homedir" : "/home/a111user",
            "is_reseller" : "yes",
            "is_suspended" : "no",
            "language" : "en",
            "maillist" : "unlimited",
            "mailquota" : "unlimited",
            "mailserver" : "remote",
            "nameservers" : [
               "dns.a.com",
               "ns2.b.com",
               "ns3.c.com"
            ],
            "owner" : "root",
            "package" : "AoneHost",
            "parkeddomains" : "unlimited",
            "quota" : "unlimited",
            "reseller" : {
               "selfown" : "on",
               "status" : "on"
            },
            "setuptime" : "2021-01-24 00:44",
            "shell" : {
               "shell" : "/bin/bash",
               "status" : "on"
            },
            "spf" : "on",
            "sql" : "unlimited",
            "subdomains" : "unlimited",
            "theme" : "default",
            "user" : "a111user",            
            "quota_usage": 10234,
            "bandwidth_usage": 5545
         },
        "sysvm" : {
            "addondomains" : "0",
            "bandwidth" : "1048576",
            "contactemail" : "asa@sysvm.com",
            "dedicatedip" : {
               "ipv4" : "x.x.x.204",
               "ipv6" : "x:x:x:2093:bbbb:0000:0000:002a",
               "status" : "off",
               "status6" : "on"
            },
            "dkim" : "on",
            "domain" : "sysvm.net",
            "email" : "0",
            "feature" : "Default",
            "ftp" : "0",
            "homedir" : "/home/sysvm",
            "is_reseller" : "no",
            "is_suspended" : "no",
            "language" : "en",
            "maillist" : "0",
            "mailquota" : "0",
            "mailserver" : "local",
            "nameservers" : [
               "ns1.as.com",
               "ns2.as.com"
            ],
            "owner" : "sysvm",
            "package" : "100Gb",
            "parkeddomains" : "0",
            "quota" : "102404",
            "reseller" : {
               "selfown" : "off",
               "status" : "off"
            },
            "setuptime" : "2021-06-27 01:12",
            "shell" : {
               "shell" : "/bin/bash",
               "status" : "on"
            },
            "spf" : "on",
            "sql" : "0",
            "subdomains" : "0",
            "theme" : "default",
            "user" : "sysvm",            
            "quota_usage": 10234,
            "bandwidth_usage": 5545
         }
      }
   },
   "info" : "Return eenos hosting accounts",
   "status" : 200
}

Python Code
#!/usr/bin/python3
import requests
from pprint import pprint
# The API request url
request_url='/usagestatistics/'
# The server api base url
base_url='https://your-host-name:5555/api'
# Default  base url
# base_url='https://your-host-name:5555/api'
# Version specific base url
# base_url='https://your-host-name:5555/api/v1'
# The api url 
api_ulr=base_url+request_url
# The data in dictionary format
data={
    'apiuser': 'eenos_api',
    'apiauth':'eenos123',        
}
try:   
    result=requests.post(api_ulr, data = data)
    pprint(result.json())
except Exception as e:
    pprint(str(e))
    pass
PHP Code
<?php
// The API request url
$request_url='/usagestatistics/';
// Your server API base url
$base_url='https://your-host-name:5555/api';
// Default base url
// $base_url='https://your-host-name:5555/api';
// Version specific base url
// $base_url='https://your-host-name:5555/api/v1';
// The FULL API URL
$api_url=$base_url.$request_url;
//The data you want to send via POST
$fields= [
    'apiuser'   =>  'eenos_api',
    'apiauth'   =>  'eenos123',    
];
//url-ify the data for the POST
$fields_string = http_build_query($fields);
//open connection
$ch = curl_init();
//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL, $api_url);
curl_setopt($ch,CURLOPT_POST, true);
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
//So that curl_exec returns the contents of the cURL; rather than echoing it
curl_setopt($ch,CURLOPT_RETURNTRANSFER, true); 
//execute post
$result = curl_exec($ch);
//Print the json result
echo json_encode(json_decode($result), JSON_PRETTY_PRINT);
?>