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
For more information about user-defined item attributes, see Attribute.
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.
{
"availabilityType": "SELL",
"lines": [{
"lineId": "1",
"itemId": "KettleChips",
"unitOfMeasure": "EACH",
"deliveryMethod": "SHP",
"shipNodes": ["Matrix-Store-001"],
"shipNodeAvailabilities": [...],
"itemAttributes": {
"Brand": ["NoNameBrand"]
}
}]
}
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": [...]
}
}