Skip to main content

API Endpoints & Data Formats

📌 What is this for? (Quick Summary for New Interns)​

In Simple Words:
This is the dictionary of all actions you can send to our API.
Whenever you want to build a new UI button, show a new chart, or debug a backend error, look up the action on this page to see:

  1. What parameters you need to send in the JSON body.
  2. What JSON the server sends back in response.
  3. What each number means (e.g. speed in m/s, temperatures in Celsius).

1. REGISTER_SESSION​

Tells the cloud server: "This browser tab is now the active controller for this user."

Request Body:​

{
"action": "REGISTER_SESSION",
"payload": {
"sessionId": "498505ce-a6b2-41f4-944a-50fd84eeaa96"
}
}

Response (200 OK):​

{
"status": "session_registered"
}

2. FETCH_METRICS​

Asks the cloud for the latest vehicle readings saved within the last 15 seconds.

Request Body:​

{
"action": "FETCH_METRICS",
"payload": {
"sessionId": "498505ce-a6b2-41f4-944a-50fd84eeaa96"
}
}

Response (200 OK):​

{
"speed": 16.67,
"distance": 42.5,
"acceleration": 2.1,
"battery_voltage": 364.2,
"output_battery_voltage": 364.0,
"battery_temp_1": 31.4,
"battery_temp_2": 32.1,
"battery_temp_3": 31.8,
"battery_temp_4": 32.5,
"inv_temp_a": 34.0,
"inv_temp_b": 34.5,
"inv_temp_c": 35.1,
"lim_temp": 38.2,
"soc": 98.5,
"over_current": 1,
"timestamp": "2026-11-03T10:15:30.000Z",
"state": {
"BatteryEnabled": true,
"Launch": true,
"Emergency": false
}
}

What Each Field Means:​

  • speed: Speed in meters per second (multiply by 3.6 to show km/h on your UI).
  • distance: How far the pod is down the track in meters (0m to 600m).
  • battery_voltage: Total battery pack voltage (~364 Volts when fully charged).
  • output_battery_voltage: Voltage measured after the main battery switch. If this is above 48V, the switch is closed.
  • battery_temp_1..4: Temperatures in Celsius across the 4 battery modules.
  • inv_temp_a..c: Temperatures of the motor drive electronics.
  • lim_temp: Temperature of the Linear Induction Motor stator.
  • soc: Battery percentage remaining (0 to 100%).
  • over_current: 1 if the vehicle is currently driving along the track, 0 if it is stopped.

3. SEND_CONTROL​

Sends a command to the vehicle. (Requires Admin or Engineer login).

Examples:​

A. Turn On Main High-Voltage Battery:​

{
"action": "SEND_CONTROL",
"payload": {
"sessionId": "498505ce-a6b2-41f4-944a-50fd84eeaa96",
"battery": 1
}
}

B. Launch Pod (Start Test Run):​

{
"action": "SEND_CONTROL",
"payload": {
"sessionId": "498505ce-a6b2-41f4-944a-50fd84eeaa96",
"start": 1
}
}

C. Emergency Stop (Abort Flight):​

{
"action": "SEND_CONTROL",
"payload": {
"sessionId": "498505ce-a6b2-41f4-944a-50fd84eeaa96",
"brake": 1
}
}

Response (200 OK):​

{
"message": "Command sent"
}

4. LOG_EVENT​

Records a permanent log row in DynamoDB whenever an important event happens (like launching or triggering emergency stop).

Request Body:​

{
"action": "LOG_EVENT",
"payload": {
"profileName": "thirumalai",
"batteryEnabled": true,
"launch": true,
"emergency": false
}
}