Skip to main content

Documentation 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.

The GET /api/productos endpoint returns every product row persisted in the SmartStock360 MySQL database via Spring Data JPA. Clients receive a JSON array of Producto objects, each carrying all the operational and merchandising attributes that feed the AI demand-prediction model — making this endpoint the natural starting point for any dashboard, report, or prediction workflow.

Endpoint

PropertyValue
MethodGET
Path/api/productos
Base URLhttp://localhost:8080
Full URLhttp://localhost:8080/api/productos
CORSAll origins (*)
AuthNone

Request Parameters

This endpoint accepts no query parameters, path variables, or request body.

Response

Returns an HTTP 200 OK with a JSON array. Each element of the array is a Producto object sourced directly from the JPA repository.

Producto Object Fields

id
number
required
Auto-generated primary key assigned by MySQL (IDENTITY generation strategy). Uniquely identifies each product across all API calls.
nombre
string
required
Human-readable product name (e.g. "Laptop Dell XPS 13"). Used for display in dashboards and CSV exports.
precio
number
required
Unit price of the product in local currency. Passed directly to the AI prediction model as a feature.
stockActual
number
required
Number of units currently held in inventory. A value of 0 indicates an out-of-stock condition.
ventas7d
number
required
Total units sold over the preceding 7-day rolling window. Used as a short-term velocity signal by the prediction model.
descuentoPct
number
required
Active discount applied to the product, expressed as an integer percentage. 0 means no active promotion.
temporada
number
required
Encoded season or demand-period indicator:
ValueMeaning
0Normal / off-peak
1Campaña (promotional period)
2Feriado / alta demanda
diasSinReabastecer
number
required
Number of calendar days elapsed since the last stock replenishment event. High values can signal a supply-chain risk flag in the AI model.
ratingProducto
number
required
Customer rating for the product on a scale of 1.0 to 5.0. Influences demand predictions by weighting customer satisfaction signals.

Examples

curl --request GET \
  --url http://localhost:8080/api/productos \
  --header "Accept: application/json"

Example Response

[
  {
    "id": 1,
    "nombre": "Laptop Dell XPS 13",
    "precio": 3499.99,
    "stockActual": 42,
    "ventas7d": 17,
    "descuentoPct": 10,
    "temporada": 1,
    "diasSinReabastecer": 5,
    "ratingProducto": 4.7
  },
  {
    "id": 2,
    "nombre": "Mouse Logitech MX Master 3",
    "precio": 149.90,
    "stockActual": 120,
    "ventas7d": 55,
    "descuentoPct": 0,
    "temporada": 0,
    "diasSinReabastecer": 12,
    "ratingProducto": 4.5
  },
  {
    "id": 3,
    "nombre": "Monitor LG UltraWide 34\"",
    "precio": 1899.00,
    "stockActual": 8,
    "ventas7d": 3,
    "descuentoPct": 15,
    "temporada": 2,
    "diasSinReabastecer": 30,
    "ratingProducto": 4.2
  }
]
@CrossOrigin(origins = "*") is configured on this controller, meaning any origin can call this endpoint from a browser. This is convenient during local development and demo environments, but you should restrict this to trusted domains (e.g. your frontend’s production URL) before deploying to production to prevent unauthorized cross-origin access.

Build docs developers (and LLMs) love