The TimeInZoneByFenceReport method returns the same results as /TimeInZoneReport, but selects its zones by GeofenceId instead of by AlertId, and reports each zone as a GeofenceId/GeofenceName instead of an AlertId/AlertName.
Use this method when you want to report on a Geofence directly. /TimeInZoneReport resolves its zones through Alerts, so a zone is only reportable there if an Alert has been set up on it and that Alert is still active. This method reads the Geofences themselves, so a zone with no Alert attached Á or whose Alert has since been deactivated Á still reports.
The 'fences' parameter takes GeofenceIds, which are NOT AlertIds. The two are separate ID sequences, and passing one where the other is expected will silently select the wrong zone or no zone at all. The AlertIds accepted by /TimeInZoneReport come from /ZoneAlert.
The optional 'Interpolate' parameter behaves identically to /TimeInZoneReport: it is TRUE by default, and when true the API will look at data just prior to and after the specified window to give larger Time In Zone windows.
The following datatype will be JSONified and returned for methods which retrieve values. (NOTE: if param FOBBased = true, three more fields return: Driver, EIN, FOB#)
This is the /TimeInZoneReport datatype with the zone reported as GeofenceId and GeofenceName in place of AlertId and AlertName. Every other field is unchanged.
| public | UInt64 | AccountId; | // The AccountId associated with the Device |
| public | UInt64 | DeviceId; | // The DeviceId (Serial#) associated with the Device |
| public | String | DeviceName; | // The Device Name matched with the DeviceID |
| public | UInt64 | GeofenceId; | // The GeofenceId (aka ZoneID / PolyfenceID) of the Geofence/Radius Zone. This is NOT an AlertId. |
| public | String | GeofenceName; | // The name of the Geofence/Radius Zone |
| public | DateTime | Entered; | // The time the Device ENTERED the Geofence/Radius Zone |
| public | DateTime? | Exited; | // The time the Device EXITED the Geofence/Radius Zone. NOTE: If the device has not yet exited the ZONE at time of report, this will return NULL but TOTAL TIME will reflect time 'up to the END DATE PARAMETER of the report' |
| public | UInt64 | TotalSeconds; | // The total SECONDS in zone. |
| public | Int32 | MinSatelliteCount; | // The smallest SAT count in the Zone results - low values suggest there could be GPS Drift and you may want to manually review this result |
The following list provides a reference for all valid /TimeInZoneByFenceReport HTTP requests.
Summary: Retrieve a report that is run immediately and returned as soon as possible. These reports are typically limited to a small range or timespan.
Returns:
Parameters:
- id: The AccountId associated with API caller (FromUri)
- from: The DateTime to begin report. If no FROM/TO dates passed in, default is last 24 hours. (FromUri)
- to: The DateTime to end report. If no FROM/TO dates passed in, default is last 24 hours. (FromUri)
- devices: A comma-separated list of DeviceIds to lookup for a report. If this is not specified, reports will run for all devices visible to the account. (FromUri)
- UTCoffset: (Optional) UTC offset to return results in. Default is CENTRAL TIME. (see https://24timezones.com/time-zones for example strings: "UTC-6" for minus 6 or "UTC%2b6" for plus 6) (FromUri)
- fences: A comma-separated list of GeofenceIds (aka ZoneIDs / PolyfenceIDs) to lookup for a report. These are NOT AlertIds - see the TimeInZoneReport endpoint if you want to report by alert. If this is not specified, reports will run for all Geofences visible to the account. (FromUri)
- interpolate: (Optional, true by default) This option 'interpolates' time in zone by looking at data before and after the specified windows. (FromUri)
- CompletedResultSets: (Optional) When TRUE, only records whose ENTERED/EXIT times fall within the API's START and END times are returned. Default is FALSE. (FromUri)
- account: (Optional) If this parameter is included, the method will be run on behalf of the specified child Account (if valid). (FromUri)
- fobBased: (Optional) If this bool parameter is set to TRUE, the method will return some additional result elements: Driver, Driver EIN and FOB. This option is for FOB drivers only. (FromUri)