PILOT Notification API
This API is designed to interact with temporary dynamic notifications. The structure of data and settings for these notifications is identical to working with the notification module in the PILOT system interface.
https://doc.pilot-gps.ru/modul_uvedomlenij_.html?ms=EwADAAAAAAAAAAAgAgJAAQ%3D%3D&st=MA%3D%3D&sct=OTE3&mw=Mjgw
|
HTTP Basic authentication is used for access. The login and password for accessing the API are specified in the format: login_from_pilot:password_from_pilot.
An example of a URL request for using the API:
https://demo:demo@pilot-gps.com/api/ptm/notification.php
For blade architecture servers, it is necessary to specify the node GET parameter, for example:
https://demo:demo@blade.pilot-gps.com/api/ptm/notification.php?node=3
|
The response to the request has two status codes: 200 for success and 500 for a server error.
The response format has the following structure:
{
“success”: false or true,
“msg”: error message, if any,
“method”: request method: GET, POST, PUT, DELETE,
“notification”: notification data,
“ids”: list of notification identifiers (only for the DELETE method)
}
1. Get existing notification configuration, GET method
Request parameters
| ||
Name
|
Parameter
|
Description
|
Notification ID
|
id*
|
Number
|
2. Create a new notification configuration, POST method
Request parameters
| ||
Name
|
Parameter
|
Description
|
Notification ID
|
agent_id*
|
Number
|
Vehicle id
|
vehs
|
An array of numbers. The value from the agent_id field goes here
|
Notification type
|
type*
|
String. One of the following values: speed, ignition, ignitionwork, sensor, sensorwork, temperature, fuel, connection, odometer, moving, parking, geozones. Can take an array of strings for complex notifications.
|
Geozones
|
geozones
|
Array. Each array element has a description of the geozone with keys:
- name – string, geozone name / address;
- zonetype – number, geozone type: 1 – polygon, 2 – circle;
- points – array, geozone characteristics. For polygon [[lat,lon],[lat,lon]..]. For circle [lat,lon,radius_in_m].
|
Notification name
|
name*
|
Line
|
Enabling email distribution
|
email
|
String. If you want to enable the mailing, you need to specify the value on, otherwise an empty string.
|
Email list for mailing
|
emails_list
|
Array of strings
|
Enabling SMS messaging
|
sms
|
String. If you want to enable the mailing, you need to specify the value on, otherwise an empty string
|
List of phone numbers for mailing
|
phones_list
|
Array of strings
|
Notification text
|
message_text
|
Line
|
Enabling sending data via webhook
|
webhook
|
String. If you want to enable sending data, you need to specify the value on, otherwise an empty string.
|
URL to send webhook
|
webhook_url
|
Line
|
Parameters for webhook
|
webhook_params
|
Line
|
Headers for webhook
|
webhook_headers
|
Line
|
Initial notification validity time
|
ts
|
Number, Unix timestamp
|
End time of notification validity
|
te
|
Number, Unix timestamp
|
Time zone name
|
timezone
|
String, for example Europe/Vienna
|
Geozone processing rule
|
zone_rule
|
String. Available values: in, out
|
Speed Processing Rule
|
speed_rule
|
String. Available values: >, <, =. Required for speed type.
|
The meaning of speed
|
speed_value
|
Number. Required for speed type.
|
Duration of the condition for triggering
|
speed_time
|
Number. Required for speed type.
|
Units of measurement for speed
|
speed_time_units
|
String. Available values: ss, mm, hh, km. Mandatory for types speed, temperature
|
Ignition Processing Rule
|
ignition_rule
|
String. Available values: on, off, onoff, move. Mandatory for ignition, sensor types.
|
Geozone processing rule
|
geozones_rule
|
String. Available values: in, out, inout
|
Duration of break
|
break_duration
|
Number. Mandatory for types moving, ignitionwork, sensorwork
|
Units of measurement for break
|
break_time_units
|
String. Available values: ss, mm, hh, km. Mandatory for types moving, ignitionwork, sensorwork
|
Tag name
|
tag_name
|
String. Required for types sensorwork, sensor
|
Temperature Processing Rule
|
temperature_rule
|
String. Available values: >, <, =, d . Required for type temperature
|
Temperature meaning
|
temperature_value
|
Number . Required for type temperature
|
Duration of the condition for triggering
|
temperature_time
|
Number . Required for type temperature
|
Duration of the condition for triggering the loss of connection
|
disconnect_time
|
Number . Required for type connection
|
Units of measurement
|
disconnect_time_units
|
String. Available values: ss, mm, hh, km. Required for connection type
|
Odometer Processing Rule
|
odometer_rule
|
String. Available values: >, <. Required for type odometer
|
Odometer value
|
odometer_value
|
Number. Required for type odometer
|
Duration of the condition for triggering
|
odometer_period
|
String. Available values: abs, month, day. Required for type odometer
|
Enabling notification generation for the GARM module
|
garm_event
|
String. If you want to enable it, you need to specify the value on, otherwise an empty string.
|
Event priority type identifier
|
group
|
Number. Mandatory for the GARM module.
|
Processing time in seconds
|
timer
|
Number
|
Algorithm data
|
algorithm_data
|
Line
|
Notification in telegram bot
|
telegram
|
String. If you want to enable it, you need to specify the value on, otherwise an empty string.
|
Notification to mobile device
|
push
|
String. If you want to enable it, you need to specify the value on, otherwise an empty string.
|
Notification in the form of a pop-up window in the interface
|
alert
|
String. If you want to enable it, you need to specify the value on, otherwise an empty string.
|
Notification for all system users
|
forall
|
String. If you want to enable it, you need to specify the value on, otherwise an empty string.
|
Notification Service Subtype
|
subtype
|
Line
|
Sensor tag ID
|
sensor_tag
|
Number
|
Language code
|
language
|
Line
|
Duration for triggering notification in seconds
|
duration
|
Number
|
Units of measurement
|
time_units
|
String. Available values: ss, mm, hh, km.
|
Rule for processing complex notifications
|
rule
|
Array of strings. The value of the array element can take the values: or, and
|
Description of complex notifications
|
rules
|
Array with notification description. Each array element accepts its own set of keys, depending on notification types.
|
Time of constant unchanging value
|
no_changes
|
Number
|
Units of measurement
|
no_changes_time_units
|
String. Available values: ss, mm, hh, km.
|
3. Edit an existing notification configuration, PUT method
Request parameters
| ||
Name
|
Parameter
|
Description
|
Notification ID
|
id*
|
Number. Passed as a GET parameter.
|
Agent ID
|
agent_id*
|
Number
|
Vehicle ID
|
vehs
|
An array of numbers. The value from the agent_id field goes here
|
Notification Type
|
type*
|
String. One of the following values: speed, ignition, ignitionwork, sensor, sensorwork, temperature, fuel, connection, odometer, moving, parking, geozones.
Can take an array of strings for complex notifications.
|
Geozones
|
geozones
|
Array. Each array element has a description of the geozone with keys:
- name – string, geozone name / address;
- zonetype – number, geozone type: 1 – polygon, 2 – circle;
- points – array, geozone characteristics.
For polygon [[lat,lon],[lat,lon]..]. For circle [lat,lon,radius_in_m].
|
Notification name
|
name*
|
Line
|
Enabling email distribution
|
email
|
Line. If you need to enable mailing, you need to specify the value on, otherwise an empty string.
|
Email list for distribution
|
emails_list
|
Array of strings
|
Enabling SMS distribution
|
sms
|
String. If you want to enable the mailing, you need to specify the value on, otherwise an empty string
|
List of phone numbers for distribution
|
phones_list
|
Array of strings
|
Notification text
|
message_text
|
Line
|
Enabling sending data via webhook
|
webhook
|
Line. If you want to enable sending data, you need to specify the value on, otherwise an empty string
|
URL for sending webhook
|
webhook_url
|
Line
|
Parameters for webhook
|
webhook_params
|
Line
|
Headers for webhook
|
webhook_headers
|
Line
|
Initial notification validity time
|
ts
|
Number, Unix timestamp
|
End time of notification validity
|
te
|
Number, Unix timestamp
|
Time zone name
|
timezone
|
String, for example Europe/Vienna
|
Geozone processing rule
|
zone_rule
|
String. Available values: in, out
|
Speed Processing Rule
|
speed_rule
|
String. Available values: >, <, =.
Required for speed type.
|
The meaning of speed
|
speed_value
|
Number. Required for speed type.
|
Duration of the condition for triggering
|
speed_time
|
Number. Required for speed type.
|
Units of measurement for speed
|
speed_time_units
|
String. Available values: ss, mm, hh, km. Mandatory for types speed, temperature
|
Ignition Processing Rule
|
ignition_rule
|
String. Available values: on, off, onoff, move. Mandatory for ignition, sensor types.
|
Geozone processing rule
|
geozones_rule
|
String. Available values: in, out, inout
|
Duration of break
|
break_duration
|
Number. Mandatory for types moving, ignitionwork, sensorwork
|
Units of measurement for break
|
break_time_units
|
String. Available values: ss, mm, hh, km. Mandatory for types moving, ignitionwork, sensorwork
|
Tag name
|
tag_name
|
String. Required for types sensorwork, sensor
|
Temperature Processing Rule
|
temperature_rule
|
String. Available values: >, <, =, d .
Required for temperature type.
|
Temperature meaning
|
temperature_value
|
Number . Required for type temperature
|
Duration of the condition for triggering
|
temperature_time
|
Number . Required for type temperature
|
Duration of the condition for triggering the loss of connection
|
disconnect_time
|
Number. Required for connection type.
|
Units of measurement
|
disconnect_time_units
|
String. Available values: ss, mm, hh, km. Required for connection type
|
Odometer Processing Rule
|
odometer_rule
|
String. Available values: >, <.
Required for odometer type.
|
Odometer value
|
odometer_value
|
Number. Required for type odometer
|
Duration of the condition for triggering
|
odometer_period
|
String. Available values: abs, month, day. Required for type odometer
|
Enabling notification generation for the GARM module
|
garm_event
|
String. If you want to enable it, you need to specify the value on, otherwise an empty string.
|
Event priority type identifier
|
group
|
Number. Mandatory for the GARM module.
|
Processing time in seconds
|
timer
|
Number
|
Algorithm data
|
algorithm_data
|
Line
|
Notification in telegram bot
|
telegram
|
String. If you want to enable it, you need to specify the value on, otherwise an empty string.
|
Notification to mobile device
|
push
|
String. If you want to enable it, you need to specify the value on, otherwise an empty string.
|
Notification in the form of a pop-up window in the interface
|
alert
|
String. If you want to enable it, you need to specify the value on, otherwise an empty string.
|
Notification for all system users
|
forall
|
String. If you want to enable it, you need to specify the value on, otherwise an empty string.
|
Notification Service Subtype
|
subtype
|
Line
|
Sensor tag ID
|
sensor_tag
|
Number
|
Language code
|
language
|
Line
|
Duration for triggering notification in seconds
|
duration
|
Number
|
Units of measurement
|
time_units
|
String. Available values: ss, mm, hh, km.
|
Rule for processing complex notifications
|
rule
|
Array of strings. The value of the array element can take the values: or, and
|
Description of complex notifications
|
rules
|
Array with notification description.
Each array element accepts its own set of keys, depending on the notification types.
|
Time of constant unchanging value
|
no_changes
|
Number
|
Units of measurement
|
no_changes_time_units
|
String. Available values: ss, mm, hh, km.
|
4. Delete an existing notification configuration, DELETE method
Takes one of the mandatory parameters. If agent_id is specified, all configurations for this agent will be deleted. If id is specified, the notification configuration by this identifier will be deleted.
Request parameters
| ||
Name
|
Parameter
|
Description
|
Notification ID
|
id
|
Number. Passed as a GET parameter.
|
Agent ID
|
agent_id
|
Number. Passed as a GET parameter.
|
Example of request data for creating a complex temperature notification:
{
"te": 1680202800,
"ts": 1680164770,
"name": "Temperature deviation",
"node": null,
"push": "",
"rule": [
"or",
"and"
],
"type": "complex",
"vehs": [
161115
],
"email": "on",
"group": 7,
"rules": [
{
"rule": "or",
"type": "temperature",
"time_units": "ss",
"speed_time_units": "ss",
"temperature_rule": ">",
"temperature_time": 20,
"temperature_value": 8
},
{
"rule": "and",
"type": "temperature",
"time_units": "ss",
"speed_time_units": "ss",
"temperature_rule": "<",
"temperature_time": 20,
"temperature_value": 2
}
],
"timer": 0,
"forall": "on",
"subtype": "magnit_temperature_deviation_outside_geofences",
"task_id": 186361,
"agent_id": 161115,
"geozones": {
"Krasnodar, Alma-Atinskaya st., 148": {
"id": null,
"name": "Krasnodar, Alma-Atinskaya st., 148",
"points": [
"45.04138000",
"38.93461000",
200
],
"zonetype": 2
}
},
"language": "en",
"telegram": "",
"timezone": "Europe/Moscow",
"zone_rule": "out",
"delay_time": 0,
"garm_event": "on",
"task_cp_id": 59626,
"time_units": [
"ss",
"ss"
],
"emails_list": [
""
],
"message_text": "Temperature deviation (+2..+8) outside geofences",
"algorithm_data": "",
"wait_time_send": 0,
"temperature_rule": [
">",
"<"
],
"temperature_time": [
20,
20
],
"temperature_value": [
8,
2
],
"algorithm_settings": ""