Despachar insumos a otro restaurante
POST /api/dispatches/create-dispatch
Descripción
Envía insumos de una bodega a un restaurante asociado.
Detalles
Los insumos salen de la bodega elegida en el mismo momento. Cada cantidad se convierte a la unidad base del insumo antes de guardarse. Si no se permiten saldos negativos, se bloquea cuando la bodega no alcanza. El restaurante que recibe ve el despacho en camino al instante.
Permisos requeridos
dispatches.module
Request
| Nombre | Tipo | Requerido | Reglas |
|---|---|---|---|
| dispatchLinkUuid | string | Sí |
min:36
max:36
|
| fromStorageLocationId | int | Sí |
min_value:1
|
| notes | string | No |
max:500
|
| items | array | Sí | — |
| items[].inventoryItemId | int | Sí |
min_value:1
|
| items[].quantity | string | Sí |
decimal
min_value:0
|
| items[].unitId | int | Sí |
min_value:1
|
Ejemplo de request
curl -X POST https://restofy.pro/api/dispatches/create-dispatch \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <accessToken>" \
-d '{
"dispatchLinkUuid": "string",
"fromStorageLocationId": 1,
"items": [
{
"inventoryItemId": 1,
"quantity": "string",
"unitId": 1
}
]
}'
Los valores son demo: reemplázalos por datos reales del negocio.
Ejemplo de respuesta
Actualizado: 2026-11-02T19:00:57Z
HTTP 200
Request
{
"dispatchLinkUuid": "c5e97379-a919-4af5-b238-18f92a538fd4",
"fromStorageLocationId": 1,
"notes": "Pedido de prueba",
"items": [
{
"inventoryItemId": 1,
"quantity": 3,
"unitId": 4
}
]
}
Response
{
"success": true,
"message": "Despacho enviado",
"data": {
"dispatchUuid": "8a9e1dcb-fb81-4dde-b869-a157fc488b97",
"dispatchNumber": 1
}
}