The SmartStock360 Spring Boot service exposes two REST endpoints under theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/JoseOlivares19/Proyecto-PC3-JavaScript-Avanzado/llms.txt
Use this file to discover all available pages before exploring further.
/api/productos path. The first returns the full product catalog from MySQL. The second accepts a product feature payload, proxies it unchanged to the Python FastAPI AI service, and returns the raw JSON string response directly to the caller. Both endpoints are served by the embedded Tomcat container on port 8080.
Base URL: http://localhost:8080
GET /api/productos
Fetches all product records from theproducto MySQL table and returns them as a JSON array. No authentication, query parameters, or request body are required.
Request
ProductoRepository.findAll() internally and serialises the result using Jackson’s default camelCase naming strategy.
Response Fields
Surrogate primary key, auto-assigned by MySQL.
Product display name.
Unit price (decimal).
Current units available in inventory.
Number of units sold in the last 7 days.
Active discount percentage applied to this product (0–100).
Season code —
0 = normal, 1 = campaign, 2 = holiday/high demand.Number of days elapsed since the last restock event.
Average customer rating on a 0.0–5.0 scale.
Example Response
POST /api/productos/predict
Accepts aPredictDto JSON body containing the product’s feature vector, forwards the payload verbatim to the Python FastAPI service at http://127.0.0.1:8001/predict/smart-stock using Spring’s RestTemplate, and returns the raw AI response JSON to the caller.
Request
Request Body Parameters
Unit price of the product. Used as a price-sensitivity signal by the AI model.
Current units in stock. Low values relative to
ventas_7d indicate restock urgency.Units sold in the last 7 days. Primary demand velocity signal.
Active discount percentage (0.0–100.0). Influences demand uplift prediction.
Season code passed directly to the model —
0 = normal, 1 = campaign, 2 = holiday/high demand.Days elapsed since the last restock. High values increase predicted stockout risk.
Average customer rating (0.0–5.0). Higher ratings correlate with higher predicted demand.
Example Request Body
Response
The Spring Boot controller method signature ispublic String predecirStock(...), and produces = "application/json" is set on the @PostMapping. This means the endpoint returns the raw JSON string that RestTemplate receives from the Python FastAPI service, forwarded byte-for-byte to the caller with a Content-Type: application/json response header.
The shape of the JSON body in the response is defined entirely by the Python FastAPI AI service, not by the Spring Boot layer. Refer to the SmartStock AI model reference for the Python-side response contract.
How the Proxy Works
Understanding the internal flow helps when debugging prediction failures:ProductoService constructs a RestTemplate instance directly and issues a synchronous POST. The raw response string from Python is returned as-is, with produces = "application/json" on the controller method ensuring the correct Content-Type header is set in the reply.