Ingredient management spans two controllers. TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/NicolasMPP/restorante-springboot/llms.txt
Use this file to discover all available pages before exploring further.
DespensaController handles the relationship between a pantry and its ingredients — listing, linking, and unlinking. The IngredienteController manages Ingrediente records globally: creating new ingredients, listing all of them, and updating stock levels. None of these endpoints require authentication, and all are CORS-enabled.
GET /api/despensa/{id}/ingredientes
Returns a lightweight list of all ingredients associated with a given pantry, projected asIngredienteDetalleDTO objects. This is preferable to GET /api/despensa/{id} when you only need ingredient data without the full entity graph.
The unique identifier of the pantry whose ingredients should be listed.
Request Example
Response — 200 OK
Returns an array ofIngredienteDetalleDTO objects. The array will be empty if no ingredients are linked to the pantry.
Unique identifier of the ingredient.
Human-readable name of the ingredient (max 100 characters).
Current stock quantity for this ingredient.
POST /api/despensa/{despensaId}/ingredientes/{ingredienteId}
Links an existingIngrediente to a Despensa by inserting a row into the despensa_ingredientes join table. Both the pantry and the ingredient must already exist; this endpoint does not create new records.
The unique identifier of the target pantry.
The unique identifier of the ingredient to link to the pantry.
Request Example
Responses
| Status | Body | Condition |
|---|---|---|
200 OK | "Ingrediente agregado" | The ingredient was successfully linked to the pantry. |
400 Bad Request | "No se pudo agregar" | The pantry ID or ingredient ID does not exist. |
DELETE /api/despensa/{despensaId}/ingredientes/{ingredienteId}
Removes the association between an ingredient and a pantry by deleting the corresponding row from thedespensa_ingredientes join table. The Ingrediente record itself is not deleted — it remains available for use in other pantries or recipes.
The unique identifier of the pantry from which the ingredient should be removed.
The unique identifier of the ingredient to unlink.
Request Example
Responses
| Status | Body | Condition |
|---|---|---|
200 OK | "Ingrediente eliminado" | The ingredient was successfully unlinked from the pantry. |
400 Bad Request | "No se pudo eliminar" | The pantry ID or ingredient ID does not exist. |
Ingrediente API
TheIngredienteController manages Ingrediente records system-wide under /api/ingredientes.
GET /api/ingredientes
Returns everyIngrediente in the database, regardless of which pantry it belongs to.
POST /api/ingredientes
Creates a newIngrediente record. The created record is returned in the response with its assigned id. After creating an ingredient you can link it to a pantry using the POST /api/despensa/{despensaId}/ingredientes/{ingredienteId} endpoint above.
Human-readable name of the ingredient. Maximum 100 characters. Must not be blank.
Initial stock quantity. Must be zero or greater.
PUT /api/ingredientes/{id}/stock
Replaces thecantidadStock value for an ingredient with the supplied value. This is an absolute set operation, not a delta — pass the desired final stock quantity, not an increment or decrement.
The unique identifier of the ingredient whose stock should be updated.
The new stock quantity to set. Must be zero or greater; negative values are rejected.
| Status | Body | Condition |
|---|---|---|
200 OK | "Stock actualizado" | Stock was updated successfully. |
400 Bad Request | "No se pudo actualizar" | The ingredient ID does not exist, or stock is negative. |