Update Category
Update an existing product category.
Endpoint
Authentication
Required (Store role)
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id |
integer | Yes | Category ID |
Request Body
Content-Type: multipart/form-data
Form Fields
| Field | Type | Required | Description |
|---|---|---|---|
name |
string | No | Deprecated fallback (API derives from name_en) |
name_az |
string | No | Category name in Azerbaijani |
name_en |
string | No | Category name in English (stored as fallback name when provided) |
name_es |
string | No | Category name in Spanish |
name_de |
string | No | Category name in German |
parent_id |
integer | No | Parent category ID |
image |
file | No | Category image |
Response
Success (200 OK)
Returns updated category in hierarchical tree structure:
[
{
"id": 1,
"name": "Yenilənmiş Elektronika",
"name_az": "Yenilənmiş Elektronika",
"name_en": "Updated Electronics",
"name_es": "Electrónica Actualizada",
"name_de": "Aktualisierte Elektronik",
"image": "https://...",
"parent_id": null,
"children": []
}
]
Error Responses
Category Not Found (404)
Parent Category Not Found (404)
Cannot Update Main Category (404)
This error occurs when trying to update a top-level category's parent_id.
Example Request
curl -X PUT "https://api.luxmart.site/v1/products/category/?id=1" \
-H "Authorization: Token your_access_token" \
-F "name_az=Yenilənmiş Elektronika" \
-F "name_en=Updated Electronics" \
-F "name_es=Electrónica Actualizada" \
-F "name_de=Aktualisierte Elektronik" \
-F "image=@/path/to/image.jpg"
Notes
- Only provided fields are updated
- Category image is uploaded to S3 if provided
- Top-level categories (with
parent_id: null) cannot have their parent_id changed - Translation Support: Send translations (
name_az,name_en,name_es,name_de). Whenname_enis provided, it is also stored in the fallbacknamefield; you do not need to sendname.