Skip to main content

POST /api/devices/{deviceId}/alerts

This endpoint allows you to submit alert data for a specific device in the satellite tracking application. It is useful for updating the system with new alert information for the device.

Request Details

The request is made using the POST method at the /api/devices/{deviceId}/alerts URL. You must replace {deviceId} with the actual ID of the device you want to update.

Request Parameters

This endpoint requires the deviceId parameter to be included in the URL path.

ParameterTypeRequiredDescription
deviceIdstringYesThe unique identifier of the device to update.

Request Body Parameters

The body of the request must include a JSON object with the alert data for the device.

FieldTypeRequiredDescription
fromstringYesStart date and time of the alert, in ISO 8601 format.
tostringYesEnd date and time of the alert, in ISO 8601 format.
alertNamestringNoName of the alert to filter by. If omitted or null, all available alerts in the specified date range will be returned. See the Available Alert Names section below for valid values.

Available Alert Names

The alertName parameter accepts specific string values corresponding to different types of events tracked by the device. If this field is not provided, the API will return all of the device's alerts within the date range.

Valid alert names are:

Alert NameDescription
GPSOffGPS is turned off.
GPSNoSignalGPS has lost signal.
ForbiddenAreaDevice entered a forbidden area (geofence).
AllowedAreaDevice exited or entered an allowed area.
SOSButtonThe panic/SOS button was pressed.
SpeedLimitThe device exceeded the speed limit.
NoMovementTimeDevice has been inactive/stopped for too long.
Sensor1OnSensor 1 was activated.
GPSUnpluggedThe device was disconnected from its main power source.
Sensor1OffSensor 1 was deactivated.
TemperatureGreaterThanTemperature exceeded the maximum limit.
TemperatureLowerThanTemperature dropped below the minimum limit.
FuelJumpDownSudden drop in fuel level (possible theft).
FuelJumpUpSudden increase in fuel level (refueling).
FuelLessThanFuel level is critically low.
FutureDateThe device sent a date in the future.
PastDateThe device sent a date from the past.
Sensor2OnSensor 2 was activated.
Sensor2OffSensor 2 was deactivated.
Sensor3OnSensor 3 was activated.
Sensor3OffSensor 3 was deactivated.
Sensor4OnSensor 4 was activated.
Sensor4OffSensor 4 was deactivated.
ExpiredDateThe data has expired.
MileageMileage alert triggered.
VibrationVibration detected.
RPMRPM limit exceeded.
CheckPointA checkpoint was reached.
CheckAreaA check area was crossed.
SpeedLowerSpeed dropped below a set limit.
OfflineDevice went offline.
LowBatteryDevice's internal battery is low.
BatteryVoltageMain battery voltage is out of range.
SleepModeDevice entered sleep/power-saving mode.
Temperature2LessThanSecondary temperature dropped below the minimum limit.
Temperature2GreaterThanSecondary temperature exceeded the maximum limit.
RouteRoute deviation detected.
Sensor1TimeSensor 1 specific time threshold met.
Sensor2TimeSensor 2 specific time threshold met.
Sensor3TimeSensor 3 specific time threshold met.
Sensor4TimeSensor 4 specific time threshold met.
SensorAccumulated1TimeAccumulated time on sensor 1 exceeded threshold.
SensorAccumulated2TimeAccumulated time on sensor 2 exceeded threshold.
SensorAccumulated3TimeAccumulated time on sensor 3 exceeded threshold.
SensorAccumulated4TimeAccumulated time on sensor 4 exceeded threshold.
FuelJumpDown2Sudden drop in fuel level for secondary tank.
FuelJumpUp2Sudden increase in fuel level for secondary tank.
FuelLessThan2Fuel level is critically low for secondary tank.
AttributeEqualsCustom attribute equality condition met.
AttributeLessThanCustom attribute less-than condition met.
AttributeGreaterThanCustom attribute greater-than condition met.
HarshBrakingHarsh or sudden braking detected.
HarshAccelerationHarsh or sudden acceleration detected.
AuthenticationFailedAuthentication of the device or driver failed.
IdleTimeVehicle is idling for too long.

Authentication Required

Authentication required to use the endpoint is via a Bearer token. This authentication method implies that each request must include an authorization header with a valid access token. This Bearer token acts as a credential that verifies the identity of the user or application making the request, ensuring that only authorized entities can modify the user's information. By requiring this type of authentication, the system guarantees a high level of security and access control, protecting users' data against unauthorized access.

Example Request

POST /api/devices/device123/alerts HTTP/1.1
Host: api.plaspy.com
Authorization: Bearer {token}
Content-Type: application/json

{
"from": "2024-06-01T00:00:00Z",
"to": "2024-06-01T23:59:59Z",
"alertName": "Speeding Alert"
}

Response Parameters

The response from this endpoint includes details about the success of the operation and any errors that may have occurred.

FieldTypeRequiredDescription
successbooleanYesIndicates whether the request was successful.
errorstringNoError message in case the request fails.
apiUsageintegerNoAPI usage in the current request.
apiDailyUsageintegerNoDaily API usage.
alertsarrayNoList of alert objects if the request was successful. Each object contains detailed information about the alert.

Within the alerts field, the object has the following fields:

FieldTypeRequiredDescription
dateTimestringYesDate and time of the alert.
latitudenumberYesLatitude of the alert.
longitudenumberYesLongitude of the alert.
textstringNoDescriptive text of the alert.
notificationsarrayNoList of notifications.
alertsarrayNoList of associated alerts.

Example Successful Response

{
"success": true,
"apiUsage": 150,
"apiDailyUsage": 3000,
"alerts": [
{
"dateTime": "2024-06-01T12:00:00Z",
"latitude": 40.712776,
"longitude": -74.005974,
"text": "Speeding Alert",
"notifications": ["Email", "SMS"],
"alerts": ["High Speed"]
}
]
}

Example Error Response

Error 400 (Bad Request) Response

{
"success": false,
"error": "Bad Request",
"apiUsage": 150,
"apiDailyUsage": 3000
}

Error 500 (Internal Server Error) Response

{
"success": false,
"error": "Internal Server Error",
"apiUsage": 150,
"apiDailyUsage": 3000
}

This endpoint is essential for updating the alert data of a device within the system. It allows users to submit detailed and up-to-date alert information for a specific device, ensuring accurate tracking and monitoring.

Plaspy GPS Tracking Platform

Explore the Plaspy platform and compatible GPS devices

Browse technical guides, application documentation, compatible trackers, and setup resources to get more value from Plaspy.