2.3 KiB
2.3 KiB
Brands API
Base URL: /api
All responses follow the standard wrapper:
{
"success": true,
"statusCode": 200,
"path": "/api/brands",
"timestamp": "2026-03-26T10:00:00.000Z",
"data": {}
}
Brand Model
idnameslugimageUrltypecreatedAtupdatedAt
Public Brand APIs
GET /api/brands
Returns brand list for storefront and admin forms.
GET /api/brands/:id
Returns one brand.
Admin Brand APIs
These endpoints require:
- Bearer token
- Admin role
brands.managepermission
POST /api/brands
Content type: multipart/form-data
Fields:
nameslugtypeexistingImageUrlimagefile
Behavior:
- if
imageis uploaded, backend stores it and uses the uploaded URL - if
existingImageUrlis sent, backend uses that existing media URL
PATCH /api/brands/:id
Content type: multipart/form-data
Fields:
nameslugtypeexistingImageUrlimagefile
Behavior:
- if
imageis uploaded, old image is replaced - if
existingImageUrlis sent, selected existing media URL is used - if
existingImageUrlis empty, image is cleared
DELETE /api/brands/:id
Deletes brand and its image.
Product API Changes
Product create and update now support brand selection by brandId.
Product create/update fields related to brand
brandIdoptionalbrandoptional fallback text
Recommended frontend behavior:
- Load brands from
GET /api/brands - Let admin select one brand
- Send
brandId - Do not rely on manual
brandtext unless you explicitly want a fallback
Product list filters
GET /api/admin/products and GET /api/products now support:
brandIdbrand
brandId is the preferred filter.
Product response
Product responses now include:
brandbrandInfo
brandInfo shape:
{
"id": "uuid",
"name": "SKF",
"slug": "skf",
"imageUrl": "https://cdn.example.com/brands/skf.jpg",
"type": "bearing"
}
Frontend Integration Notes
- Use brand image in admin selects/cards where useful
- For add/edit product page, load brands first
- Filter brands by product
typeon frontend if needed - Use the same media picker flow as categories:
- either upload a new image
- or pick an existing media URL and send
existingImageUrl