The Products API provides four endpoints for managing cafeteria items in the UniSierra Eats platform. Products belong to one of four categories (Documentation Index
Fetch the complete documentation index at: https://mintlify.com/JuseAR27/Unisierra-eats/llms.txt
Use this file to discover all available pages before exploring further.
comidas, bebidas, snacks, sanas) and carry a price level indicator alongside their numeric price. The list endpoint aggregates rating data from the Reviews table so callers always receive up-to-date average scores in a single request.
GET /api/productos
Returns every product in the database along with its computed average star rating and total number of reviews. Products that have never been reviewed receive acalificacion of 0 and a numResenas of 0.
SQL Query
The endpoint executes the following query internally:Request
No request body or query parameters are required.Response — 200 OK
Returns a JSON array. Each element has the following fields:Unique identifier for the product.
Display name of the product (e.g.,
"Torta de pierna").Numeric price of the product in Mexican pesos.
Human-readable price tier:
$, $$, or $$$.Short description of the product.
URL or relative path to the product image.
Product category:
comidas, bebidas, snacks, or sanas.Average star rating across all reviews (including reported ones). Returns
0 when no reviews exist.Total count of reviews associated with the product.
Response — 500 Internal Server Error
Example
POST /api/productos
Creates a new product record in the database.Request Body
Display name of the new product.
Numeric price in Mexican pesos.
Price tier indicator. Accepted values:
$, $$, $$$.Short description of the product.
URL or relative path to the product image.
Product category. Accepted values:
comidas, bebidas, snacks, sanas.Response — 200 OK
Confirmation message:
"Producto registrado con éxito".The
lastID assigned to the newly created product row.Response — 500 Internal Server Error
Example
PUT /api/productos/:id
Updates the name, description, price, image, and category of an existing product identified by itsid_producto.
precioNivel is not updated by this endpoint. To change a product’s price tier, delete and recreate the product, or manage it directly in the database.Path Parameter
| Parameter | Type | Description |
|---|---|---|
id | integer | The id_producto of the product to update. |
Request Body
Updated display name of the product.
Updated description of the product.
Updated price in Mexican pesos.
Updated image URL or path. If omitted or
null, an empty string is stored.Updated category:
comidas, bebidas, snacks, or sanas.Response — 200 OK
Confirmation message, e.g.
"Producto 3 actualizado correctamente".Response — 500 Internal Server Error
Example
DELETE /api/productos/:id
Permanently deletes a product from the database by itsid_producto.
Path Parameter
| Parameter | Type | Description |
|---|---|---|
id | integer | The id_producto of the product to delete. |
Request Body
None required.Response — 200 OK
Confirmation message, e.g.
"Producto 3 eliminado correctamente".