Get All Brands
Retrieves all product brands.
Response
Indicates if the request was successful
Array of brand objectsURL to the brand logo image (if uploaded)
{
"success": true,
"data": [
{
"id": 1,
"nombre": "NVIDIA",
"logoUrl": "/uploads/brands/nvidia-logo.png"
},
{
"id": 2,
"nombre": "AMD",
"logoUrl": "/uploads/brands/amd-logo.png"
},
{
"id": 3,
"nombre": "Intel",
"logoUrl": "/uploads/brands/intel-logo.png"
}
]
}
Get Brand by ID
Retrieves a specific brand by its ID.
Path Parameters
The unique identifier of the brand
Response
Indicates if the request was successful
Brand objectURL to the brand logo image
{
"success": true,
"data": {
"id": 1,
"nombre": "NVIDIA",
"logoUrl": "/uploads/brands/nvidia-logo.png"
}
}
Error Responses
{
"success": false,
"error": "Marca no encontrada"
}
Create Brand
POST /api/brands
Content-Type: multipart/form-data
Creates a new brand with optional logo upload.
Authentication
Note: This endpoint requires appropriate permissions to create brands.
Request Body
This endpoint accepts multipart/form-data for file uploads.
Brand logo image file (optional)Accepted formats: Common image formats (JPG, PNG, etc.)
curl -X POST https://api.example.com/api/brands \
-F "nombre=Corsair" \
-F "logo=@/path/to/logo.png"
Response
Indicates if the request was successful
Created brand objectURL to the uploaded brand logo
{
"success": true,
"data": {
"id": 4,
"nombre": "Corsair",
"logoUrl": "/uploads/brands/corsair-logo.png"
}
}
Error Responses
{
"success": false,
"error": "Nombre requerido"
}
Delete Brand
Deletes a brand. Brands with associated products cannot be deleted.
Authentication
Note: This endpoint requires appropriate permissions to delete brands.
Path Parameters
The unique identifier of the brand to delete
Response
Indicates if the request was successful
Error message if deletion failed (e.g., brand has associated products)
{
"success": true,
"message": "Marca eliminada"
}
Error Responses
{
"success": false,
"error": "No se pudo eliminar (¿Tiene productos?)"
}