Skip to main content

List All Parking Spaces

Returns all parking spaces with their relationships including apartamento.torre.proyecto and apartamento.pisoTorre.

Response Fields

success
boolean
Indicates if the request was successful
data
array
Array of parking space objects
{
  "success": true,
  "data": [
    {
      "id_parqueadero": 1,
      "numero": "P-101",
      "tipo": "Vehiculo",
      "id_apartamento": 1,
      "id_torre": null,
      "id_proyecto": null,
      "precio": "15000000.00",
      "apartamento": {
        "id_apartamento": 1,
        "numero": "101",
        "torre": {
          "nombre_torre": "Torre A",
          "proyecto": {
            "nombre": "Torre del Sol"
          }
        },
        "pisoTorre": {
          "nivel": 10
        }
      }
    },
    {
      "id_parqueadero": 2,
      "numero": "M-201",
      "tipo": "Moto",
      "id_apartamento": null,
      "precio": "5000000.00",
      "apartamento": null
    }
  ]
}

Get Single Parking Space

Retrieve detailed information about a specific parking space.

Path Parameters

id
integer
required
The unique identifier of the parking space
{
  "success": true,
  "data": {
    "id_parqueadero": 1,
    "numero": "P-101",
    "tipo": "Vehiculo",
    "precio": "15000000.00",
    "apartamento": {
      "numero": "101",
      "tipoApartamento": {
        "nombre": "2 Habitaciones"
      },
      "estadoInmueble": {
        "nombre": "Vendido"
      },
      "torre": {
        "nombre_torre": "Torre A",
        "proyecto": {
          "nombre": "Torre del Sol",
          "ubicacion": {
            "direccion": "Calle 123 #45-67",
            "ciudad": {
              "nombre": "Bogotá"
            }
          }
        }
      },
      "pisoTorre": {
        "nivel": 10
      }
    }
  }
}

Create Parking Space

Create a new parking space.

Request Body

numero
string
required
Parking space number (max 20 characters, must be globally unique)
tipo
string
required
Parking type: must be “Vehiculo” or “Moto”
id_apartamento
integer
Apartment ID to assign (must exist in apartamento table). Leave null for unassigned parking.
{
  "numero": "P-101",
  "tipo": "Vehiculo",
  "id_apartamento": null
}
{
  "numero": "P-102",
  "tipo": "Vehiculo",
  "id_apartamento": 5
}
{
  "success": true,
  "message": "Parqueadero creado exitosamente",
  "data": {
    "id_parqueadero": 1,
    "numero": "P-101",
    "tipo": "Vehiculo",
    "id_apartamento": null
  }
}
{
  "success": false,
  "errors": {
    "numero": [
      "Ya existe un parqueadero con este número"
    ]
  }
}
{
  "success": false,
  "errors": {
    "tipo": [
      "El tipo debe ser Vehiculo o Moto"
    ]
  }
}

Update Parking Space

Update an existing parking space. Same validation rules as creation, but numero uniqueness check excludes the current record.

Path Parameters

id
integer
required
The unique identifier of the parking space to update

Request Body

Same as Create Parking Space endpoint.

Delete Parking Space

Delete a parking space.

Path Parameters

id
integer
required
The unique identifier of the parking space to delete
{
  "success": true,
  "message": "Parqueadero eliminado exitosamente"
}

Assign Parking to Apartment

Assign a parking space to an apartment. Fails if already assigned.

Path Parameters

id
integer
required
The parking space ID

Request Body

id_apartamento
integer
required
Apartment ID to assign (must exist)
{
  "id_apartamento": 5
}
{
  "success": true,
  "message": "Parqueadero asignado exitosamente",
  "data": {
    "id_parqueadero": 1,
    "numero": "P-101",
    "tipo": "Vehiculo",
    "id_apartamento": 5,
    "apartamento": {
      "numero": "505",
      "torre": {
        "nombre_torre": "Torre A",
        "proyecto": {
          "nombre": "Torre del Sol"
        }
      }
    }
  }
}
{
  "success": false,
  "message": "El parqueadero ya está asignado a un apartamento"
}

Unassign Parking from Apartment

Remove apartment assignment from a parking space.

Path Parameters

id
integer
required
The parking space ID
{
  "success": true,
  "message": "Parqueadero desasignado exitosamente",
  "data": {
    "id_parqueadero": 1,
    "numero": "P-101",
    "tipo": "Vehiculo",
    "id_apartamento": null
  }
}
{
  "success": false,
  "message": "El parqueadero no está asignado a ningún apartamento"
}

Filter Parking Spaces

By Type

Path Parameters

tipo
string
required
Must be “Vehiculo” or “Moto”

Get Available Only

Returns all unassigned parking spaces (id_apartamento is null).

Get Assigned Only

Returns all assigned parking spaces with apartment details.

By Apartment

Get all parking spaces assigned to a specific apartment.

Path Parameters

id_apartamento
integer
required
The apartment ID

Get Available by Type

Get available parking spaces filtered by type.

Path Parameters

tipo
string
required
Must be “Vehiculo” or “Moto”

Search Parking Spaces

Search parking spaces by number (case-insensitive).

Query Parameters

termino
string
required
Search term (min 1 character)

Get Parking Space Summary

Get a comprehensive summary of a parking space.

Path Parameters

id
integer
required
The parking space ID
{
  "success": true,
  "data": {
    "id_parqueadero": 1,
    "numero": "P-101",
    "tipo": "Vehiculo",
    "estado": "Asignado",
    "apartamento": {
      "numero": "101",
      "tipo": "2 Habitaciones",
      "torre": "Torre A",
      "piso": 10,
      "proyecto": "Torre del Sol",
      "ubicacion": "Calle 123 #45-67, Bogotá"
    }
  }
}
{
  "success": true,
  "data": {
    "id_parqueadero": 2,
    "numero": "P-102",
    "tipo": "Vehiculo",
    "estado": "Disponible"
  }
}

Get Parking Statistics

Get global statistics across all parking spaces.
{
  "success": true,
  "data": {
    "total_parqueaderos": 230,
    "disponibles": 45,
    "asignados": 185,
    "por_tipo": [
      {
        "tipo": "Vehiculo",
        "total": 150
      },
      {
        "tipo": "Moto",
        "total": 80
      }
    ],
    "disponibles_por_tipo": {
      "vehiculos": 30,
      "motos": 15
    }
  }
}

Create Multiple Parking Spaces

Batch create parking spaces with sequential numbering.

Request Body

prefijo
string
required
Prefix for parking numbers (max 10 characters)
numero_inicio
integer
required
Starting number (min: 1)
numero_fin
integer
required
Ending number (must be >= numero_inicio)
tipo
string
required
Parking type: “Vehiculo” or “Moto”
{
  "prefijo": "P-",
  "numero_inicio": 101,
  "numero_fin": 150,
  "tipo": "Vehiculo"
}
{
  "success": true,
  "message": "50 parqueadero(s) creado(s) exitosamente",
  "data": {
    "parqueaderos_creados": [
      {
        "id_parqueadero": 1,
        "numero": "P-101",
        "tipo": "Vehiculo"
      },
      {
        "id_parqueadero": 2,
        "numero": "P-102",
        "tipo": "Vehiculo"
      }
      // ... 48 more
    ],
    "numeros_existentes": [
      "P-105",
      "P-120"
    ]
  }
}
The batch creation endpoint skips any parking numbers that already exist and returns them in numeros_existentes. This allows you to safely re-run the operation.

Model Structure

Database Table: parqueaderos

FieldTypeNullableDescription
id_parqueaderoIntegerNoPrimary key
numeroString(20)NoParking number (unique)
tipoString(20)No”Vehiculo” or “Moto”
id_apartamentoIntegerYesForeign key to apartamento
id_torreIntegerYesForeign key to torre
id_proyectoIntegerYesForeign key to proyecto
precioDecimal(18,2)YesParking price

Relationships

  • BelongsTo: apartamento (Apartamento)
  • BelongsTo: torre (Torre)
  • BelongsTo: proyecto (Proyecto)

Business Rules

A parking space can only be assigned to one apartment at a time. Use the /asignar endpoint to assign and /desasignar to release.
Parking spaces are identified by a globally unique numero field. When creating multiple parking spaces, use a consistent prefix (e.g., “P-” for vehicles, “M-” for motorcycles) to maintain organization.
The batch creation endpoint is useful for initial project setup. For example, create P-101 through P-150 for vehicle parking on the first basement level, then M-201 through M-250 for motorcycle parking on the second basement level.

Build docs developers (and LLMs) love