/server/get_statistics


GET https://api.sitehost.nz/1.2/server/get_statistics.json

Retrieves statistics for a server.

Query Parameters

ParameterTypeRequiredDescription
client_idintegerYesThe ID for the client that the server belongs to.Example: 1
server_namestringYesThe name of the server.Example: servername
typestringYesThe type of statistics to retrieve.Example: XenDiskUsage
options[start]stringThe starting timestamp.Example: 1459422000
options[end]stringThe ending timestamp.Example: 1461931200
options[item]stringThe specific item to return statistics for.Example: servername-data
options[compacted]integerReturn the data in a compacted form. 0 for false and 1 for trueExample: 1

Code Samples

JavaScript PHP Rails Python
var xmlHttp = new XMLHttpRequest();
xmlHttp.open("GET", "https://api.sitehost.nz/1.2/server/get_statistics.json?apikey=your_key_here&client_id=1&server_name=servername&type=XenDiskUsage&options[start]=1459422000&options[end]=1461931200&options[item]=servername-data&options[compacted]=1", false);

xmlHttp.send();

var response = xmlHttp.responseText;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.sitehost.nz/1.2/server/get_statistics.json?apikey=your_key_here&client_id=1&server_name=servername&type=XenDiskUsage&options[start]=1459422000&options[end]=1461931200&options[item]=servername-data&options[compacted]=1");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
require 'net/http'
require 'uri'

uri = URI.parse("https://api.sitehost.nz/1.2/server/get_statistics.json?apikey=your_key_here&client_id=1&server_name=servername&type=XenDiskUsage&options[start]=1459422000&options[end]=1461931200&options[item]=servername-data&options[compacted]=1")
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Get.new(uri.request_uri)

response = http.request(request)
import requests

uri = 'https://api.sitehost.nz/1.2/server/get_statistics.json?apikey=your_key_here&client_id=1&server_name=servername&type=XenDiskUsage&options[start]=1459422000&options[end]=1461931200&options[item]=servername-data&options[compacted]=1'

response = requests.get(uri)

Response

200:

application/json
{
  "return": {
      "start": 1461192600,
      "end": 1461196800,
      "step": 300,
      "debug_start": "2016-04-21 10:50:00",
      "debug_end": "2016-04-21 12:00:00",
      "data": {
          "seconds": {
              "name": "seconds",
              "values": "0.93666666666667,0.033333333333333,0,0.94,0.066666666666667,0.95333333333333,0.063333333333333,0,0.93,0.036666666666667,0.93,1,1"
          },
          "percent": {
              "name": "percent",
              "values": "0.1,0.1,0.1,0.1,0.19333333333333,0.10466666666667,0.1,0.1,0.1,0.1,0.1,0.195,0.105"
          }
      }
  },
  "msg": "Successful",
  "status": true
}