Notifications API
The Notifications API allows users to manage their notification preferences for various system events. Users can retrieve and update their notification settings through dedicated endpoints.
Base URL
- Base path
/api2/notifications
Authorization
- Requires
Cookie
:JSESSIONID=session_id
Notification Settings
Get Settings
GET /settings
Description: Retrieves the current notification preferences for the authenticated user.
Example Request:
curl -X GET "https://api.trackongps.com/api2/notifications/settings" \
-H "Cookie: JSESSIONID=your_session_id"
Responses:
200 OK - Response Body
{
"ignition": false,
"geofence": false,
"deviceOverspeed": false,
"maintenance": true,
"alarm": false,
"commandResult": true
}
Update Settings
PUT /settings
Description: Updates specific notification preferences for the authenticated user.
Example Request:
curl -X PUT "https://api.trackongps.com/api2/notifications/settings" \
-H "Cookie: JSESSIONID=your_session_id" \
-H "Content-Type: application/json" \
-d '{
"type": "ignition",
"isOn": true
}'
Request Body:
Parameter | Type | Required | Description |
---|---|---|---|
type |
string | Yes | Notification type identifier |
isOn |
boolean | Yes | Enable/disable the notification |
Responses:
200 OK - Response Body
{
"type": "ignition",
"isOn": true
}
Notification Types
Type | Description |
---|---|
ignition |
Vehicle ignition updates |
geofence |
Geofence entry / exit |
deviceOverspeed |
Speed limit exceeded |
maintenance |
Maintenance alerts |
alarm |
Various alarm types |
commandResult |
Command execution results |
Supported Alarms
vibration
powerCut
hardAcceleration
hardBraking
hardCornering
tampering
accident
overspeed
Notification Tokens
Update Tokens
PUT /tokens
Description: Allows authenticated users to add or update their notification tokens. A maximum of 20 tokens can be stored per user.
Example Request:
curl -X PUT "https://api.trackongps.com/api2/notifications/tokens" \
-H "Cookie: JSESSIONID=your_session_id" \
-H "Content-Type: application/json" \
-d '{
"token": "example_device_token"
}'
Request Body:
Parameter | Type | Required | Description |
---|---|---|---|
token |
string | Yes | The device token to be added for notifications. |
Responses:
200 Accepted - Response Body
{
"message": "Token Extended"
}
400 Bad Request - Response Body
{
"message": "No token provided"
}
302 Not Modified - Response Body
{
"message": "Token already exists" //body might not exist in response
}
Remove Token
DELETE /tokens
Description: Allows authenticated users to remove an existing notification token from their account.
Example Request:
curl -X DELETE "https://api.trackongps.com/api2/notifications/tokens" \
-H "Cookie: JSESSIONID=your_session_id" \
-H "Content-Type: application/json" \
-d '{
"token": "example_device_token"
}'
Request Body:
Parameter | Type | Required | Description |
---|---|---|---|
token |
string | Yes | The device token to be removed from notifications. |
Responses:
200 Ok - Response Body
{
"message": "Token Removed"
}
400 Invalid Request - Response Body
{
"message": "No token provided" //body might not exist
}
404 Not Found - Response Body
{
"message": "Token not found"
}