Creating a Vehicle
Register a vehicle for use in contracts or trips in the Optimize Everything API system.
Endpoint
POST /vehicle/create
Required Fields
| Name | Type | Required | Description | Default |
|---|---|---|---|---|
| last_known_position | object | Yes | Current GPS coordinates of the vehicle | — |
| last_known_position_time | datetime | Yes | Timestamp of the current position (ISO 8601 format) | — |
| capacity | object | Yes | Vehicle capacity and seating configuration. See schema below. | — |
| type | string | Yes | Type of vehicle (e.g., Sedan, SUV, Van) | — |
| make | string | Yes | Vehicle manufacturer (e.g., Toyota, Ford) | — |
| model | string | Yes | Vehicle model name | — |
capacity Object Schema
| Field | Type | Description |
|---|---|---|
| height_in_mm | integer | Height of the container in millimeters |
| width_in_mm | integer | Width of the container in millimeters |
| length_in_mm | integer | Length of the container in millimeters |
| weight_in_g | integer | Weight capacity in grams |
| child_seat_count | integer | Number of seats that can be used by children |
| regular_seat_count | integer | Number of regular seats available |
| small_seat_count | integer | Number of small seats available (i.e. middle seat) |
| accessible_seat_count | integer | Number of accessible seats available |
| additional_details | object | Additional container specifications |
Example for last_known_position
- latitude (
float): Latitude coordinate - longitude (
float): Longitude coordinate
Example for capacity (ContainerSize)
- height_in_mm (
integer) - width_in_mm (
integer) - length_in_mm (
integer) - length_tolerance_in_mm (
integer) - weight_in_g (
integer) - weight_tolerance_in_g (
integer) - child_passenger_count (
integer) - oversize_passenger_count (
integer) - other_passenger_count (
integer)
Example Request
{
"last_known_position": {"latitude": 40.7128, "longitude": -74.0060},
"last_known_position_time": "2024-06-01T10:00:00Z",
"capacity": {
"height_in_mm": 1500,
"width_in_mm": 1800,
"length_in_mm": 4000,
"length_tolerance_in_mm": 100,
"weight_in_g": 2000000,
"weight_tolerance_in_g": 50000,
"child_passenger_count": 2,
"oversize_passenger_count": 0,
"other_passenger_count": 3
},
"type": "Sedan",
"make": "Toyota",
"model": "Camry"
}
For more details, see the API documentation or the schema in
schemas/vehicle.py.