LogixVast

Fleet Management API

The Fleet Management API is built with Django REST framework, providing robust and scalable endpoints for fleet management operations. Access vehicle data, monitor maintenance schedules, and optimize routes through our RESTful API.

Authentication

All API endpoints require authentication using Django REST framework's token authentication. Include the token in the Authorization header:

Authorization: Token your-api-token

Vehicles

GET/api/v1/fleet/vehicles/

Returns a paginated list of all vehicles in your fleet.

Parameters

NameTypeRequiredDescription
statusstringNoFilter vehicles by status (active, maintenance, inactive)
pageintegerNoPage number for pagination
page_sizeintegerNoNumber of results per page (default: 20, max: 100)

Response

Type: object

{
  "count": 45,
  "next": "http://api.logixvast.com/api/v1/fleet/vehicles/?page=2",
  "previous": null,
  "results": [
    {
      "id": 123,
      "plate_number": "ABC123",
      "vehicle_type": "truck",
      "status": "active",
      "location": {
        "latitude": 37.7749,
        "longitude": -122.4194,
        "last_updated": "2024-01-24T12:00:00Z"
      },
      "driver": {
        "id": 456,
        "first_name": "John",
        "last_name": "Doe"
      },
      "created_at": "2024-01-01T00:00:00Z",
      "updated_at": "2024-01-24T12:00:00Z"
    }
  ]
}
POST/api/v1/fleet/vehicles/

Add a new vehicle to your fleet.

Request Body

Type: object

{
  "plate_number": "XYZ789",
  "vehicle_type": "truck",
  "capacity": {
    "weight_kg": 5000,
    "volume_m3": 20
  },
  "specifications": {
    "make": "Volvo",
    "model": "FH16",
    "year": 2023
  }
}

Response

Type: object

{
  "id": 789,
  "plate_number": "XYZ789",
  "vehicle_type": "truck",
  "status": "inactive",
  "capacity": {
    "weight_kg": 5000,
    "volume_m3": 20
  },
  "specifications": {
    "make": "Volvo",
    "model": "FH16",
    "year": 2023
  },
  "created_at": "2024-01-24T12:00:00Z",
  "updated_at": "2024-01-24T12:00:00Z"
}

Routes

POST/api/v1/fleet/routes/optimize/

Optimize routes for multiple vehicles based on delivery locations using Django Celery for async processing.

Request Body

Type: object

{
  "vehicles": [
    123,
    456
  ],
  "deliveries": [
    {
      "id": 789,
      "location": {
        "latitude": 37.7749,
        "longitude": -122.4194
      },
      "time_window": {
        "start": "2024-01-24T09:00:00Z",
        "end": "2024-01-24T17:00:00Z"
      }
    }
  ],
  "optimization_criteria": {
    "priority": "time",
    "avoid_tolls": false
  }
}

Response

Type: object

{
  "task_id": "c7d2ad89-f2e1-4e1d-b4d3-5e8a9d1b9f2a",
  "status": "processing",
  "estimated_completion_time": "30 seconds",
  "results_endpoint": "/api/v1/fleet/routes/optimize/c7d2ad89-f2e1-4e1d-b4d3-5e8a9d1b9f2a/"
}

Maintenance

GET/api/v1/fleet/maintenance/schedules/

Get the maintenance schedule for your fleet vehicles with Django REST framework's built-in filtering.

Parameters

NameTypeRequiredDescription
vehicle_idintegerNoFilter schedule for a specific vehicle
statusstringNoFilter by status (scheduled, in_progress, completed)
date_fromstringNoFilter schedules from this date (YYYY-MM-DD)
date_tostringNoFilter schedules until this date (YYYY-MM-DD)

Response

Type: object

{
  "count": 1,
  "next": null,
  "previous": null,
  "results": [
    {
      "id": 123,
      "vehicle": {
        "id": 456,
        "plate_number": "ABC123"
      },
      "maintenance_type": "routine",
      "status": "scheduled",
      "scheduled_date": "2024-02-15T14:00:00Z",
      "estimated_duration_minutes": 120,
      "tasks": [
        {
          "id": 1,
          "name": "Oil Change",
          "status": "pending",
          "estimated_time_minutes": 45
        },
        {
          "id": 2,
          "name": "Brake Inspection",
          "status": "pending",
          "estimated_time_minutes": 30
        }
      ],
      "created_at": "2024-01-24T12:00:00Z",
      "updated_at": "2024-01-24T12:00:00Z"
    }
  ]
}

Error Responses

The API follows Django REST framework's standard error response format:

{
  "detail": "Error message",  // For simple errors
  "field_name": [            // For validation errors
    "Error message 1",
    "Error message 2"
  ]
}

Rate Limiting

Rate limiting is implemented using Django REST framework's throttling classes. The current limits are:

  • Authenticated requests: 1000 requests per hour
  • GET requests: 2000 requests per hour
  • POST/PUT/DELETE requests: 500 requests per hour

Rate limit information is included in the response headers:

X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 999
X-RateLimit-Reset: 3600