Skip to main content
GET
/
v1
/
devices
/
{device_id}
/
status
curl -X GET https://api.bookovia.com/v1/devices/OBD_12345_ABC789/status \
  -H "X-API-Key: your_api_key_here"
{
  "device_id": "OBD_12345_ABC789",
  "status": "online",
  "last_seen": "2024-03-15T14:32:15Z",
  "battery_level": 87,
  "signal_strength": 92,
  "connectivity": {
    "network_type": "4G LTE",
    "carrier": "Verizon",
    "roaming": false,
    "data_usage_mb": 245.7,
    "connection_quality": "excellent"
  },
  "diagnostics": {
    "cpu_usage": 23,
    "memory_usage": 67,
    "storage_used_gb": 2.8,
    "temperature_celsius": 42,
    "uptime_hours": 168,
    "firmware_version": "8.4.2.1",
    "last_restart": "2024-03-08T09:15:00Z"
  },
  "location": {
    "latitude": 37.7749,
    "longitude": -122.4194,
    "accuracy": 5.2,
    "timestamp": "2024-03-15T14:32:10Z",
    "speed_mph": 45,
    "heading": 187
  },
  "vehicle_data": {
    "engine_status": "running",
    "ignition": true,
    "odometer_miles": 45832,
    "fuel_level_percent": 73,
    "coolant_temp": 185,
    "rpm": 1850
  },
  "alerts": [
    {
      "type": "maintenance_due",
      "severity": "warning",
      "message": "Vehicle maintenance due in 500 miles",
      "timestamp": "2024-03-15T08:00:00Z"
    }
  ],
  "performance_metrics": {
    "data_transmission_rate": "98.5%",
    "gps_fix_accuracy": "high",
    "sensor_readings_per_minute": 120,
    "error_count_24h": 2
  }
}

Documentation Index

Fetch the complete documentation index at: https://docs.bookovia.com/llms.txt

Use this file to discover all available pages before exploring further.

Authentication

This endpoint requires an API key. Include your API key in the X-API-Key header.

Request

curl -X GET https://api.bookovia.com/v1/devices/OBD_12345_ABC789/status \
  -H "X-API-Key: your_api_key_here"

Response

{
  "device_id": "OBD_12345_ABC789",
  "status": "online",
  "last_seen": "2024-03-15T14:32:15Z",
  "battery_level": 87,
  "signal_strength": 92,
  "connectivity": {
    "network_type": "4G LTE",
    "carrier": "Verizon",
    "roaming": false,
    "data_usage_mb": 245.7,
    "connection_quality": "excellent"
  },
  "diagnostics": {
    "cpu_usage": 23,
    "memory_usage": 67,
    "storage_used_gb": 2.8,
    "temperature_celsius": 42,
    "uptime_hours": 168,
    "firmware_version": "8.4.2.1",
    "last_restart": "2024-03-08T09:15:00Z"
  },
  "location": {
    "latitude": 37.7749,
    "longitude": -122.4194,
    "accuracy": 5.2,
    "timestamp": "2024-03-15T14:32:10Z",
    "speed_mph": 45,
    "heading": 187
  },
  "vehicle_data": {
    "engine_status": "running",
    "ignition": true,
    "odometer_miles": 45832,
    "fuel_level_percent": 73,
    "coolant_temp": 185,
    "rpm": 1850
  },
  "alerts": [
    {
      "type": "maintenance_due",
      "severity": "warning",
      "message": "Vehicle maintenance due in 500 miles",
      "timestamp": "2024-03-15T08:00:00Z"
    }
  ],
  "performance_metrics": {
    "data_transmission_rate": "98.5%",
    "gps_fix_accuracy": "high",
    "sensor_readings_per_minute": 120,
    "error_count_24h": 2
  }
}

Path Parameters

ParameterTypeRequiredDescription
device_idstringYesUnique identifier of the device

Response Fields

FieldTypeDescription
device_idstringUnique device identifier
statusstringCurrent device status: online, offline, idle, error, maintenance
last_seenstringISO 8601 timestamp of last communication
battery_levelnumberBattery percentage (0-100)
signal_strengthnumberCellular signal strength percentage (0-100)
connectivityobjectNetwork connectivity information
diagnosticsobjectDevice performance and health metrics
locationobjectCurrent GPS location and movement data
vehicle_dataobjectVehicle-specific telemetry (OBD-II devices only)
alertsarrayActive device alerts and warnings

Use Cases

Fleet Health Dashboard

Monitor all fleet devices in real-time and identify issues before they impact operations:
// Fleet-wide device monitoring dashboard
class FleetMonitoringDashboard {
  constructor(apiKey) {
    this.apiKey = apiKey;
    this.devices = [];
    this.healthMetrics = {};
  }

  async loadFleetDevices() {
    // Get all registered devices
    const response = await fetch('https://api.bookovia.com/v1/devices', {
      headers: { 'X-API-Key': this.apiKey }
    });
    this.devices = await response.json();
  }

  async checkAllDeviceStatuses() {
    const statusPromises = this.devices.map(device => 
      this.getDeviceStatus(device.device_id)
    );
    
    const statuses = await Promise.all(statusPromises);
    
    // Categorize device health
    const healthSummary = {
      online: statuses.filter(s => s.status === 'online').length,
      offline: statuses.filter(s => s.status === 'offline').length,
      lowBattery: statuses.filter(s => s.battery_level < 20).length,
      poorSignal: statuses.filter(s => s.signal_strength < 50).length,
      criticalAlerts: statuses.reduce((count, s) => 
        count + s.alerts.filter(a => a.severity === 'critical').length, 0
      )
    };
    
    return { statuses, healthSummary };
  }

  async generateHealthReport() {
    const { statuses, healthSummary } = await this.checkAllDeviceStatuses();
    
    const report = {
      timestamp: new Date().toISOString(),
      fleet_size: this.devices.length,
      health_summary: healthSummary,
      critical_devices: statuses.filter(s => 
        s.status === 'offline' || 
        s.battery_level < 15 || 
        s.alerts.some(a => a.severity === 'critical')
      ),
      recommendations: this.generateFleetRecommendations(statuses)
    };
    
    return report;
  }
}

// Usage
const dashboard = new FleetMonitoringDashboard('your_api_key_here');
const healthReport = await dashboard.generateHealthReport();
console.log('Fleet Health Report:', healthReport);

Predictive Maintenance Alerts

Use device status data to predict maintenance needs and prevent breakdowns:
# Predictive maintenance system using device diagnostics
import requests
from datetime import datetime, timedelta
import numpy as np

class PredictiveMaintenanceSystem:
    def __init__(self, api_key):
        self.api_key = api_key
        self.base_url = "https://api.bookovia.com/v1"
        
    def analyze_device_health(self, device_id):
        """Analyze device health trends and predict maintenance needs"""
        # Get current status
        status = self.get_device_status(device_id)
        
        # Historical analysis (would normally query historical data)
        health_score = self.calculate_health_score(status)
        maintenance_predictions = self.predict_maintenance_needs(status)
        
        return {
            "device_id": device_id,
            "current_health_score": health_score,
            "maintenance_predictions": maintenance_predictions,
            "recommended_actions": self.generate_recommendations(status, health_score),
            "risk_assessment": self.assess_failure_risk(status)
        }
    
    def calculate_health_score(self, status):
        """Calculate overall device health score (0-100)"""
        factors = {
            "battery": status["battery_level"] / 100 * 0.25,
            "signal": status["signal_strength"] / 100 * 0.20,
            "uptime": min(status["diagnostics"]["uptime_hours"] / 168, 1) * 0.20,
            "temperature": max(0, (85 - status["diagnostics"]["temperature_celsius"]) / 85) * 0.15,
            "memory": (100 - status["diagnostics"]["memory_usage"]) / 100 * 0.10,
            "errors": max(0, (100 - status["performance_metrics"]["error_count_24h"]) / 100) * 0.10
        }
        
        return sum(factors.values()) * 100
    
    def predict_maintenance_needs(self, status):
        """Predict when maintenance will be needed"""
        predictions = []
        
        # Battery degradation prediction
        if status["battery_level"] < 30:
            days_until_critical = (status["battery_level"] - 10) * 2  # Rough estimate
            predictions.append({
                "type": "battery_replacement",
                "urgency": "high" if days_until_critical < 7 else "medium",
                "estimated_days": max(1, days_until_critical),
                "description": f"Battery replacement needed in ~{days_until_critical} days"
            })
        
        # Temperature monitoring
        if status["diagnostics"]["temperature_celsius"] > 70:
            predictions.append({
                "type": "cooling_system_check",
                "urgency": "high",
                "estimated_days": 3,
                "description": "Device running hot - cooling system inspection recommended"
            })
        
        # Memory usage trends
        if status["diagnostics"]["memory_usage"] > 85:
            predictions.append({
                "type": "firmware_optimization",
                "urgency": "medium", 
                "estimated_days": 14,
                "description": "High memory usage - firmware update or reset recommended"
            })
        
        return predictions

# Automated maintenance monitoring
def monitor_fleet_maintenance():
    maintenance_system = PredictiveMaintenanceSystem("your_api_key_here")
    
    # Get all fleet devices
    devices_response = requests.get(
        "https://api.bookovia.com/v1/devices",
        headers={"X-API-Key": "your_api_key_here"}
    )
    devices = devices_response.json()
    
    maintenance_alerts = []
    
    for device in devices:
        analysis = maintenance_system.analyze_device_health(device["device_id"])
        
        if analysis["current_health_score"] < 70:
            maintenance_alerts.append({
                "device_id": device["device_id"],
                "health_score": analysis["current_health_score"],
                "urgent_actions": [p for p in analysis["maintenance_predictions"] 
                                 if p["urgency"] == "high"],
                "risk_level": analysis["risk_assessment"]
            })
    
    return maintenance_alerts

Real-time Alert System

Implement real-time monitoring and alerting for critical device events:
// Real-time device monitoring with WebSocket alerts
package main

import (
    "encoding/json"
    "fmt"
    "log"
    "net/http"
    "time"
    "github.com/gorilla/websocket"
)

type DeviceAlertSystem struct {
    apiKey     string
    devices    []string
    alertRules []AlertRule
    wsConn     *websocket.Conn
}

type AlertRule struct {
    Type        string  `json:"type"`
    Threshold   float64 `json:"threshold"`
    Comparison  string  `json:"comparison"` // "less_than", "greater_than", "equals"
    Severity    string  `json:"severity"`   // "info", "warning", "critical"
    Cooldown    int     `json:"cooldown_minutes"`
}

type DeviceAlert struct {
    DeviceID    string    `json:"device_id"`
    AlertType   string    `json:"alert_type"`
    Severity    string    `json:"severity"`
    Message     string    `json:"message"`
    Timestamp   time.Time `json:"timestamp"`
    CurrentValue float64  `json:"current_value"`
    Threshold   float64   `json:"threshold"`
}

func (das *DeviceAlertSystem) StartMonitoring() {
    ticker := time.NewTicker(30 * time.Second)
    defer ticker.Stop()
    
    for {
        select {
        case <-ticker.C:
            das.checkAllDevices()
        }
    }
}

func (das *DeviceAlertSystem) checkAllDevices() {
    for _, deviceID := range das.devices {
        status := das.getDeviceStatus(deviceID)
        alerts := das.evaluateAlertRules(status)
        
        for _, alert := range alerts {
            das.sendAlert(alert)
        }
    }
}

func (das *DeviceAlertSystem) evaluateAlertRules(status DeviceStatus) []DeviceAlert {
    var alerts []DeviceAlert
    
    for _, rule := range das.alertRules {
        var currentValue float64
        var shouldAlert bool
        
        switch rule.Type {
        case "battery_level":
            currentValue = float64(status.BatteryLevel)
        case "signal_strength":
            currentValue = float64(status.SignalStrength)
        case "temperature":
            currentValue = status.Diagnostics.Temperature
        case "offline_duration":
            if status.Status == "offline" {
                currentValue = time.Since(status.LastSeen).Minutes()
            }
        }
        
        // Evaluate threshold
        switch rule.Comparison {
        case "less_than":
            shouldAlert = currentValue < rule.Threshold
        case "greater_than":
            shouldAlert = currentValue > rule.Threshold
        }
        
        if shouldAlert {
            alert := DeviceAlert{
                DeviceID:     status.DeviceID,
                AlertType:    rule.Type,
                Severity:     rule.Severity,
                Message:      das.generateAlertMessage(rule.Type, currentValue, rule.Threshold),
                Timestamp:    time.Now(),
                CurrentValue: currentValue,
                Threshold:    rule.Threshold,
            }
            alerts = append(alerts, alert)
        }
    }
    
    return alerts
}

func (das *DeviceAlertSystem) sendAlert(alert DeviceAlert) {
    // Send to monitoring dashboard via WebSocket
    if das.wsConn != nil {
        das.wsConn.WriteJSON(alert)
    }
    
    // Log critical alerts
    if alert.Severity == "critical" {
        log.Printf("CRITICAL ALERT: Device %s - %s", alert.DeviceID, alert.Message)
        
        // Send emergency notification (SMS, email, etc.)
        das.sendEmergencyNotification(alert)
    }
}

func main() {
    alertSystem := &DeviceAlertSystem{
        apiKey: "your_api_key_here",
        devices: []string{"OBD_12345_ABC789", "OBD_67890_DEF123"},
        alertRules: []AlertRule{
            {Type: "battery_level", Threshold: 15, Comparison: "less_than", Severity: "critical"},
            {Type: "signal_strength", Threshold: 30, Comparison: "less_than", Severity: "warning"},
            {Type: "temperature", Threshold: 75, Comparison: "greater_than", Severity: "warning"},
            {Type: "offline_duration", Threshold: 60, Comparison: "greater_than", Severity: "critical"},
        },
    }
    
    // Start real-time monitoring
    go alertSystem.StartMonitoring()
    
    // Keep program running
    select {}
}

Mobile Device Diagnostics

Create comprehensive device diagnostics for field technicians and fleet managers:
// Comprehensive device diagnostics interface
interface DeviceDiagnosticsSuite {
  connectivity_tests: ConnectivityDiagnostics;
  performance_analysis: PerformanceAnalysis;
  hardware_health: HardwareHealth;
  troubleshooting_guide: TroubleshootingStep[];
}

class DeviceDiagnosticsService {
  private apiKey: string;

  constructor(apiKey: string) {
    this.apiKey = apiKey;
  }

  async runFullDiagnostics(deviceId: string): Promise<DeviceDiagnosticsSuite> {
    const status = await this.getDeviceStatus(deviceId);
    
    return {
      connectivity_tests: await this.testConnectivity(deviceId, status),
      performance_analysis: this.analyzePerformance(status),
      hardware_health: this.assessHardwareHealth(status),
      troubleshooting_guide: this.generateTroubleshootingSteps(status)
    };
  }

  private async testConnectivity(deviceId: string, status: DeviceStatusResponse): Promise<ConnectivityDiagnostics> {
    const tests = [];
    
    // Ping test
    const pingResult = await this.pingDevice(deviceId);
    tests.push({
      test: 'ping_response',
      result: pingResult.success ? 'pass' : 'fail',
      latency_ms: pingResult.latency,
      details: `Average latency: ${pingResult.latency}ms`
    });
    
    // Data transmission test
    const dataTest = await this.testDataTransmission(deviceId);
    tests.push({
      test: 'data_transmission',
      result: dataTest.success ? 'pass' : 'fail',
      throughput_kbps: dataTest.throughput,
      details: `Upload/Download: ${dataTest.upload_speed}/${dataTest.download_speed} kbps`
    });
    
    // GPS accuracy test
    const gpsTest = this.testGPSAccuracy(status.location);
    tests.push({
      test: 'gps_accuracy',
      result: gpsTest.accuracy < 10 ? 'pass' : 'warning',
      accuracy_meters: gpsTest.accuracy,
      details: `GPS fix accuracy: ${gpsTest.accuracy}m`
    });
    
    return {
      overall_status: tests.every(t => t.result === 'pass') ? 'healthy' : 'issues_detected',
      tests: tests,
      recommendations: this.generateConnectivityRecommendations(tests)
    };
  }

  private analyzePerformance(status: DeviceStatusResponse): PerformanceAnalysis {
    const metrics = status.diagnostics;
    
    const analysis = {
      cpu_performance: this.analyzeCPUUsage(metrics.cpu_usage),
      memory_performance: this.analyzeMemoryUsage(metrics.memory_usage),
      storage_performance: this.analyzeStorageUsage(metrics.storage_used_gb),
      thermal_performance: this.analyzeThermalStatus(metrics.temperature_celsius),
      overall_score: 0,
      bottlenecks: [] as string[],
      optimization_suggestions: [] as string[]
    };
    
    // Calculate overall performance score
    const scores = [
      analysis.cpu_performance.score,
      analysis.memory_performance.score,
      analysis.storage_performance.score,
      analysis.thermal_performance.score
    ];
    analysis.overall_score = scores.reduce((sum, score) => sum + score, 0) / scores.length;
    
    return analysis;
  }

  private generateTroubleshootingSteps(status: DeviceStatusResponse): TroubleshootingStep[] {
    const steps: TroubleshootingStep[] = [];
    
    // Device offline troubleshooting
    if (status.status === 'offline') {
      steps.push({
        issue: 'Device Offline',
        priority: 'critical',
        steps: [
          'Check device power connection and LED indicators',
          'Verify cellular antenna is properly connected',
          'Check SIM card installation and carrier signal',
          'Attempt remote device restart via fleet management portal',
          'Contact technical support if device remains offline > 4 hours'
        ]
      });
    }
    
    // Low battery troubleshooting
    if (status.battery_level < 20) {
      steps.push({
        issue: 'Low Battery Level',
        priority: 'high',
        steps: [
          'Check vehicle charging system (alternator, battery)',
          'Inspect device power cable for damage',
          'Verify proper OBD-II port connection',
          'Schedule battery replacement if device battery degraded',
          'Enable power saving mode in device settings'
        ]
      });
    }
    
    // Poor signal troubleshooting
    if (status.signal_strength < 50) {
      steps.push({
        issue: 'Poor Cellular Signal',
        priority: 'medium',
        steps: [
          'Check cellular antenna installation and positioning',
          'Verify carrier coverage in current location',
          'Test with different cellular carrier if multi-carrier device',
          'Check for physical obstructions (metal, building, terrain)',
          'Consider external antenna installation for permanent installations'
        ]
      });
    }
    
    return steps;
  }
}

// Usage for field technicians
const diagnosticsService = new DeviceDiagnosticsService('your_api_key_here');

async function fieldDiagnostics(deviceId: string) {
  console.log(`Running diagnostics for device: ${deviceId}`);
  
  const results = await diagnosticsService.runFullDiagnostics(deviceId);
  
  // Display results for technician
  console.log('=== DEVICE DIAGNOSTICS REPORT ===');
  console.log(`Connectivity: ${results.connectivity_tests.overall_status}`);
  console.log(`Performance Score: ${results.performance_analysis.overall_score}/100`);
  console.log(`Hardware Health: ${results.hardware_health.overall_status}`);
  
  if (results.troubleshooting_guide.length > 0) {
    console.log('\n=== TROUBLESHOOTING REQUIRED ===');
    results.troubleshooting_guide.forEach(guide => {
      console.log(`\n${guide.issue} (${guide.priority} priority):`);
      guide.steps.forEach((step, index) => {
        console.log(`  ${index + 1}. ${step}`);
      });
    });
  }
  
  return results;
}

Best Practices

Monitoring & Alerting

  • Set up automated monitoring for critical device metrics (battery, connectivity, temperature)
  • Implement escalation procedures for devices that remain offline beyond acceptable thresholds
  • Use status polling intervals appropriate for your use case (30 seconds for critical operations, 5 minutes for standard monitoring)
  • Configure alert fatigue prevention with cooldown periods and alert aggregation

Performance Optimization

  • Cache device status data for frequently accessed devices to reduce API calls
  • Implement batch status checking for fleet-wide monitoring dashboards
  • Use WebSocket connections for real-time status updates when available
  • Set up predictive analytics to identify devices likely to fail before they go offline

Troubleshooting & Maintenance

  • Document common device issues and resolution procedures based on status indicators
  • Train field technicians on interpreting device diagnostic data
  • Maintain device firmware update schedules based on performance metrics
  • Implement automated device restart procedures for devices showing performance degradation