Assigning attributes to an item

Before the application considers attributes that are created, you must associate the attribute to one or more items.

Use the Item Assigned Attribute API and associate a created attribute to one or more items. For example, a catalog manager assigns the DisplayType attribute to two televisions, and each with its own DisplayType value of QLED and OLED.

The following example illustrates how to assign attributes to an item.
PATCH https://api.watsoncommerce.ibm.com/catalog/{tenantId}/v1/itemAssignedAttributes
{
  "itemId": "LED_TV_QLED_01",
  "unitOfMeasure": "EACH",
  "itemAssignedAttributes": [{
      "itemAttributeName": "displayType",
      "itemAttributeGroupPath": "/TV/DisplayDefinition",
      "values": ["QLED"]
    }]
}
{
  "itemId": "LED_TV_OLED_01",
  "unitOfMeasure": "EACH",
  "itemAssignedAttributes": [{
      "itemAttributeName": "displayType",
      "itemAttributeGroupPath": "/TV/DisplayDefinition",
      "values": ["OLED"]
    }]
}

The displayType attribute value is set to multipleValueAllowed=false. Applying more than one value results in the API error.

The item attribute assignment enforces a strict modification policy. If an itemAssignedAttribute is already assigned to 1000 item-assigned attribute with a value, then delete the item assignment value, and do not re-create. Modification is not permitted. For example, for LED_TV_OLED_01 the value OLED is assigned, you must first delete the assigned value and then redefine the item-assigned attribute.

To delete a value, call the following API:
DELETE https://api.watsoncommerce.ibm.com/catalog/{tenantId}/v1/itemAssignedAttributes
{
   "itemId": "LED_TV_OLED_01",
   "unitOfMeasure": "EACH",
   "itemAssignedAttributes": [{
      "itemAttributeName": "displayType",
      "itemAttributeGroupPath": "/TV/DisplayDefinition",
      "values": ["OLED"] 
    }]
}
After the attribute is assigned to an item, you can inspect the attribute by calling the Get Item Details API.
GET https://api.watsoncommerce.ibm.com/catalog/{tenantId}/v1/itemDetails?itemId=LCD_TV_QLED_01&unitOfMeasure=EACH
{
  "catalogOrganizationCode": "cat-org1",
  "itemId": "LCD_TV_QLED_01",
  "unitOfMeasure": "EACH",
  "primaryInformation": {},
  "inventoryInformation": {},
  "itemAssignedAttributes": [ {
      "itemAttributeName": "displayType",
      "itemAttributeGroupPath": "/TV/DisplayDefinition",
      "values": ["QLED"]
    } ]
}

If multiple values are displayed for an item, it implies that all the attribute values are supported for the item. For example, for the DisplayType attribute, a seller might model both QLED and MiniLED as an interchangeable value as both are using the same underlying LED display technology.