Back to App

API Documentation

REST API for Mercedes DFE data extraction automation.

Authentication

The API uses two authentication methods:

POST /api/v1/auth/login Authenticate and get session token

Request Headers

X-API-Key: your_api_key

Request Body

{ "username": "your_username", "password": "your_password" }

Response

{ "success": true, "session_token": "abc123...", "expires_at": "2024-01-01T08:00:00", "user_id": "12345" }
POST /api/v1/auth/logout Logout and invalidate session

Request Headers

X-API-Key: your_api_key X-Session-Token: your_session_token

Markets & Dealers

GET /api/v1/markets Get available markets

Response

{ "markets": [ {"mpc": "EG02", "displayURL": "Egypt"}, {"mpc": "AE01", "displayURL": "United Arab Emirates"} ] }
GET /api/v1/markets/{mpc}/dealers Get dealers for a market

Path Parameters

ParameterTypeDescription
mpcstringMarket code (e.g., EG02)

Response

{ "dealers": [ {"dealerId": "12345", "dealerName": "Cairo Dealer"}, {"dealerId": "67890", "dealerName": "Alexandria Dealer"} ], "market": "EG02" }
GET /api/v1/dealers/{mpc}/{dealer_id}/groups Get vehicle groups for a dealer

Response

{ "groups": [ {"label": "A-Class", "vehicle_type": "Passenger Cars"}, {"label": "C-Class", "vehicle_type": "Passenger Cars"} ], "market": "EG02", "dealer_id": "12345" }

Extraction

POST /api/v1/extraction/start Start extraction job

Request Body

{ "markets": ["EG02"], "all_dealers": true, "all_groups": true, "lob_codes": ["01", "03", "07", "11", "EQ"], "download_mode": "collective" }

Response

{ "success": true, "job_id": "20240101_120000", "message": "Extraction started." }
GET /api/v1/extraction/status Get extraction status

Response

{ "status": "running", "job_id": "20240101_120000", "overall_progress": 45.5, "markets_done": 1, "markets_total": 2, "dealers_done": 5, "dealers_total": 10, "vehicles_downloaded": 150, "elapsed_time": "00:05:30" }
POST /api/v1/extraction/stop Stop extraction

Sends a stop signal to the running extraction job.

Files

GET /api/v1/files List downloaded files

Response

{ "files": [ { "name": "enquiries_20240101_120000.json", "size": 1048576, "size_formatted": "1.0 MB", "modified": "2024-01-01T12:30:00" } ], "count": 1 }
GET /api/v1/files/{filename} Download file

Returns the file content as JSON. Add ?raw=true for raw file download.

GET /api/v1/files/{filename}/excel Download file as Excel

Converts the JSON vehicle data to an Excel spreadsheet (.xlsx) and downloads it.

Response

Returns an Excel file with Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet

Features

  • Auto-formatted columns with proper headers
  • Styled header row with colors
  • Auto-adjusted column widths
  • Frozen header row
DELETE /api/v1/files/{filename} Delete file

Permanently deletes the specified file.

Reference Data

GET /api/v1/lob-codes Get LOB codes

Response

{ "codes": [ {"code": "01", "name": "Passenger Cars"}, {"code": "03", "name": "Commercial Vehicles"}, {"code": "07", "name": "Trucks"}, {"code": "11", "name": "Buses"}, {"code": "EQ", "name": "Electric Vehicles"} ] }
GET /api/v1/history Get extraction history

Query Parameters

ParameterTypeDescription
statusstringFilter by status (completed, failed, stopped)
limitintegerLimit number of results

OpenAPI Specification

Download the full OpenAPI 3.0 specification:

Download OpenAPI Spec