Endpoint
Overview
Parameters are reusable status configurations that can be assigned to products, suppliers, and other entities. Each parameter has a code, name, description, and color for UI display.Get All Parameters
Retrieve all parameters with product counts.Response
Response Fields
Unique parameter identifier
Parameter code (auto-generated if not provided)
Parameter name (max 50 characters, unique)
Parameter description
Hex color code in format #RRGGBB
Number of products using this parameter
Create Parameter
Create a new parameter configuration.Request Parameters
Parameter name (max 50 characters, must be unique)
Parameter code (auto-generated if empty, must be unique)
Parameter description
Hex color code (must match format #RRGGBB)
Validation Rules
- nombre: Required, max 50 characters, must be unique
- codigo: Optional, auto-generated as 3-digit padded number if empty (e.g., “001”, “002”)
- If provided, must be unique
- color: Optional, defaults to
#4a90e2- Must match regex pattern:
^#[0-9A-Fa-f]{6}$ - Format: # followed by exactly 6 hexadecimal characters
- Must match regex pattern:
- descripcion: Optional, no length limit
Auto-Generated Codes
Response
Update Parameter
Update an existing parameter’s information.Request Parameters
Parameter ID to update (must be greater than 0)
New parameter name (max 50 characters)
New parameter description
New hex color code (must match format #RRGGBB)
Validation Rules
- id: Required, must be greater than 0, parameter must exist
- nombre: Required, max 50 characters, must be unique (excluding current parameter)
- color: Must match regex pattern
^#[0-9A-Fa-f]{6}$ - codigo: Cannot be updated (read-only after creation)
- Updates
fecha_actualizaciontimestamp automatically
Response
The
codigo field is immutable and cannot be changed after creation. Only nombre, descripcion, and color can be updated.Delete Parameter
Delete a parameter from the system.Request Parameters
Parameter ID to delete (must be greater than 0)
Validation Rules
- id: Required, must be greater than 0
- Cannot delete if parameter has associated products
- Checks
productostable forparametro_idforeign key references
Response
Database Schema
Parameters are stored in theparametros table:
Usage Examples
Product Status Management
Color Validation
Valid color formats:Error Codes
| Error Message | Cause | Solution |
|---|---|---|
Datos inválidos | Invalid JSON | Check JSON syntax |
El nombre es obligatorio | Missing nombre | Include nombre in request |
Longitud de nombre inválida | Name exceeds 50 chars | Shorten parameter name |
Color inválido. Use formato #RRGGBB | Invalid color format | Use hex format like #4a90e2 |
Código o nombre ya existe | Duplicate codigo or nombre | Use unique values |
ID y nombre son obligatorios | Missing id or nombre in PUT | Include both fields |
No encontrado | Parameter doesn’t exist | Check parameter ID |
ID inválido | Invalid ID | Provide valid ID > 0 |
No se puede eliminar: tiene productos asociados | Has product references | Reassign products first |