List alert history

Service version: 1
Last edit: 2022.09.01

Purpose

This endpoint lists Alerts that have been triggered in the given time range.

Request data

HTTPS method: GET

  • Constants and parameters enclosed in curly brackets { } must be replaced with their values.
  • Please see the following Request parameters section with the required and optional parameters tables for their values. The generic request format is as follows.

URL request format

https://{baseURL}/geofencing/{versionNumber}/alerts/history?key={Your_API_Key}&from={timestamp}&to={timestamp}&alertType={string}&maxResults={integer}&pageNumber={integer}

curl command request format

curl 'https://{baseURL}/geofencing/{versionNumber}/alerts/history?key={Your_API_Key}&from={timestamp}&to={timestamp}&alertType={string}&maxResults={integer}&pageNumber={integer}'

Request parameters

The following table describes the parameters that can be used in a request.

  • Required parameters must be used or the call will fail.
  • Optional parameters may be used.
  • The order of request parameters is not important.

Required parameters

Description

baseURL
string

The base URL for calling the API.
Value: api.tomtom.com

versionNumber
string

Service version.
Value: 1

key
string

An API Key valid for the requested service.
Value: Your valid API Key.

from
timestamp

The beginning date for a listing.
Value: ISO 8601 format timestamp with the accuracy of seconds (YYYY-MM-DDThh:mm:ss).

Optional parameters

Description

to
timestamp

End date for the listing.
Value: ISO 8601 format timestamp with the accuracy of seconds (YYYY-MM-DDThh:mm:ss).

alertType
string

Type of the Alert to filter by.
Value: TRANSITION, DWELL, OBJECT_COUNT, PROXIMITY, or ALL
Default value: ALL.

maxResults
integer

Maximum number of items returned in the response.
Value: Greater than zero, less than or equal to 100.
Default value: 100

pageNumber
integer

The number of items page to be returned in the response. The maximum number of elements on the page is equal to the maxResults value.
Value: Greater than zero.
Default value: 1

Response data

Response body

1{
2 "summary": {
3 "from": "ISO8601_timestamp",
4 "to": "ISO8601_timestamp"
5 },
6 "alerts": [
7 {
8 "id": "uuid_string",
9 "name": "name_of_the_alert",
10 "object": "uuid_string",
11 "fence": "uuid_string",
12 "project": "uuid_string",
13 "alertType": "type_of_the_alert",
14 "details": {
15 "key": "value"
16 }
17 }
18 ],
19 "resultInfo": {
20 "maxResults": number,
21 "pageNumber": number,
22 "itemsCount": number
23 }
24}

Response fields

The following table describes all of the fields that can appear in a response.

Primary fields

Field

Description

summary
object

Contains information about the Alert History request.

alerts
array (alert)

Array of historical Alerts.

resultInfo
object

Contains information about response paging.

summary object

Field

Description

from
string

Timestamp (ISO 8601 format) marking the start of a period the report is generated for.

to
string

Timestamp (ISO 8601 format) marking the end of a period the report is generated for.

alerts array

Field

Description

id
string

The UUID of the historical Alert.

name
string

The name of the Alert.

object
string

UUID of an Object that triggered an Alert.

fence
string

UUID of a Fence that triggered an Alert.

project
string

UUID of an Project for which the Alert was triggered.

alertType
string

Type of the Alert that was triggered.

details
object

Contains information about a specific Alert.

details object

Field

Description

transitionType
string

Type of the Transition that triggered an Alert.
This field exists for the "TRANSITION" Alert type.

maxDwellTime
integer

Time limit that triggered an Alert.
This field exists for the "DWELL" Alert type.

estimatedDwellTime
integer

Estimated dwell time of an Object in a Fence.
This field exists for the "DWELL" Alert type.

maxObjectCount
integer

Object count limit that triggered an Alert.
This field exists for the "OBJECT_COUNT" Alert type.

currentObjectCount
integer

Current number of Objects in a Fence.
This field exists for the "OBJECT_COUNT" Alert type.

proximityDistance
integer

Proximity distance limit that triggered an Alert. The value is expressed in meters.
This field exists for the "PROXIMITY" Alert type.

currentDistance
integer

Current distance of the Object to the Fence. The value is expressed in meters.
This field exists for the "PROXIMITY" Alert type.

proximitySide
string

Side of the fence in which the proximity was measured.
This field exists for the "PROXIMITY" Alert type.

resultInfo object

Field

Description

maxResults
integer

Maximum number of items returned in the response.

pageNumber
integer

Number of the items page to be returned in the response. The maximum number of elements on the page is equal to the maxResults value.

itemsCount
integer

Number of returned items on the page.

HTTP response codes

Code

Meaning & possible causes

200

OK

400

Bad Request: The value of the parameter is not a positive decimal number.

Example

List all of the Transition Alerts triggered between 2019-08-29 10:00:00 and 2019-08-29 16:00:00.

URL request example

https://api.tomtom.com/geofencing/1/alerts/history?key=PJD7y0G5AFj9Jiok6F0tIK16NiWYotb3&from=2019-08-29T10:00:00&to=2019-08-29T16:00:00&alertType=TRANSITION&maxResults=3&pageNumber=1

Response body example

1{
2 "summary": {
3 "from": "2019-08-29T10:00:00",
4 "to": "2019-08-29T16:00:00"
5 },
6 "alerts": [
7 {
8 "id": "6141c4be-0877-4fa6-bc25-37618a80f6d3",
9 "name": "Drone flew out of safe zone",
10 "object": "b95ca74e-5f67-4c2d-9c80-b589fee3227a",
11 "fence": "e487153c-a08f-480f-8037-a9770a9a2ab9",
12 "project": "51192c51-9255-41c6-9d36-93efde94a180",
13 "alertType": "TRANSITION",
14 "alertRuleConstraints": {
15 "transitionType": "EXIT"
16 }
17 }
18 ],
19 "resultInfo": {
20 "maxResults": 100,
21 "pageNumber": 1,
22 "itemsCount": 1
23 }
24}