Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/alvarezlautaro/BancoAlimentos/llms.txt

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

The Items Donación API provides read and management access to the individual line items (ItemDonacion) that make up a donation record. Each item captures a specific product, its quantity, unit value, and expiry date. Items are created as part of a Donacion through the Donations API (see Donaciones) — there is no dedicated POST endpoint here. Once created, items can be read, filtered by various criteria, updated, and deleted through this API. All endpoints require a valid JWT and enforce the appropriate Spring Security authority. Base URL: /api/itemdonacion

Endpoints

GET /api/itemdonacion

Returns all donation line items across every donation record. Required authority: ITEM_DONACION_VER

Response

Returns an array of ItemDonacionResponseDTO objects with HTTP 200 OK.
curl -s https://api.example.com/api/itemdonacion \
  -H 'Authorization: Bearer <token>'
[
  {
    "id": 44,
    "fechaVencimiento": "2025-12-31T00:00:00.000+00:00",
    "valorUnitario": 150.0,
    "cantidad": 50,
    "productoNombre": "Arroz",
    "donante": "Alimentos del Sur S.A."
  }
]

GET /api/itemdonacion/{id}

Returns a single donation item by its numeric ID. Required authority: ITEM_DONACION_VER

Path parameters

id
Long
required
The unique numeric identifier of the donation item.

Response

Returns a single ItemDonacionResponseDTO with HTTP 200 OK.
curl -s https://api.example.com/api/itemdonacion/44 \
  -H 'Authorization: Bearer <token>'

GET /api/itemdonacion/producto/{productoId}

Returns all donation items associated with a specific product. Required authority: ITEM_DONACION_VER

Path parameters

productoId
Long
required
The unique numeric identifier of the product to filter by.

Response

Returns an array of ItemDonacionResponseDTO objects whose product matches productoId, with HTTP 200 OK.
curl -s https://api.example.com/api/itemdonacion/producto/3 \
  -H 'Authorization: Bearer <token>'

GET /api/itemdonacion/donacion/{donacionId}

Returns all items belonging to a specific donation record. Required authority: ITEM_DONACION_VER

Path parameters

donacionId
Long
required
The unique numeric identifier of the parent donation.

Response

Returns an array of ItemDonacionResponseDTO objects for the given donation, with HTTP 200 OK.
curl -s https://api.example.com/api/itemdonacion/donacion/12 \
  -H 'Authorization: Bearer <token>'

GET /api/itemdonacion/categoria/{categoria}

Returns all donation items whose associated product belongs to the specified category. Required authority: ITEM_DONACION_VER

Path parameters

categoria
string
required
The product category name to filter by (e.g. "Lácteos", "Cereales").

Response

Returns an array of ItemDonacionResponseDTO objects matching the category, with HTTP 200 OK.
curl -s 'https://api.example.com/api/itemdonacion/categoria/Cereales' \
  -H 'Authorization: Bearer <token>'
[
  {
    "id": 44,
    "fechaVencimiento": "2025-12-31T00:00:00.000+00:00",
    "valorUnitario": 150.0,
    "cantidad": 50,
    "productoNombre": "Arroz",
    "donante": "Alimentos del Sur S.A."
  },
  {
    "id": 51,
    "fechaVencimiento": "2026-03-15T00:00:00.000+00:00",
    "valorUnitario": 95.0,
    "cantidad": 120,
    "productoNombre": "Fideos",
    "donante": "Distribuidora Norte S.R.L."
  }
]

PUT /api/itemdonacion/{id}

Fully replaces an existing donation item. All fields must be supplied. Required authority: ITEM_DONACION_ACTUALIZAR

Path parameters

id
Long
required
The unique numeric identifier of the donation item to update.

Request body

fechaVencimiento
date
required
Product expiry date. Must be a future date. Cannot be null.
valorUnitario
number
Unit monetary value of the product. Must be a positive number.
cantidad
integer
Quantity of units. Must be at least 1.
productoId
Long
required
ID of the associated product. Cannot be null.

Response

Returns the updated ItemDonacionResponseDTO with HTTP 200 OK.
curl -s -X PUT https://api.example.com/api/itemdonacion/44 \
  -H 'Authorization: Bearer <token>' \
  -H 'Content-Type: application/json' \
  -d '{
    "fechaVencimiento": "2026-01-01",
    "valorUnitario": 160.00,
    "cantidad": 75,
    "productoId": 3
  }'

PATCH /api/itemdonacion/{id}

Updates an existing donation item. Accepts the same ItemDonacionRequestDTO body structure as PUT. The server applies the full DTO — supply all fields you want retained. Required authority: ITEM_DONACION_ACTUALIZAR

Path parameters

id
Long
required
The unique numeric identifier of the donation item to update.

Request body

Same fields as PUT /api/itemdonacion/{id}. All validation rules apply.

Response

Returns the updated ItemDonacionResponseDTO with HTTP 200 OK.
curl -s -X PATCH https://api.example.com/api/itemdonacion/44 \
  -H 'Authorization: Bearer <token>' \
  -H 'Content-Type: application/json' \
  -d '{
    "fechaVencimiento": "2026-01-01",
    "valorUnitario": 160.00,
    "cantidad": 80,
    "productoId": 3
  }'

DELETE /api/itemdonacion/{id}

Permanently deletes a donation item by its ID. Required authority: ITEM_DONACION_ELIMINAR

Path parameters

id
Long
required
The unique numeric identifier of the donation item to delete.

Response

Returns HTTP 200 OK with the plain-text body "ItemDonacion eliminado".
curl -s -X DELETE https://api.example.com/api/itemdonacion/44 \
  -H 'Authorization: Bearer <token>'

Schemas

Item donacion request schema

Fields used when updating a donation item (via PUT or PATCH).
fechaVencimiento
date
Product expiry date. Required; must be a future date. Cannot be null.
valorUnitario
number
Unit monetary value. Must be a positive number greater than zero.
cantidad
integer
Number of units. Must be at least 1.
productoId
Long
ID of the associated product entity. Required; cannot be null.

Item donacion response schema

Fields returned in all item read and update operations.
id
Long
Unique numeric identifier of the donation item.
fechaVencimiento
date
Product expiry date (ISO 8601 timestamp).
valorUnitario
number
Unit monetary value of the product.
cantidad
integer
Number of units in this item line.
productoNombre
string
Human-readable name of the associated product.
donante
string
Legal name (razón social) of the donor company linked to the parent donation.

Creating items

Donation items are not created through this API directly. They are submitted as the items array when calling POST /api/donaciones or PUT /api/donaciones/{id}. See the Donaciones API for the creation workflow and the full ItemDonacionRequestDTO structure.

Error responses

HTTP StatusCondition
400 Bad RequestValidation failure — e.g. past fechaVencimiento, non-positive valorUnitario, cantidad less than 1, or null productoId.
401 UnauthorizedMissing or invalid JWT.
403 ForbiddenValid JWT but the user lacks the required authority.
404 Not FoundNo item found for the supplied id.

Build docs developers (and LLMs) love