Update alert rule partially

Service version: 1
Last edit: 2022.09.01

Purpose

This endpoint is used to partially update an Alert Rule.

Request data

HTTPS method: PATCH

  • 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

patch
URL request format
https://{baseURL}/geofencing/{versionNumber}/alerts/rules/{ruleId}?key={Your_API_Key}&adminKey={Your_Admin_Key}

curl command request format

patch
curl command request format
1curl -XPATCH -d '{
2 "enabled": true
3}'
4'https://{baseURL}/geofencing/{versionNumber}/alerts/rules/{ruleId}?key={Your_API_Key}&adminKey={Your_Admin_Key}'

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.

Note: There are no optional parameters in this endpoint.

Required parameters

Description

baseURL
string

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

versionNumber
string

Service version.
Value: 1

ruleId
string

The UUID of the Alert Rule.

key
string

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

adminKey
string

An Admin Key valid for the provided API Key.
Value: Your valid Admin Key.

PATCH request body

patch
PATCH request body format - JSON
1{
2 "enabled": true
3}

Request fields

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

Primary fields

Description

enabled
boolean

The Boolean value that says if an Alert Rule is enabled or not.
Values:

  • true: An Alert is enabled.

  • false: An Alert is disabled.


Default value: The previous value.

Response data

Response body

Response body format - JSON
1{
2 "id": "The id of the alert rule",
3 "name": "The name of the alert rule",
4 "object": "The id of the object",
5 "project": "The id of the project",
6 "fence": "The id of the fence",
7 "alertType": "Type of the alert",
8 "alertRuleConstraints": {
9 "key": "value"
10 },
11 "notificationGroup": "The id of the notification group",
12 "enabled": true
13}

Response fields

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

Primary fields

Field

Description

id
string

The UUID of the Alert Rule.

name
string

The name of the Alert Rule.

object
string

The UUID of the Object or * for any Object in the Configuration.

project
string

The UUID of the Project or * for any Project in the Configuration.

fence
string

The UUID of the Fence or * for any Fence in the Configuration.

alertType
string

The type of the Alert Rule.
Possible values:

  • "TRANSITION": When an Object entered or exited Fence.

  • "DWELL": When an Object stays too long inside a Fence.

  • "OBJECT_COUNT": When the maximum number of Objects in a Fence is exceeded.

  • "PROXIMITY": When the distance between an Object and a Fence is smaller than the provided threshold.

alertRuleConstraints
object

Contains information about a specific Alert Rule.

notificationGroup
string

The UUID of the owned group in the Notification Service to send the Alert Rule.

enabled
boolean

The Boolean value that says if an Alert Rule is enabled or not.
Values:

  • true - An Alert is enabled

  • false - An Alert is disabled

alertRuleConstraints object

Field

Description

transitionType
string

The type of the Transition to Alert.
Possible values:

  • "ENTER": When an Object just entered the Fence.

  • "EXIT": When an Object just exited the Fence.

  • "ALL": When an Object just entered or exited the Fence.


This field exists for the "TRANSITION" Alert type.

maxDwellTime
integer

Maximum time (in seconds) an Object can stay inside a Fence before an Alert is raised.
This field exists for the "DWELL" Alert type.

maxObjectCount
integer

Maximum number of Ojects that can be present in a Fence at one time before an Alert is raised.
This field exists for the "OBJECT_COUNT" Alert type.

proximityDistance
integer

Distance from the fence within which the alarm will be triggered. The value is expressed in meters.
This field exists for the "PROXIMITY" Alert type.

proximitySide
string

Side of the fence in which the proximity will be measured.
Possible values:

  • "INSIDE": When proximity will be measured inside a Fence.

  • "OUTSIDE": When proximity will be measured outside a Fence.


This field exists for the "PROXIMITY" Alert type.

Response codes

Code

Meaning & possible causes

200

OK

400

Bad request:

  • Field "enabled" is not provided.

403

Forbidden:

  • Provided Admin Key is invalid.
  • Admin Key is missing.

Example

Partially update the Alert Rule

URL request example

patch
URL request example
https://api.tomtom.com/geofencing/1/alerts/rules/bf40406b-1d8d-4218-bcf2-e67b83063d02?key=nQRhDX5saL2KM0dIzEfeX2lcxWk9ktT2qXDZpwCr&adminKey=QekKaqqCHBpFLPCeViVS

PATCH body request example

patch
PATCH body request example - JSON
1{
2 "enabled": false
3}

Response body example

Response body example - JSON
1{
2 "id": "bf40406b-1d8d-4218-bcf2-e67b83063d02",
3 "name": "Airport transition alert",
4 "project": "47b10143-0b43-4803-a931-98cb1e595520",
5 "fence": "*",
6 "object": "fc94720b-23cd-4ddf-a560-00f8518e43c9",
7 "alertType": "TRANSITION",
8 "alertRuleConstraints": {
9 "transitionType": "ALL"
10 },
11 "notificationGroup": "358a3348-26d6-4d9d-8d5a-c3de41b26f63",
12 "enabled": false
13}