Next revision | Previous revision |
ezeio2:apiref:syslog [2019-06-16 22:52] – created andreh | ezeio2:apiref:syslog [2021-09-24 23:04] (current) – andreh |
---|
===== API reference ====== | |
| |
==== syslog ==== | ==== syslog ==== |
| |
=== Description === | === Description === |
| |
<code>https://api.eze.io/v1/syslog/{serial}/from={datetime}/to={datetime}/[fields]/[interval[,aggregation]]/["raw"]</code> | <code>https://api.eze.io/v1/syslog/{serial}/from={datetime}/[to={datetime}]/[fields]/[interval[,aggregation]]/["raw"]</code> |
| |
| |
| |
| ''serial'' | The serial number of the ezeio (XYZ987) | | | ''serial'' | The serial number of the ezeio (XYZ987) | |
| ''from=datetime'' | The beginning of the range. Format per RFC3339. | | | ''from=datetime'' | The beginning of the range. Format per RFC3339 or 1d/1h/1m | |
| ''to=datetime'' | The end of the range. Format per RFC3339. | | | ''to=datetime'' | The end of the range. Format per RFC3339. If not given, current time is assumed.| |
| ''fields'' (optional) | Comma separated list of fields. Possible fields are 1-90, GPSx, GPSy, GPSz, GPSsignal. If not given, all fields are returned. | | | ''fields'' (optional) | Comma separated list of fields. Possible fields are 1-90, GPSx, GPSy, GPSz, GPSsignal. If not given, all fields are returned. | |
| ''interval'' (optional) | Sample interval. Given as a number followed by 'd', 'h' or 'm' for day, hour or minute. | | | ''interval'' (optional) | Sample interval. Given as a number followed by 'd', 'h' or 'm' for day, hour or minute. | |
| ''aggregation'' (optional) | Method of aggregation. Only valid if interval is given. | | | ''aggregation'' (optional) | Method of aggregation. Only valid if interval is given. | |
| ''"raw"'' (optional) | Only return values actually stored in database. | | | ''"raw"'' (optional) | Only return values actually stored in database. | |
| |
| The ''from'' parameter can be given as number of minutes/hours/days relative to current time. For example ''from=17h'' means "17 hours ago". |
| |
If no interval is given, an automatic interval will be calculated based on the size of the range. This is to ensure the amount of data returned is reasonable. | If no interval is given, an automatic interval will be calculated based on the size of the range. This is to ensure the amount of data returned is reasonable. |
If range >= 7 days, interval will be 1 hour.\\ | If range >= 7 days, interval will be 1 hour.\\ |
For smaller ranges than 7 days, the interval will be 10 minutes. | For smaller ranges than 7 days, the interval will be 10 minutes. |
| |
| Under no circumstances will the call return more than 5000 rows of data. |
| |
Aggregation modes: | Aggregation modes: |
''min'' : The smallest value\\ | ''min'' : The smallest value\\ |
''max'' : The largest value\\ | ''max'' : The largest value\\ |
''sum'' : The sum of all samples in the interval | ''sum'' : The sum of all samples in the interval\\ |
| ''spread'' : The difference between the highest and the lowest value in the interval\\ |
| ''count'' : The number of samples in the interval |
| |
=== Example usage === | === Example usage === |
Specifying fields: | Specifying fields: |
<code>https://api.eze.io/v1/syslog/XYS987/from=2018-10-05T06:30:00Z/to=2018-10-06T06:30:00Z/fields=2,4,12,GPSx,GPSy</code> | <code>https://api.eze.io/v1/syslog/XYS987/from=2018-10-05T06:30:00Z/to=2018-10-06T06:30:00Z/fields=2,4,12,GPSx,GPSy</code> |
| |
| Available fields are: |
| |
| | ''#'' | Field # value, where # is an integer, 1-90 | |
| | ''ADC#'' | Raw ADC reading, where # is 0-10. 8=DC in, 9=Terminal DC, 10=5V terminal | |
| | ''out#'' | Raw output status, where # is 0, 1, 2 or 3 | |
| | ''fRunning'' | 1=Logic running. 0=Logic halted | |
| | ''ethComm'' | 1=Ethernet connection available. 0=No Ethernet connection | |
| | ''ethLink'' | 1=Ethernet link availabe. 0=No Ethernet link | |
| | ''GPSx'' | Location x-coordinate (latitude) | |
| | ''GPSy'' | Location y-coordinate (longitude) | |
| | ''GPSz'' | Location z-coordinate (elevation) | |
| | ''GPSsignal'' | GPS received signal | |
| | ''gpsLock'' | 1=GPS received has locked in signals from the satellites. 0=no lock | |
| | ''groupid'' | The group ID associated with this unit | |
| | ''uptime'' | Uptime in seconds | |
| | ''gsmComm'' | 1=Cellular data connection established. 0=No cellular data| |
| | ''gsmLink'' | 1=Cellular service found. 0=No cell service | |
| | ''gsmNet'' | 1=Cellular IP acquired. 0=No connection | |
| | ''cID'' | Cell tower ID | |
| | ''cLAC'' | Cell location area code | |
| | ''cMCC'' | Cell network MCC | |
| | ''cMNC'' | Cell network MNC | |
| | ''cRSSI'' | Cell received signal level | |
| |
Hourly max values: | Hourly max values: |
| |
<code javascript> | <code javascript> |
| |
| Example query: |
| https://api.eze.io/v1/syslog/baa157/from=2019-02-01/to=2019-03-01/fields=1,2 |
| |
{ | { |
"reqtime":"2019-06-16T22:51:49Z", | "reqtime":"2019-06-16T22:51:49Z", |
| "fieldmeta":[ |
| { |
| "no":"1", |
| "name":"Uptime", |
| "tag":"", |
| "decimals":"0", |
| "unit":"s" |
| }, |
| { |
| "no":"2", |
| "name":"Temperature", |
| "tag":"temp", |
| "decimals":"1", |
| "unit":"°C" |
| } |
| ] |
"data":[ | "data":[ |
{ | { |
"f2":25.709999 | "f2":25.709999 |
}, | }, |
// ----- Entries removed | // ** Entries removed for brevity ** |
{ | { |
"time":"2019-02-28T22:00:00Z", | "time":"2019-02-28T22:00:00Z", |
"f1":786047.1666666666, | "f1":786047.1666666666, |
"f2":25.016666666666666 | "f2":25.016666666666666 |
},{"time":"2019-02-28T23:00:00Z","f1":789648,"f2":25.151667000000003}],"status":"OK","exec_time":0.030946969985961914} | }, |
| { |
| "time":"2019-02-28T23:00:00Z", |
| "f1":789648, |
| "f2":25.151667000000003 |
| } |
], | ], |
"status":"OK", | "status":"OK", |