REST API description: Difference between revisions

Jump to navigation Jump to search
Line 217: Line 217:
Requests can be given a time interval. If present, the '''interval''' counters are adjusted to this interval.  The following GET parameters are necessary:
Requests can be given a time interval. If present, the '''interval''' counters are adjusted to this interval.  The following GET parameters are necessary:
* '''starttime''', '''endtime''': Start and end time of the interval. Format: seconds since 1970/01/01 UTC (Unix time, epoch). You can use <code>date +%s</code> on your machine to adjust to the best interval. Please consult the man page of date for more parameters.
* '''starttime''', '''endtime''': Start and end time of the interval. Format: seconds since 1970/01/01 UTC (Unix time, epoch). You can use <code>date +%s</code> on your machine to adjust to the best interval. Please consult the man page of date for more parameters.
* '''history''': shall the JSON include the history graph if available, can be false/true default: true
* '''skiphistorydata''': shall the JSON include the history data without datasets, this reduces the amount of transferred bytes if datasets are required to render a graph, can be false/true default: false
* '''skiphistorydata''': shall the JSON include the history data without datasets, can be false/true default: true
* '''timespan''': required resolution for the graph dataset
* '''timespan''': required resolution for the graph dataset


This example extracts the amount of received and transmitted bytes for an IP address for the last 24 hours.
This example extracts the amount of received and transmitted bytes for an IP address for the last 24 hours.
<pre>
<pre>
$ curl --silent -k -u 'admin:allegro'  "https://allegro-mm/API/stats/modules/ip/ips/10.54.0.254?starttime=$(date --date="1 day ago" +%s)&endtime=$(date +%s)" | jq '.interval[1] + .interval[3]'
$ curl --silent -k -u 'admin:allegro'  "https://allegro-mm/API/stats/modules/ip/ips/10.54.0.254?starttime=$(date --date="1 day ago" +%s)&endtime=$(date +%s)&skiphistorydata=true" | jq '.interval[1] + .interval[3]'
216087873
216087873
</pre>
</pre>
404

edits

Navigation menu