Overview
Three endpoints together give a complete picture of a vehicle’s current health:| Endpoint | Data |
|---|---|
POST /api/GetLastPositionData | Live voltage, ignition state, speed, odometer, last GPS fix |
POST /api/GetCompanyVehiclesBatteryHealth | Battery voltage trend and day-ahead prediction results |
GET /api/devices/{id}/dtc-codes | Active OBD-II / CAN fault codes from the vehicle handler |
DeviceId in position data, vehicleId in battery health, and the {id} path parameter in DTC codes. These are all the same legacy integer vehicle identifier.
DTC
description and severity fields are present in the schema but are empty in the current backend. Display the raw code value and resolve meaning externally via the SAE J1979 or ISO 15031-6 standard. See Known Issues.Step 1 — Get live position and status
GetLastPositionData returns the latest GPS fix for a single vehicle. Key health fields:
| Field | Type | Description |
|---|---|---|
DeviceId | integer | Vehicle identifier — join key |
Voltage | double | External battery voltage (V) |
Ignition | boolean | Whether ignition is currently on |
Speed | double | Last reported speed (km/h) |
Odometer | double | Total odometer reading (km) |
UtcTime | string | When this GPS fix was recorded (UTC, no Z suffix) |
cURL
Python
Step 2 — Get battery health predictions
GetCompanyVehiclesBatteryHealth returns a paged list of battery predictions. Iterate over all pages using numberOfPages:
Python
items contains:
| Field | Description |
|---|---|
vehicleId | Vehicle identifier (join key) |
currentVoltage | Current battery voltage (V) |
predictionResults | Array of prediction objects |
BatteryPredictionValue— label such as"Good","Fair","Poor"PredictionConfidence— label such as"High","Medium","Low"predictionForDay— integer (days ahead this prediction applies to)
Step 3 — Get DTC fault codes
GET /api/devices/{id}/dtc-codes returns the active diagnostic trouble codes from the vehicle’s OBD-II / CAN handler. The response is an array of arrays — flatten and deduplicate by code:
Python
Step 4 — Join on vehicle ID
With all three data sources fetched, merge them into a single per-vehicle record:Limitations
- DTC description and severity are empty. The
DtcDto.descriptionandDtcDto.severityfields are present in the schema but the backend does not populate them. Display the rawcodevalue and resolve the meaning externally using the SAE J1979 or ISO 15031-6 fault code database. - Safety score is a separate call.
GetSafetyScorereturns per-tripriskLevel/riskScore(0–100) /duration/distancefor a single vehicle over a date range. It is not included here because it operates at trip granularity, not vehicle-snapshot granularity — use it alongside trip replay for driver safety dashboards. - Battery prediction results are company-wide.
GetCompanyVehiclesBatteryHealthfetches all vehicles in the company. For large fleets, cache this response and join locally rather than calling it once per vehicle.
Gotchas
DeviceId=vehicleId= DTC{id}. All three endpoints use the same integer vehicle identifier under different field names.UtcTimehas noZsuffix but is always UTC — treat it as UTC when parsing.- Voltage is external battery voltage.
InternalBatteryVoltage(on thePositionDto) is the device’s internal backup battery, not the vehicle’s 12 V battery. UseVoltagefor vehicle health.