Test the update family endpoint with your own data
Update an existing product family
This endpoint allows you to update an existing product family by providing its ID and the fields you want to modify.
Only the fields included in the request will be updated. All other fields will remain unchanged.
PUT https://api.commerceclarity.com/api/v1/families/update/{id}
| Parameter | Type | Required | Description |
|---|---|---|---|
id |
string | Required | The unique family identifier (Family ID or family_id) |
| Parameter | Type | Required | Description |
|---|---|---|---|
name |
string | Optional | New display name for the family |
family_id |
string | Optional | New unique identifier (slug) for the family |
description |
string | Optional | New description for the family |
is_enabled |
boolean | Optional | Enable or disable the family |
curl -X PUT "https://api.commerceclarity.com/api/v1/families/update/507f1f77bcf86cd799439011" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Consumer Electronics",
"description": "Updated electronics and accessories description"
}'
$client = new \GuzzleHttp\Client();
$familyId = '507f1f77bcf86cd799439011';
$response = $client->put('https://api.commerceclarity.com/api/v1/families/update/' . $familyId, [
'headers' => [
'Authorization' => 'Bearer ' . $apiToken,
'Content-Type' => 'application/json',
],
'json' => [
'name' => 'Consumer Electronics',
'description' => 'Updated electronics and accessories description'
]
]);
$data = json_decode($response->getBody(), true);
const familyId = '507f1f77bcf86cd799439011';
const response = await fetch(`https://api.commerceclarity.com/api/v1/families/update/${familyId}`, {
method: 'PUT',
headers: {
'Authorization': `Bearer ${apiToken}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Consumer Electronics',
description: 'Updated electronics and accessories description'
})
});
const data = await response.json();
{
"status": "success",
"message": "Family updated successfully",
"data": {
"_id": "507f1f77bcf86cd799439011",
"name": "Consumer Electronics",
"family_id": "electronics",
"description": "Updated electronics and accessories description",
"is_enabled": true,
"user_id": "507f1f77bcf86cd799439010",
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-20T14:45:00Z"
}
}
{
"status": "error",
"message": "Family not found",
"code": 404
}