Update Attributes

PATCH /wp-json/content-api/v1/attributes/

Updates attributes for a specific product.

Authentication

This endpoint requires a Bearer token in the Authorization header. To authenticate:

  1. Go to Content API > Settings in your WordPress admin panel.
  2. Set a secure token in the “Token” field and save it.
  3. Include the token in your request header as follows:
Authorization: Bearer <your-token-here>

Replace <your-token-here> with the token you configured.

Parameters

Name Type Description Required
id integer Product ID Yes
attributes array Array of attributes (name and value) Yes

Example Request

{
  "id": 123,
  "attributes": [
    {
        "name": "Color",
        "value": ["Red", "Green"]
    }
  ]
}

Example Response

{
  "success": true,
  "message": "Product attributes updated successfully.",
  "product_id": 123
}

Possible Errors

Code Message Description HTTP Status
not_authorized Not Authorized The provided Bearer token is invalid or does not match the configured token. 401
data_missing Missing JSON data No parameters were provided in the request body. 400
invalid_product Invalid product ID The provided id parameter is not a valid product ID or does not correspond to a product. 400
no_attributes Invalid attributes formatting The attributes parameter is empty or not formatted as an array. 400
invalid_attribute Each attribute must include ‘name’ and ‘value’ An attribute in the attributes array is missing the required name or value fields. 400
attribute_does_not_exist The attribute [attribute_name] does not exist. The specified attribute name does not correspond to an existing taxonomy-based attribute. 400