Create a bundle parent with a bundle kit code and associate the component items
After creating the component items, a bundle parent item must be created with the corresponding kit code by using the Upsert Items API.
The kit code in this case is BUNDLE. Followed by the creation of item, you can associate the
component item to the bundle parent by using the Upsert Item Component API. For example, to create a
bundle parent,
WINE_CHEESE_GIFTSET
with
kitCode=BUNDLE
.POST https://api.watsoncommerce.ibm.com/catalog/{tenantId}/v1/items
{
"items": [{
"itemId": "WINE_CHEESE_GIFTSET",
"unitOfMeasure": "EACH",
"itemGroupCode": "PROD",
"primaryInformation": {
"kitCode": "BUNDLE"
}
}]
}
Associate the components to the gift set.
PATCH https://api.watsoncommerce.ibm.com/catalog/{tenantId}/v1/itemComponents
{
"itemId": "WINE_CHEESE_GIFTSET",
"unitOfMeasure": "EACH",
"components": [
{"componentItemId": "GIFT_BASKET", "componentUnitOfMeasure": "EACH", "kitQty": 1},
{"componentItemId": "MERLOT", "componentUnitOfMeasure": "EACH", "kitQty": 1},
{"componentItemId": "SWISS", "componentUnitOfMeasure": "EACH", "kitQty": 1},
{"componentItemId": "CHEDDAR", "componentUnitOfMeasure": "EACH", "kitQty": 2}
]
}
To verify that the bundle is created correctly, invoke the Get Item Detail
API.
GET https://api.watsoncommerce.ibm.com/catalog/{tenantid}/v1/itemDetails?itemId=WINE_CHEESE_GIFTSET&unitOfMeasure=EACH
Response:
{
"itemId": "WINE_CHEESE_GIFTSET",
"unitOfMeasure": "EACH",
"itemGroupCode": "PROD",
"primaryInformation": {
"kitCode": "BUNDLE"
},
"components": [
{"componentItemId": "GIFT_BASKET", "componentUnitOfMeasure": "EACH","kitQty": 1.0},
{"componentItemId": "MERLOT","componentUnitOfMeasure": "EACH","kitQty": 1.0},
{"componentItemId": "SWISS","componentUnitOfMeasure": "EACH","kitQty": 1.0},
{"componentItemId": "CHEDDAR","componentUnitOfMeasure": "EACH","kitQty": 2.0}
]
}
As a result of your verification, the WINE_CHEESE_GIFTSET
contains 4 component
items, and each with a kit quantity of 1 and for CHEDDAR
, a kit quantity of 2.
For more information, see Bundle availability.