Self Help Documentation
< All Topics

server/listresourceusage

Description

Lists server resource usage of all created SPanel user accounts for a given date.

Parameters

Additional parameters:

FieldTypeRequiredDescription
tokenstringYesAuthorizing API token – check API Basics for more information.
actionstringYesThe category and function being executed.
datestringNoRequired if “type” is “daily” or not set. Date to look resource usage for. Format: m/d/Y.
typestringNoType of data requested. Accepted values: “daily”, “weekly” or “monthly”. Defaults to “daily”.
weekstringNoRequired if “type” is set to “weekly”. Week number to look data for.
yearstringNoRequired if “type” is set to “weekly” or “monthly”. Year to look data for.
monthstringNoRequired if “type” is set to “monthly”. Format: 1 to 12. Month to look data for.

Example

$endpointUrl = 'https://123.123.123.123/spanel/api.php';

$postData = [
  'token' => 'provided_auth_token', // Check API Basics for more information
  'action' => 'server/listresourceusage',
  'username' => '[email protected]',
  //'date' => '3/1/2022' //1st of March 2022
  //'type' => 'daily' //Possible values: daily, weekly, monthly
  //'week' => '34' //Number of week to look data for
  //'year' => '2024' //Year to look data for - only for "weekly" or "monthly" type.
  //'month' => '12' //Month to look data for (1 - 12). Required if "type" is set to "monthly"
];

$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, $endpointUrl);
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt( $ch, CURLOPT_POST, true);
curl_setopt( $ch, CURLOPT_POSTFIELDS, http_build_query($postData));
curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, false);
$jsonOutput = curl_exec( $ch );Code language: PHP (php)

Output

{
    "result": "success",
    "data": [
        {
            "username": "spanelio",
            "cpuusage": 3.05,
            "ramusage": 1.22
        },
        {
            "username": "testdomaincom",
            "cpuusage": 2.14,
            "ramusage": 0.82
        }
    ]
}Code language: JSON / JSON with Comments (json)
Table of Contents