Skip to content

API Codelabs

This directory contains comprehensive hands-on codelabs for implementing the ECARUS telematics APIs. Each codelab provides step-by-step guidance with practical examples and complete implementations.

Available Codelabs

🔧 Remote Engine Control API

Learn how to implement remote engine start/stop functionality with real-time monitoring and safety features.

What you'll learn:

  • Remote engine control (start/stop)
  • Real-time status monitoring via SSE
  • Safety and security implementation
  • Settings management and diagnostics
  • Error handling and edge cases

Key Features:

  • Engine start/stop with climate control
  • Real-time status streaming
  • Safety verification systems
  • Command history and analytics
  • Emergency shutdown handling

🚨 ACN (Automatic Crash Notification) API

Master emergency response coordination with automatic crash detection and rescue service integration.

What you'll learn:

  • Emergency incident detection and management
  • Real-time emergency notifications
  • Agent workflow coordination
  • Multi-agency emergency response
  • Incident reporting and analytics

Key Features:

  • Automatic crash detection
  • Real-time emergency notifications
  • Agent assignment and workload management
  • Emergency service coordination
  • Incident tracking and reporting

🔍 Manual Diagnosis API

Implement remote vehicle diagnostics with consent management and real-time data streaming.

What you'll learn:

  • Remote diagnosis session management
  • User consent and security workflows
  • Real-time diagnostic data streaming
  • DTC code analysis and reporting
  • Comprehensive diagnostic reports

Key Features:

  • Remote diagnosis sessions
  • Live data streaming from vehicle sensors
  • DTC (Diagnostic Trouble Code) analysis
  • User consent management
  • Automated report generation

Getting Started

Each codelab is self-contained and includes:

  • Prerequisites - Required tools and knowledge
  • Setup Instructions - Project initialization
  • Step-by-Step Implementation - Progressive learning
  • Complete Examples - Full working applications
  • Testing Guidelines - How to test your implementation
  • Challenge Exercises - Advanced practice problems
  1. Start with Remote Engine Control - Learn basic API patterns and real-time updates
  2. Move to ACN - Understand emergency workflows and agent coordination
  3. Complete with Manual Diagnosis - Master complex session management and consent flows

Common Requirements

All codelabs require:

  • Node.js and npm installed
  • Basic understanding of REST APIs
  • JavaScript/TypeScript knowledge
  • Text editor or IDE

API Authentication

All examples use the same authentication pattern:

javascript
const authToken = 'sk_4f9c7b8e2d1a6c0f3e7a9b5d8c1e4f2a7c6d9e0b3f5a8c1d4e7f9b2c6a1e3d';
const headers = {
  'Authorization': `Bearer ${authToken}`,
  'Content-Type': 'application/json'
};

Sample Data

All codelabs use consistent sample data:

  • VIN: KMHSH81C7LU123456
  • Agent ID: AGENT_001
  • Technician ID: TECH_001

Running the Codelabs

Each codelab includes complete runnable examples:

bash
# Navigate to the codelab directory
cd codelab

# Follow the specific codelab instructions
# Each codelab has its own setup and testing steps

Contributing

These codelabs are designed to be comprehensive learning resources. If you find issues or have suggestions for improvements:

  1. Check the existing API documentation for accuracy
  2. Test all code examples before submitting changes
  3. Follow the established format and structure
  4. Include both basic and advanced use cases

Security Best Practices

When implementing ECARUS APIs, always follow these security guidelines:

Authentication

  • Use HTTPS/TLS for all API communications
  • Implement proper token management and refresh mechanisms
  • Never expose authentication tokens in client-side code
  • Use environment variables for sensitive configuration

Data Protection

  • Encrypt sensitive vehicle data during transmission
  • Implement proper access control based on user roles
  • Log all API access for audit purposes
  • Follow data retention policies for vehicle information

Vehicle Safety

  • Always verify vehicle safety conditions before remote control
  • Implement timeout mechanisms for long-running operations
  • Provide emergency stop functionality for critical situations
  • Monitor for abnormal access patterns

Testing Guidelines

API Testing

  • Use the provided test environments before production
  • Test error scenarios and edge cases
  • Verify SSE connections handle disconnections gracefully
  • Test with different vehicle models and configurations

Security Testing

  • Test authentication and authorization flows
  • Verify input validation and sanitization
  • Test rate limiting and abuse prevention
  • Conduct penetration testing for critical endpoints

Performance Testing

  • Test API response times under load
  • Verify SSE streaming performance
  • Test concurrent session handling
  • Monitor memory usage in long-running applications

Support

For questions or issues with the codelabs:

  1. Check the API documentation first
  2. Review the troubleshooting sections in each codelab
  3. Test with the provided examples
  4. Refer to the error handling patterns shown in each implementation

Additional Resources

Released under the MIT License.