Skip to main content

List Tractors

Retrieve all tractors from the catalog with pagination, sorting, and filtering capabilities. This endpoint is public and does not require authentication.

Endpoint

GET /api/tractors

Query Parameters

page
integer
default:"1"
Page number for pagination
limit
integer
default:"10"
Number of records per page (maximum 100)
sort
string
default:"brand"
Field to sort by. Available fields: brand, model, engine_power_hp, weight_kg, status
order
string
default:"asc"
Sort order: asc (ascending) or desc (descending)

Response Fields

success
boolean
Indicates if the request was successful
data
array
Array of tractor objects
pagination
object
Pagination metadata

Example Request

curl -X GET "http://localhost:4000/api/tractors?page=1&limit=10&sort=engine_power_hp&order=desc" \
  -H "Content-Type: application/json"

Example Response

{
  "success": true,
  "data": [
    {
      "tractor_id": 1,
      "name": "John Deere 6130M",
      "brand": "John Deere",
      "model": "6130M",
      "engine_power_hp": 130,
      "weight_kg": 5200,
      "traction_force_kn": 45.5,
      "traction_type": "4x4",
      "tire_type": "radial",
      "tire_width_mm": 540,
      "tire_diameter_mm": 1600,
      "tire_pressure_psi": 15,
      "status": "available"
    },
    {
      "tractor_id": 2,
      "name": "Case IH Magnum 280",
      "brand": "Case IH",
      "model": "Magnum 280",
      "engine_power_hp": 280,
      "weight_kg": 11200,
      "traction_force_kn": 85.3,
      "traction_type": "4x4",
      "tire_type": "radial",
      "tire_width_mm": 710,
      "tire_diameter_mm": 1880,
      "tire_pressure_psi": 18,
      "status": "available"
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 10,
    "total": 25,
    "totalPages": 3
  }
}

Search Tractors

Filter tractors by brand, model, and power range

Get Available Tractors

Get only tractors with “available” status

Get Tractor by ID

Retrieve a specific tractor’s details

Create Tractor

Add a new tractor (admin only)
This endpoint is cached for 24 hours. Changes made through create, update, or delete operations will invalidate the cache automatically.

Build docs developers (and LLMs) love