Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/devdavco/backend_1/llms.txt

Use this file to discover all available pages before exploring further.

The POST /espacios/create endpoint registers a brand-new coworking space in the system. You supply the space’s name, functional type, maximum occupancy, and the number of post-booking cleaning minutes in a JSON body. The service validates every field, persists the new entity, and returns the complete Espacio object — including the database-assigned id — with an HTTP 201 Created status.

Request body

Send a JSON object with the following fields. All four fields are required; the service will throw an exception if any are missing, null, blank, or zero.
nombre
string
required
Human-readable name of the space. Maximum 50 characters. Cannot be null or blank. Example: "Sala de Reuniones A".
tipo
string
required
Functional category of the space. Maximum 30 characters. Cannot be null or blank. Common values include sala_reunion, auditorio, and oficina_privada.
capacidad
integer
required
Maximum number of people that can occupy the space at one time. Must be a positive non-zero integer. Example: 10.
minutos_limpieza
integer
required
Number of minutes to block after every booking ends so the space can be cleaned before the next booking starts. Must be a positive non-zero integer. Example: 15.
The id field is auto-generated by the database and must not be included in the request body. Any id value sent will be ignored.

Example request

curl -X POST http://localhost:8080/espacios/create \
  -H "Content-Type: application/json" \
  -d '{
    "nombre": "Sala de Reuniones A",
    "tipo": "sala_reunion",
    "capacidad": 10,
    "minutos_limpieza": 15
  }'

Response

201 Created

On success the endpoint returns HTTP 201 Created with the newly persisted Espacio object as the response body. The id field will be populated with the value assigned by the database.
{
  "id": 1,
  "nombre": "Sala de Reuniones A",
  "tipo": "sala_reunion",
  "capacidad": 10,
  "minutos_limpieza": 15
}

Response fields

id
integer
Auto-generated unique identifier assigned by the database. Store this value to reference the space in future requests (e.g., GET /espacios/{id}, DELETE /espacios/eliminar/{id}, or when creating a Reserva).
nombre
string
The name of the newly created space, echoed back from the request.
tipo
string
The functional category of the newly created space, echoed back from the request.
capacidad
integer
The maximum occupancy of the newly created space, echoed back from the request.
minutos_limpieza
integer
The cleaning buffer (in minutes) of the newly created space, echoed back from the request.

Validation errors

The service performs the following checks before persisting the entity. If any check fails, the exception is re-thrown and Spring Boot returns HTTP 500 Internal Server Error:
ConditionError message
Request body is null"El objeto no puede ser nulo."
nombre is null or blank"El nombre no puede ser nulo."
tipo is null or blank"El tipo no puede ser nulo."
capacidad is null or 0"El capacidad no puede ser cero/nulo."
minutos_limpieza is null or 0"Minutos limpieza no puede ser cero/nulo."
After creating a space, use its returned id immediately to set up reservations. The id is the only stable handle for referencing this space in all other API operations.

Build docs developers (and LLMs) love