Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ytabeloved/ordervista/llms.txt

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

Menu categories group related products together on the Ordervista menu. Every endpoint under /api/categories is protected by verifyToken and authorizeRoles(1), meaning only users with the Administrator role (id_rol: 1) can list, create, update, or delete categories. Categories carry an activo flag; inactive categories (and their products) are excluded from the public-facing menu returned by GET /api/menu.

GET /api/categories

Returns all category records from the CATEGORIAS table, including inactive ones. Auth required: Yes — Administrator (id_rol: 1)

Response 200 OK

An array of category objects.
id_categoria
integer
Auto-incremented primary key.
nombre
string
Unique category name (up to 100 characters).
descripcion
string | null
Optional description of the category.
activo
boolean
Whether the category is visible on the menu. Defaults to true.
curl -X GET https://api.ordervista.com/api/categories \
  -H "Authorization: Bearer <token>"
[
  {
    "id_categoria": 1,
    "nombre": "Hamburguesas",
    "descripcion": "Hamburguesas artesanales de res y pollo",
    "activo": true
  },
  {
    "id_categoria": 2,
    "nombre": "Bebidas",
    "descripcion": null,
    "activo": true
  }
]

Error responses

StatusmensajeCause
401"Token no proporcionado" / "Token inválido"Missing or invalid JWT.
403"Acceso denegado"Authenticated user does not have the Administrator role.
500"Error al obtener categorías"Unexpected server-side error.

GET /api/categories/:id

Retrieves a single category by its primary key. Auth required: Yes — Administrator (id_rol: 1)

Path parameters

id
integer
required
The id_categoria of the category to retrieve.

Response 200 OK

A single category object with the same fields as described in GET /api/categories.
curl -X GET https://api.ordervista.com/api/categories/1 \
  -H "Authorization: Bearer <token>"
{
  "id_categoria": 1,
  "nombre": "Hamburguesas",
  "descripcion": "Hamburguesas artesanales de res y pollo",
  "activo": true
}

Error responses

StatusmensajeCause
401"Token no proporcionado" / "Token inválido"Missing or invalid JWT.
403"Acceso denegado"Insufficient role.
404"Categoría no encontrada"No category exists with the given id.
500"Error al obtener categoría"Unexpected server-side error.

POST /api/categories

Creates a new menu category. Auth required: Yes — Administrator (id_rol: 1)

Request body

nombre
string
required
Category name. Must be unique across all categories (up to 100 characters).
descripcion
string
Optional description of the category (up to 255 characters).
activo
boolean
Whether the category is active. Defaults to true if omitted.

Response 201 Created

mensaje
string
Confirmation message: "Categoría creada correctamente".
id_categoria
integer
The auto-generated primary key of the new category.
curl -X POST https://api.ordervista.com/api/categories \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "nombre": "Postres",
    "descripcion": "Tortas, helados y delicias dulces"
  }'
{
  "mensaje": "Categoría creada correctamente",
  "id_categoria": 5
}

Error responses

StatusmensajeCause
400"El nombre de la categoría es obligatorio"nombre field is missing or empty.
401"Token no proporcionado" / "Token inválido"Missing or invalid JWT.
403"Acceso denegado"Insufficient role.
500"Error al crear categoría"Unexpected server-side error.

PUT /api/categories/:id

Updates one or more fields on an existing category. Only the fields provided in the request body are updated. Auth required: Yes — Administrator (id_rol: 1)

Path parameters

id
integer
required
The id_categoria of the category to update.

Request body

All fields are optional.
nombre
string
New category name. Must remain unique.
descripcion
string
New description text.
activo
boolean
Set to false to hide the category (and its products) from the public menu.

Response 200 OK

mensaje
string
Confirmation message: "Categoría actualizada correctamente".
curl -X PUT https://api.ordervista.com/api/categories/5 \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "descripcion": "Tortas caseras, helados artesanales y más",
    "activo": true
  }'
{
  "mensaje": "Categoría actualizada correctamente"
}

Error responses

StatusmensajeCause
401"Token no proporcionado" / "Token inválido"Missing or invalid JWT.
403"Acceso denegado"Insufficient role.
404"Categoría no encontrada"No category exists with the given id.
500"Error al actualizar categoría"Unexpected server-side error.

DELETE /api/categories/:id

Permanently removes a category from the system. Auth required: Yes — Administrator (id_rol: 1)

Path parameters

id
integer
required
The id_categoria of the category to delete.

Response 200 OK

mensaje
string
Confirmation message: "Categoría eliminada correctamente".
curl -X DELETE https://api.ordervista.com/api/categories/5 \
  -H "Authorization: Bearer <token>"
{
  "mensaje": "Categoría eliminada correctamente"
}

Error responses

StatusmensajeCause
401"Token no proporcionado" / "Token inválido"Missing or invalid JWT.
403"Acceso denegado"Insufficient role.
404"Categoría no encontrada"No category exists with the given id.
500"Error al eliminar categoría"Unexpected server-side error.

Build docs developers (and LLMs) love