Assigning items to a category

Assigning items to a category ensures that the settings are inherited from the category.

After the link is established between the item and category, it is not necessary to update the item if the category definition is modified.

To assign an item to the category, use the following command:
PATCH https://api.watsoncommerce.ibm.com/catalog/{tenantId}/v1/itemCategories
{
  "itemId": "KROO_001",
  "unitOfMeasure": "EACH",
  "itemCategories": [
     "/Department/KangarooFit/boy/jeans"
  ]
}

After the item KROO_001 is assigned to /Department/KangarooFit/boy/jeans, the item must automatically inherit the item attribute from the parent categoryPath, which is /Department/KangarooFit. You can verify by invoking the GET Item details API.

Check the sample response as follows:
GET https://api.watsoncommerce.ibm.com/catalog/{tenantId}/v1/itemDetails?itemId=KROO_001&unitOfMeasure=EACH
{
    "itemId": "KROO_001",
    "unitOfMeasure": "EACH",
    "primaryInformation": {...},
    "inventoryInformation": {...},
    "inventoryTagInformation": {...},
    "code": {..},
    "itemCategories": ["/Department/KangarooFit/boy/jeans"],
    "itemAssignedAttributes": [
        {
            "itemAttributeName": "Material",
            "itemAttributeGroupPath": "/KangarooFit/Material",
            "inheritedValues": ["FlexoDenim"]
        }
    ]
}

From the payload, it is observed that an itemAssignedAttribute of Material and inheritedValue=FlexoDenim is derived from the parent category level. For any other items that need to inherit the item attribute values, add in the same way against the category.

If an item attribute is directly assigned to an item, the values are displayed as values separately from the inheritedValues so that the catalog manager can differentiate the source setting as shown in the following example.
"itemAssignedAttributes": [ {
      "itemAttributeName": "Display Type",
      "itemAttributeGroupPath": "/TV/DisplayDefinition",
      "values": ["QLED"]
    } ]

The example demonstrates the powerful inheritance hierarchy with the use of category and enables the overall upkeep time and cost reduction on attribute definition for the catalog manager.