/bandwidth/get_usage_summary
GET https://api.sitehost.nz/1.2/bandwidth/get_usage_summary.json
Gets summary bandwidth usage for a specific client.
Query Parameters
Parameter | Type | Required | Description |
client_id | integer | Yes | The ID for the client.Example: 1 |
params[from] | string | The from timestamp.Example: 1461131200 | |
params[to] | string | The to timestamp.Example: 1461931200 |
Code Samples
JavaScript PHP Rails Pythonvar xmlHttp = new XMLHttpRequest();
xmlHttp.open("GET", "https://api.sitehost.nz/1.2/bandwidth/get_usage_summary.json?apikey=your_key_here&client_id=1¶ms[from]=1461131200¶ms[to]=1461931200", false);
xmlHttp.send();
var response = xmlHttp.responseText;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.sitehost.nz/1.2/bandwidth/get_usage_summary.json?apikey=your_key_here&client_id=1¶ms[from]=1461131200¶ms[to]=1461931200");
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/bandwidth/get_usage_summary.json?apikey=your_key_here&client_id=1¶ms[from]=1461131200¶ms[to]=1461931200")
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/bandwidth/get_usage_summary.json?apikey=your_key_here&client_id=1¶ms[from]=1461131200¶ms[to]=1461931200'
response = requests.get(uri)
Response
200:application/json
{
"return": {
"192.168.1.0/24": {
"2014-01": {
"DOMESTIC": {
"peak_in": 173270396.2743,
"offpeak_in": 0,
"peak_out": 46398296.3977,
"offpeak_out": 0
},
"INTERNATIONAL": {
"peak_in": 73447.4766,
"offpeak_in": 0,
"peak_out": 137624.0459,
"offpeak_out": 0
}
},
"2014-02": {
"DOMESTIC": {
"peak_in": 293596231.5575,
"offpeak_in": 0,
"peak_out": 49859257.4444,
"offpeak_out": 0
},
"INTERNATIONAL": {
"peak_in": 0,
"offpeak_in": 0,
"peak_out": 0,
"offpeak_out": 0
}
},
"2014-03": {
"DOMESTIC": {
"peak_in": 344532253.0811,
"offpeak_in": 0,
"peak_out": 72076356.1425,
"offpeak_out": 0
},
"INTERNATIONAL": {
"peak_in": 2789.5527,
"offpeak_in": 0,
"peak_out": 210.8535,
"offpeak_out": 0
}
}
},
"192.168.11.12/32": {
"2014-01": {
"DOMESTIC": {
"peak_in": 111521.4014,
"offpeak_in": 0,
"peak_out": 29815.5888,
"offpeak_out": 0
},
"INTERNATIONAL": {
"peak_in": 11.3887,
"offpeak_in": 0,
"peak_out": 14.1025,
"offpeak_out": 0
}
},
"2014-02": {
"DOMESTIC": {
"peak_in": 148465.3603,
"offpeak_in": 0,
"peak_out": 30848.2315,
"offpeak_out": 0
},
"INTERNATIONAL": {
"peak_in": 0,
"offpeak_in": 0,
"peak_out": 0,
"offpeak_out": 0
}
}
}
},
"msg": "Successful",
"status": true
}
"return": {
"192.168.1.0/24": {
"2014-01": {
"DOMESTIC": {
"peak_in": 173270396.2743,
"offpeak_in": 0,
"peak_out": 46398296.3977,
"offpeak_out": 0
},
"INTERNATIONAL": {
"peak_in": 73447.4766,
"offpeak_in": 0,
"peak_out": 137624.0459,
"offpeak_out": 0
}
},
"2014-02": {
"DOMESTIC": {
"peak_in": 293596231.5575,
"offpeak_in": 0,
"peak_out": 49859257.4444,
"offpeak_out": 0
},
"INTERNATIONAL": {
"peak_in": 0,
"offpeak_in": 0,
"peak_out": 0,
"offpeak_out": 0
}
},
"2014-03": {
"DOMESTIC": {
"peak_in": 344532253.0811,
"offpeak_in": 0,
"peak_out": 72076356.1425,
"offpeak_out": 0
},
"INTERNATIONAL": {
"peak_in": 2789.5527,
"offpeak_in": 0,
"peak_out": 210.8535,
"offpeak_out": 0
}
}
},
"192.168.11.12/32": {
"2014-01": {
"DOMESTIC": {
"peak_in": 111521.4014,
"offpeak_in": 0,
"peak_out": 29815.5888,
"offpeak_out": 0
},
"INTERNATIONAL": {
"peak_in": 11.3887,
"offpeak_in": 0,
"peak_out": 14.1025,
"offpeak_out": 0
}
},
"2014-02": {
"DOMESTIC": {
"peak_in": 148465.3603,
"offpeak_in": 0,
"peak_out": 30848.2315,
"offpeak_out": 0
},
"INTERNATIONAL": {
"peak_in": 0,
"offpeak_in": 0,
"peak_out": 0,
"offpeak_out": 0
}
}
}
},
"msg": "Successful",
"status": true
}