Routes (Documentation Index
Fetch the complete documentation index at: https://mintlify.com/luiss811/Backend-Airguide/llms.txt
Use this file to discover all available pages before exploring further.
rutas) describe pre-defined navigation paths on campus. Each route connects an origin to a destination using one of four location types — edificio, salon, cubiculo, or evento — and carries an ordered list of waypoints (RutaDetalle) that a client renders as turn-by-turn instructions. Routes can be internal (on-campus) or external.
GET /api/rutas
Returns all routes matching the supplied filters. Waypoints are included and ordered by theirorden field.
Query parameters
Filter by route type. Accepted values:
interna, externa.Filter by active status. Accepted values:
"true", "false".Filter by origin location type. Accepted values:
edificio, salon, cubiculo, evento.Filter by destination location type. Accepted values:
edificio, salon, cubiculo, evento.Response — 200 OK
Array of route objects, each including adetalles array of waypoints.
Unique route identifier.
Route type:
interna or externa.Origin location type:
edificio, salon, cubiculo, or evento.ID of the origin location in its respective table.
Destination location type:
edificio, salon, cubiculo, or evento.ID of the destination location in its respective table.
Estimated travel time in minutes. May be
null if not set.Number of times this route has been looked up via
POST /api/rutas/find.Whether the route is active.
Ordered waypoints for the route.
Example
GET /api/rutas/:id
Returns a single route by itsid_ruta. Waypoints are included and ordered by orden.
Path parameters
The
id_ruta of the route to retrieve.Response — 200 OK
A single route object with the same shape as described in GET /api/rutas.Error responses
| Status | Body | Cause |
|---|---|---|
404 | { "error": "Ruta no encontrada" } | No route exists with the given ID. |
Example
POST /api/rutas/find
Finds an active route by matching origin and destination type and ID. Use this endpoint to retrieve a route for real-time navigation rather than browsing all routes.Every successful call to this endpoint increments the route’s
contador_usos field by one. This counter drives the congestion prediction model — see POST /api/rutas/check-congestion.Request body
Origin location type:
edificio, salon, cubiculo, or evento.ID of the origin location in its respective table.
Destination location type:
edificio, salon, cubiculo, or evento.ID of the destination location in its respective table.
Response — 200 OK
The matching active route object including itsdetalles array, with the same shape as described in GET /api/rutas.
Error responses
| Status | Body | Cause |
|---|---|---|
400 | { "error": "Se requieren origen y destino" } | One or more required body fields are missing. |
404 | { "error": "No se encontró una ruta" } | No active route matches the given origin/destination. |
Example
POST /api/rutas
Creates a new route. You may optionally include waypoints (detalles) in the same request body.
Request headers
Bearer token for an admin account:
Bearer <token>.Request body
Route type:
interna or externa.Origin location type:
edificio, salon, cubiculo, or evento.ID of the origin location.
Destination location type:
edificio, salon, cubiculo, or evento.ID of the destination location.
Estimated travel time in minutes.
Whether the route should be active immediately.
Optional array of waypoints to create together with the route.
Response — 201 Created
The newly created route object including any supplieddetalles, ordered by orden.
Example
PUT /api/rutas/:id
Updates an existing route’s fields. Only the fields included in the request body are changed. Waypoints are not replaced by this endpoint — use POST /api/rutas/:id/detalles and DELETE /api/rutas/detalles/:id to modify waypoints individually.Path parameters
The
id_ruta of the route to update.Request headers
Bearer token for an admin account:
Bearer <token>.Response — 200 OK
The updated route object including itsdetalles, ordered by orden.
Example
DELETE /api/rutas/:id
Permanently deletes a route and all of its associated waypoints.Path parameters
The
id_ruta of the route to delete.Request headers
Bearer token for an admin account:
Bearer <token>.Response — 200 OK
Confirmation string:
"Ruta eliminada".POST /api/rutas/:id/detalles
Adds a single waypoint to an existing route.Path parameters
The
id_ruta of the route to add the waypoint to.Request headers
Bearer token for an admin account:
Bearer <token>.Request body
Step order for this waypoint. Lower values appear first.
Navigation instruction displayed to the user at this step.
Latitude coordinate (decimal, up to 8 decimal places).
Longitude coordinate (decimal, up to 8 decimal places).
Response — 201 Created
The newly createdRutaDetalle object.
Example
DELETE /api/rutas/detalles/:id
Permanently removes a single waypoint from its route.Path parameters
The
id_detalle of the waypoint to delete.Request headers
Bearer token for an admin account:
Bearer <token>.Response — 200 OK
Confirmation string:
"Detalle eliminado".