Extending item attributes for availability and events

You can extend item attributes for availability and events to eliminate the additional catalog lookup and also improve the e-commerce page performance.

Usually, an e-commerce platform requires more information beyond the availability of an item. For instance, when you look up availability for item01, the product details page may also need to pull the item details such as the item description, price, global item ID, and other details so that the e-commerce page is shown correctly. To complete this task, the e-commerce platform may need to invoke both inventory lookup and their own catalog to obtain the needed catalog data. The additional lookup introduces latency to the overall page performance.

In the second case, you can build a local product detail page cache through availability events. Due to the high volume event data consumption, the effort and cost of event consumption can be reduced, if the event itself contains the catalog data so additional external API calls are no longer necessary for the product detail page building activity.

The application provides a functionality to extend item attributes information in the availability response and event publish. For example, when inquiring for availability of Item01, the fulfillment manager may also configure the availability API to always include item description in the response.

Some examples of item attributes that a seller may expose include:

  • Brand
  • GTIN
  • Size or color
  • Item Description
  • Manufacturer
The extensibility feature allows you to include a user-defined item attribute. The application can expose up to 20 item attribute in both availability and event outputs.
Note: Snapshot events currently does not support item attribute publishing. This includes productAvailabilitySnapshot.v2 and dgAvailabilitySnapshot.v2 events.

For more information about user-defined item attributes, see Attribute.

After the user-defined item attributes are configured, declaration is needed for each attribute that is to be exposed in availability and events. Complete this step by using the Set attribute to publish API. Suppose the Brand attribute is defined as an item attribute, the input to the set attribute to publish the API looks as follows.
PUT https://api.watsoncommerce.ibm.com/inventory/{tenantId}/v1/configuration/publishAttributes

[ "Brand" ]

After the declaration is complete, the future availability API and the event published include the item attribute under the itemAttributes element in the output payload.

The following sample code illustrates the node availability output.
{
  "availabilityType": "SELL",
  "lines": [{
      "lineId": "1",
      "itemId": "KettleChips",
      "unitOfMeasure": "EACH",
      "deliveryMethod": "SHP",
      "shipNodes": ["Matrix-Store-001"],
      "shipNodeAvailabilities": [...],
      "itemAttributes": {
        "Brand": ["NoNameBrand"]
      }
    }]
}
The following sample code illustrates the productAvailability.v2 event output.
{
  "type": "productAvailability.v2",
  "datacontenttype": "application/json",
  "id": "2a8d36a3-485b-3fc0-bd15-d530625a6ec5",
  "specversion": "1.0",
  "time": "2021-03-10T00:00:00.288Z",
  "data": {
    "itemAttributes": {
      "Brand": ["NoNameBrand"]
    },
    "computeTs": "2021-03-10T00:00:00.097Z",
    "productId": "SHIRT",
    "deliveryMethod": "SHP",
    "shipNode": "store-BostonMA",
    "unitOfMeasure": "EACH",
    "currentAvailability": {...},
    "futureAvailability": [...]
  }
}