API Playground

Test the update family endpoint with your own data

Authentication Required

You need to Login to test the API playground

Update Product Family

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.

Note: This operation does not consume credits
Endpoint URL
PUT https://api.commerceclarity.com/api/v1/families/update/{id}

Path Parameters

Parameter Type Required Description
id string Required The unique family identifier (Family ID or family_id)

Request Parameters

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

Request Examples

Basic Request
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"
  }'
PHP Example (Guzzle HTTP Client)
$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);
JavaScript Example (Fetch API)
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();

Response Example

Success Response
{
  "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"
  }
}
Error Response - Validation
{
  "status": "error",
  "message": "Family not found",
  "code": 404
}