SmartLogix gives you a real-time view of your product catalog and warehouse stock. You can add products with their SKU, price, and physical location, set minimum stock thresholds to trigger alerts before you run out, and query whether a product has sufficient stock for a new order. All inventory operations go through the API gateway at http://localhost:8080.
Product fields
Every product in the inventory has the following attributes:
| Field | Type | Required | Description |
|---|
sku | string | Yes | Unique product code within SmartLogix |
nombre | string | Yes | Product display name |
precioUnitario | number | Yes | Unit price (must be ≥ 0) |
stockActual | integer | Yes | Current quantity on hand |
umbralMinimo | integer | Yes | Minimum stock level before an alert is triggered |
bodega | string | No | Physical warehouse location (e.g., "Bodega A - Estante 3") |
descripcion | string | No | Free-text product description |
Add a product
Send a POST request to /api/inventario with the product details. The SKU must be unique — duplicate SKUs are rejected.
curl -X POST http://localhost:8080/api/inventario \
-H "Authorization: Bearer <your-token>" \
-H "Content-Type: application/json" \
-d '{
"sku": "PRD-001",
"nombre": "Cable HDMI 2m",
"precioUnitario": 12.99,
"stockActual": 150,
"umbralMinimo": 20,
"bodega": "Bodega A - Estante 3",
"descripcion": "Cable HDMI de alta velocidad, 2 metros"
}'
A 201 Created response returns the full product object including its generated id.
Update a product
Use PUT /api/inventario/{id} to update any product field, including stock level after a manual count or restock.
curl -X PUT http://localhost:8080/api/inventario/1 \
-H "Authorization: Bearer <your-token>" \
-H "Content-Type: application/json" \
-d '{
"sku": "PRD-001",
"nombre": "Cable HDMI 2m",
"precioUnitario": 14.99,
"stockActual": 200,
"umbralMinimo": 25,
"bodega": "Bodega A - Estante 3"
}'
Check low-stock alerts
SmartLogix automatically flags any product where stockActual is below umbralMinimo. Retrieve the full list of low-stock products with a single request.
curl http://localhost:8080/api/inventario/alertas \
-H "Authorization: Bearer <your-token>"
The response is an array of product objects currently in an alert state. An empty array means all products are above their thresholds.
Set umbralMinimo to reflect realistic lead times for restocking. A product that takes two weeks to reorder should have a higher threshold than one available for next-day delivery. A threshold of zero disables the alert for that product.
Verify stock for an order
Before creating an order, you can check whether a product has enough stock to fulfil a given quantity. This is also the endpoint that the order service calls internally when processing new orders.
curl "http://localhost:8080/api/inventario/1/stock?cantidad=10" \
-H "Authorization: Bearer <your-token>"
Returns true if stockActual >= cantidad, false otherwise. If the product ID does not exist, the endpoint returns 404 Not Found.
Endpoint reference
| Method | Path | Description |
|---|
GET | /api/inventario | List all products |
POST | /api/inventario | Add a new product |
GET | /api/inventario/{id} | Get a product by ID |
PUT | /api/inventario/{id} | Update a product |
DELETE | /api/inventario/{id} | Delete a product |
GET | /api/inventario/{id}/stock?cantidad=N | Check if product has sufficient stock |
GET | /api/inventario/alertas | List all products below umbralMinimo |