List Products
Authentication
Required: JWT token via cookieRole: Any authenticated user
Request Parameters
No parameters required.Response
Success indicator
HTTP status code (200)
Empty string
Array of product objects
Example Request
Example Response
Error Responses
401 Unauthorized
Missing or invalid authentication token
500 Internal Server Error
Server error
Create Product
Authentication
Required: JWT token via cookieRole: Any authenticated user
Request Body
Product name
Product price
Initial stock quantity
Product description
Category ID (must exist in Categorias table)
Response
Success indicator
HTTP status code (201)
“Producto registrado exitosamente.”
No data returned
Example Request
Example Response
Error Responses
401 Unauthorized
Missing or invalid authentication token
500 Internal Server Error
Server error or foreign key constraint violation
Get Product by ID
Authentication
Required: JWT token via cookieRole: Any authenticated user
Path Parameters
Product ID
Response
Success indicator
HTTP status code (200)
Empty string
Product object with same structure as list endpoint
Example Request
Example Response
Error Responses
400 Bad Request
Product not found
401 Unauthorized
Missing or invalid authentication token
500 Internal Server Error
Server error
Update Product
Authentication
Required: JWT token via cookieRole: Any authenticated user
Path Parameters
Product ID
Request Body
Product name
Product price
Stock quantity
Product description
Category ID
Response
Success indicator
HTTP status code (200)
“Producto actualizado exitosamente.”
No data returned
Example Request
Example Response
Error Responses
400 Bad Request
Product not found
401 Unauthorized
Missing or invalid authentication token
500 Internal Server Error
Server error
Delete Product
Authentication
Required: JWT token via cookieRole: Any authenticated user
Path Parameters
Product ID
Response
Success indicator
HTTP status code (200)
“Producto eliminado exitosamente.”
No data returned
Example Request
Example Response
Error Responses
400 Bad Request
Product not found
401 Unauthorized
Missing or invalid authentication token
500 Internal Server Error
Server error
Notes
- All timestamps are automatically managed by the database
- The
creadofield is set toCURRENT_TIMESTAMPon creation - The
actualizadofield is updated toCURRENT_TIMESTAMPon every update - Product data is retrieved from the
ProductosViewdatabase view which includes category information - Category ID must reference an existing category in the Categorias table
