GPS Tracker Server

Server is running and operational

Available API Endpoints:

All Devices: /api/devices
Get list of all registered GPS devices with their current status
Specific Device: /api/device/{imei}
Get detailed information about a specific device by IMEI
Example: /api/device/0869066063180153
Device Location History: /api/device/{imei}/locations ENHANCED
Get location history for a device with advanced filtering options
Query Parameters:
?filter=today - Get today's locations
?filter=yesterday - Get yesterday's locations
?filter=week - Get last 7 days
?filter=month - Get last 30 days
?date=2024-07-30 - Get locations for specific date
?start_date=2024-07-30&end_date=2024-07-31 - Date range
Device History (alias): /api/device/{imei}/history ENHANCED
Same as locations endpoint with identical filtering capabilities
Examples:
/api/device/0869066063180153/history?filter=today
/api/device/0869066063180153/history?filter=week
/api/device/0869066063180153/history?date=2024-07-30
Device Alerts: /api/device/{imei}/alerts
Get all SOS alerts and emergency notifications for a specific device
Example: /api/device/0869066063180153/alerts
All Alerts: /api/alerts
Get all SOS alerts from all devices across the system

Date Filtering Features:

Predefined Filters:
Quick access to common time periods
filter=today - Current day (00:00 to 23:59)
filter=yesterday - Previous day
filter=week - Last 7 days from now
filter=month - Last 30 days from now
Custom Date Ranges:
Flexible date range selection
Single Date: date=YYYY-MM-DD
Date Range: start_date=YYYY-MM-DD&end_date=YYYY-MM-DD
Supported Formats: YYYY-MM-DD, DD-MM-YYYY, MM/DD/YYYY

Response Format:

Data Sorting:
All location data is automatically sorted by timestamp (newest first)
Performance: Optimized MongoDB queries with proper indexing
Format: JSON response with CORS headers enabled

Server Configuration:

Features:

API Usage Examples:

Recent Activity:
GET /api/device/0869066063180153/locations?filter=today
GET /api/device/0869066063180153/locations?filter=week
Historical Data:
GET /api/device/0869066063180153/locations?date=2024-07-30
GET /api/device/0869066063180153/history?start_date=2024-07-30&end_date=2024-07-31

Performance Benefits: