/bandwidth/get_usage_by_month
GET https://api.sitehost.nz/1.0/bandwidth/get_usage_by_month.json
Gets bandwidth usage of an IP address for a specific month.
Query Parameters
Parameter | Type | Required | Description |
client_id | integer | Yes | The ID for the client.Example: 1 |
ip_addr | string | Yes | The IP address.Example: 192.168.10.1/32 |
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.0/bandwidth/get_usage_by_month.json?apikey=your_key_here&client_id=1&ip_addr=192.168.10.1%2F32¶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.0/bandwidth/get_usage_by_month.json?apikey=your_key_here&client_id=1&ip_addr=192.168.10.1%2F32¶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.0/bandwidth/get_usage_by_month.json?apikey=your_key_here&client_id=1&ip_addr=192.168.10.1%2F32¶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.0/bandwidth/get_usage_by_month.json?apikey=your_key_here&client_id=1&ip_addr=192.168.10.1%2F32¶ms[from]=1461131200¶ms[to]=1461931200'
response = requests.get(uri)
Response
200:application/json
{
"return": {
"192.168.10.1/32": {
"2014-05-16": {
"DOMESTIC": {
"peak_in": 0,
"offpeak_in": 0,
"peak_out": 0.1436,
"offpeak_out": 0
},
"INTERNATIONAL": {
"peak_in": 0,
"offpeak_in": 0,
"peak_out": 0,
"offpeak_out": 0
}
},
"2014-05-23": {
"DOMESTIC": {
"peak_in": 0,
"offpeak_in": 0,
"peak_out": 1.0049,
"offpeak_out": 0
},
"INTERNATIONAL": {
"peak_in": 0,
"offpeak_in": 0,
"peak_out": 0,
"offpeak_out": 0
}
}
}
},
"msg": "Successful",
"status": true,
"time": 137.77
}
"return": {
"192.168.10.1/32": {
"2014-05-16": {
"DOMESTIC": {
"peak_in": 0,
"offpeak_in": 0,
"peak_out": 0.1436,
"offpeak_out": 0
},
"INTERNATIONAL": {
"peak_in": 0,
"offpeak_in": 0,
"peak_out": 0,
"offpeak_out": 0
}
},
"2014-05-23": {
"DOMESTIC": {
"peak_in": 0,
"offpeak_in": 0,
"peak_out": 1.0049,
"offpeak_out": 0
},
"INTERNATIONAL": {
"peak_in": 0,
"offpeak_in": 0,
"peak_out": 0,
"offpeak_out": 0
}
}
}
},
"msg": "Successful",
"status": true,
"time": 137.77
}