configurablebundleocc Extension
The configurablebundleocc extension exposes saved functionality of the Configurable Bundle module in the form of the standardized OCC (Omnichannel Commerce) API. The extension provides REST API endpoints to create, edit, and delete configurable bundles.
About the Extension
| Name | Directory | Related Module |
|---|---|---|
| configurablebundleocc | bin/modules/configurable-bundle/configurablebundleocc | Configurable Bundle Module |
Dependencies
Configurable Bundle OCC Extension Definition
The following sections describe the REST API calls you can make using the Configurable Bundles OCC APIs.
Retrieve a Cart Displaying a Hierarchy of Products
The following table describes the GET method for retrieving a cart with a hierarchy of products.
| HTTP method | GET |
| URI | /{baseSiteId}/users/{userId}/carts/ |
| Request notes |
|
Add a Configurable Bundle to a Cart
The following table describes the POST method for starting a bundle.
| HTTP method | POST |
| URI | /{baseSiteId}/users/{userId}/carts/{cartId}/bundles |
| Request notes |
|
Search for Products that are Allowed to be Added to a Bundle
The following table describes the GET method to search for products allowed to be added to a bundle. The bundle is currently in a cart.
| HTTP method | GET |
| URI | /{baseSiteId}/users/{userId}/carts/{cartId}/entryGroups/{entryGroupNumber}/allowedProductsSearch |
| Request notes |
|
Add a Product to a Bundle
The following table describes the POST method for adding a product to a bundle.
| HTTP method | POST |
| URI | /{baseSiteId}/users/{userId}/carts/{cartId}/entrygroups/{entryGroupNumber} |
| Request notes |
|
Delete a Product from a Bundle
The following table describes the DELETE method for removing a product from a bundle.
| HTTP method | DELETE |
| URI | /{baseSiteId}/users/{userId}/carts/{cartId}/entrygroups/{entryGroupNumber} |
| Request notes |
|
Retrieve the Bundle Templates Associated with a Product
The following table describes the GET method for getting a product and its associated bundles.
| HTTP method | GET |
| URI | /{baseSiteId}/products/{productCode} |
| Request notes |
|
Using the Configurable Bundles OCC API
See examples of using the various OCC CMS REST API calls. In all examples, the host is electronics.local:9002 and the storefront is Electronics.
Get the Bundle Templates Associated with a Product
The following is an example of GET request that returns a product, including the associated bundle templates. A bundle template id is required to call the next endpoint and add a bundle to cart:
https://api.localhost:9002/occ/v2/electronics/products/1934793?fields=DEFAULT
The following is the response:
{
"availableForPickup": true,
"averageRating": 3.5,
"baseOptions": [],
"bundleTemplates": [
{
"id": "StarterDSLRComponentEngraving",
"name": "Personalized Digital SLR Component",
"rootBundleTemplateName": "Personalized Photography Starter Package"
},
{
"id": "PhotoOTGCameraComponent",
"name": "Camera Component",
"rootBundleTemplateName": "Photo On The Go Package"
}
],
"categories": [
{
"code": "576",
"name": "Digital Compacts"
},
{
"code": "brand_10",
"name": "Canon"
},
{
"code": "engraving_powershot"
}
],
"code": "1934793",
"configurable": true,
"configuratorType": "TEXTFIELD",
"description": "<b>Affordable, intuitive and fun, the PowerShot A480 uses Canon know-how to let everyone take great 10 MP photos. Available in four colours, its compact, lightweight design slips easily into any pocket.</b><br/><br/><b>10.0 Megapixels</b><br/>With a 10 Megapixel sensor, you can capture every scene in vivid detail – ready for printing at sizes as large as A3+, or cropping to perfection without losing the detail necessary for larger prints.<br/><br/><b>Compact and colourful</b><br/>Small and light enough to slip into a pocket, the PowerShot A480 has a classic, stylish design that feels great in the hand. Controlled by a simple button layout, it comes in a choice of four attractive colours.<br/><br/><b>3.3x optical zoom</b><br/>Frame every picture perfectly with a Canon 3.3x optical zoom. In combination with digital zoom, magnification of up to 13x can be achieved.<br/><br/><b>DIGIC III</b><br/>As well as powering Face Detection Technology, Canon’s DIGIC III processor provides fast response times, superb image quality and colour reproduction. DIGIC III also delivers advanced noise reduction – ensuring that images remain sharp and clear.<br/><br/><b>15 shooting modes</b><br/>A selection of shooting modes - including dedicated Kids & Pets and Indoor modes - make it easy to get the right settings for any scene. Simply select the mode you want, and let the camera take care of everything else. <br/><br/><b>1cm Macro shooting</b><br/>A special 1cm Super Macro mode allows you to capture small scale detail from as close as 1cm away.<br/><br/><b>Great people shots</b><br/>A suite of Face Detection technologies detects up to nine faces in a scene and adjusts focus, exposure, flash settings and white balance – for optimal results with natural-looking skin tones. <br/><br/><b>Auto Red-Eye Correction</b><br/>Available in shooting or playback mode, Automatic Red-Eye Correction accurately removes the red-eye effect caused by flash. <br/><br/><b>Motion Detection Technology</b><br/>Motion Detection Technology uses changes in scene information and scene brightness to accurately identify subject motion. The optimal ISO level is then automatically set, to minimise blur and maximise image quality.",
"manufacturer": "Canon",
"name": "PowerShot A480",
"numberOfReviews": 2,
"price": {
"currencyIso": "USD",
"formattedValue": "$99.85",
"priceType": "BUY",
"value": 99.85
},
"priceRange": {},
"purchasable": true,
"stock": {
"isValueRounded": false,
"stockLevel": 679,
"stockLevelStatus": "inStock"
},
"summary": "PowerShot A480 - 10.0 MP, 3.3x optical, DIGIC III, 2.5” LCD, red",
"url": "/electronics/products/1934793"
}
Starting a Bundle by Adding the First Product to the Cart
The following is an example of POST request that adds a product to cart, as a first element of a bundle. The product from the previous request is added and the "Photo On The Go Package" bundle is used:
https://api.localhost:9002/occ/v2/electronics/users/anonymous/carts/ba28370a-d3f9-463b-9488-9c7d5e86b074/bundles
Request body:
{
"productCode":1934793,
"quantity":1,
"templateId":"PhotoOTGCameraComponent"
}
The following is the response:
{
"entry": {
"basePrice": {
"currencyIso": "USD",
"formattedValue": "$99.85",
"priceType": "BUY",
"value": 99.85
},
"cancellableQuantity": 0,
"configurationInfos": [
{
"configurationLabel": "Engraved Text",
"configurationValue": "PowerShot",
"configuratorType": "TEXTFIELD",
"status": "SUCCESS"
},
{
"configurationLabel": "Font Size",
"configurationValue": "14",
"configuratorType": "TEXTFIELD",
"status": "SUCCESS"
},
{
"configurationLabel": "Font Type",
"configurationValue": "Comic Sans",
"configuratorType": "TEXTFIELD",
"status": "SUCCESS"
}
],
"entryNumber": 0,
"product": {
"availableForPickup": true,
"averageRating": 3.5,
"baseOptions": [],
"categories": [
{
"code": "576",
"name": "Digital Compacts",
"url": "/Open-Catalogue/Cameras/Digital-Cameras/Digital-Compacts/c/576"
},
{
"code": "brand_10",
"name": "Canon",
"url": "/Brands/Canon/c/brand_10"
},
{
"code": "engraving_powershot",
"url": "///c/engraving_powershot"
}
],
"code": "1934793",
"configurable": true,
"configuratorType": "TEXTFIELD",
"images": [
{
"altText": "PowerShot A480",
"format": "zoom",
"imageType": "PRIMARY",
"url": "/medias/?context=bWFzdGVyfGltYWdlc3wzMzM4NHxpbWFnZS9qcGVnfGhlZC9oNjgvODc5NzM3MTMzNDY4NnxjMWJiMDU3NTczZTM2Zjg2NzQ1Mzc2NzMzYTg4NThhYTU0ZmE5ZjZkMjZlMWEwZGU5NmI5ZGI1ZmMyYjRhM2Ey"
},
{
"altText": "PowerShot A480",
"format": "product",
"imageType": "PRIMARY",
"url": "/medias/?context=bWFzdGVyfGltYWdlc3w2ODIxOHxpbWFnZS9qcGVnfGgzMC9oNDEvODc5NzM5NzcxMjkyNnw5NDFkZjhkNWIyZTE1Zjk2ZjhmYWNmNDZlYmYwNTU3ZWQ3MTE2ZThiYjE5MjkxNGZhM2JkYTc1MzlmMmU2Yzdm"
},
{
"altText": "PowerShot A480",
"format": "thumbnail",
"imageType": "PRIMARY",
"url": "/medias/?context=bWFzdGVyfGltYWdlc3wyODg1fGltYWdlL2pwZWd8aGNjL2g2Ni84Nzk3NDIzOTYwMDk0fDljZDI3NmJiYjNiMGI3NGQzOWQ4MzYxOWFiYWU2Y2NmYjc5NTk2YjIwOGEyYTFmMWU1ODFlYzc5NjQ5MWIzNWE"
},
{
"altText": "PowerShot A480",
"format": "cartIcon",
"imageType": "PRIMARY",
"url": "/medias/?context=bWFzdGVyfGltYWdlc3wxODc5fGltYWdlL2pwZWd8aDRmL2hiMy84Nzk3NDUwMjcyNzk4fGMwNTIyZDY1Mjk4NTI2NjhjN2I0ZWU0NDE4MDEwYTFiYjNiNzFhZGUzMmE0NjE4NzQwYmNhMTA4NzJmZWVlZjY"
}
],
"manufacturer": "Canon",
"name": "PowerShot A480",
"purchasable": true,
"stock": {
"isValueRounded": false,
"stockLevel": 679,
"stockLevelStatus": "inStock"
},
"url": "/Open-Catalogue/Cameras/Digital-Cameras/Digital-Compacts/PowerShot-A480/p/1934793"
},
"quantity": 1,
"returnableQuantity": 0,
"statusSummaryList": [
{
"numberOfIssues": 3,
"status": "SUCCESS"
}
],
"totalPrice": {
"currencyIso": "USD",
"formattedValue": "$99.85",
"priceType": "BUY",
"value": 99.85
},
"updateable": true
},
"quantity": 1,
"quantityAdded": 1,
"statusCode": "success"
}
View the Contents of the Cart
https://api.localhost:9002/occ/v2/electronics/users/anonymous/carts/ba28370a-d3f9-463b-9488-9c7d5e86b074?fields=entryGroups(DEFAULT)
The following is the response:
{
"type": "cartWsDTO",
"entryGroups": [
{
"entries": [],
"entryGroupNumber": 1,
"entryGroups": [
{
"entries": [
{
"cancellableQuantity": 0,
"configurationInfos": [
{
"configurationLabel": "Engraved Text",
"configurationValue": "PowerShot",
"configuratorType": "TEXTFIELD",
"status": "SUCCESS"
},
{
"configurationLabel": "Font Size",
"configurationValue": "14",
"configuratorType": "TEXTFIELD",
"status": "SUCCESS"
},
{
"configurationLabel": "Font Type",
"configurationValue": "Comic Sans",
"configuratorType": "TEXTFIELD",
"status": "SUCCESS"
}
],
"entryNumber": 0,
"product": {
"availableForPickup": true,
"averageRating": 3.5,
"baseOptions": [],
"categories": [
{
"code": "576",
"name": "Digital Compacts"
},
{
"code": "brand_10",
"name": "Canon"
},
{
"code": "engraving_powershot"
}
],
"code": "1934793",
"configurable": true,
"configuratorType": "TEXTFIELD",
"manufacturer": "Canon",
"name": "PowerShot A480",
"purchasable": true,
"stock": {
"isValueRounded": false,
"stockLevel": 679,
"stockLevelStatus": "inStock"
},
"url": "/Open-Catalogue/Cameras/Digital-Cameras/Digital-Compacts/PowerShot-A480/p/1934793"
},
"quantity": 1,
"returnableQuantity": 0,
"statusSummaryList": [
{
"numberOfIssues": 3,
"status": "SUCCESS"
}
],
"totalPrice": {
"currencyIso": "USD",
"value": 99.85
}
}
],
"entryGroupNumber": 2,
"entryGroups": [],
"erroneous": false,
"label": "Camera Component",
"type": "CONFIGURABLEBUNDLE"
},
{
"entries": [],
"entryGroupNumber": 3,
"entryGroups": [],
"erroneous": true,
"label": "Accessory Component",
"type": "CONFIGURABLEBUNDLE"
}
],
"erroneous": false,
"label": "Photo On The Go Package",
"type": "CONFIGURABLEBUNDLE"
}
]
}
Search for Products That Belong to the Added Bundle
The following is an example of the GET request that returns all products that belong in entryGroup 3 from the previous cart.
https://api.localhost:9002/occ/v2/electronics/users/anonymous/carts/ba28370a-d3f9-463b-9488-9c7d5e86b074/entrygroups/3/allowedProductsSearch?currentPage=0&fields=DEFAULT&pageSize=20
The following is the response:
{
"breadcrumbs": [ ],
"currentQuery": {
"query": {
"value": ":relevance"
},
"url": "/entrygroups/CONFIGURABLEBUNDLE/3/?q=%3arelevance"
},
"freeTextSearch": "",
"pagination": {
"currentPage": 0,
"pageSize": 20,
"sort": "relevance",
"totalPages": 1,
"totalResults": 1
},
"products": [
{
"availableForPickup": true,
"averageRating": 4.565217391304348,
"code": "805693",
"configurable": false,
"configuratorType": "",
"description": "-Never miss a precious moment with STAMINA super long battery life. <br/>-New ActiFORCE battery technology for higher capacity, faster recharging time and more accurate and fast remaining capacity indication. <br/>-Hybrid Lithium-ion cells with no ‘Memory",
"firstVariantImage": "/medias/?context=bWFzdGVyfGltYWdlc3wyNjE1fGltYWdlL2pwZWd8aDYxL2hjNC84Nzk3NDQyNjM3ODU0fDBkNzdmNjZlNTIxZjhmYmFhYzk0M2JhZDZhZmIyN2NlYWYxODk5MTBkZmExZWI3YzY1NmRhMDk1Mzk4MzlhYTY",
"manufacturer": "Sony",
"multidimensional": false,
"name": "InfoLITHIUM™ H Series Battery",
"price": {
"currencyIso": "USD",
"formattedValue": "$136.50",
"priceType": "BUY",
"value": 136.5
},
"priceRange": {},
"stock": {
"isValueRounded": false,
"stockLevelStatus": "inStock"
},
"summary": "InfoLITHIUM™ H Series Battery",
"url": "/Open-Catalogue/Components/Power-Supplies/Rechargeable-Batteries/InfoLITHIUM%E2%84%A2-H-Series-Battery/p/805693",
"volumePricesFlag": false
}
],
"sorts": [
{
"code": "relevance",
"name": "Relevance",
"selected": true
},
{
"code": "topRated",
"name": "Top Rated",
"selected": false
},
{
"code": "name-asc",
"name": "Name (ascending)",
"selected": false
},
{
"code": "name-desc",
"name": "Name (descending)",
"selected": false
},
{
"code": "price-asc",
"name": "Price (lowest first)",
"selected": false
},
{
"code": "price-desc",
"name": "Price (highest first)",
"selected": false
}
]
}
Add a Second Product to the Cart to Complete the Bundle
The following is an example of the POST request that adds the product from the previous search to the entryGroup 3.
https://api.localhost:9002/occ/v2/electronics/users/anonymous/carts/ba28370a-d3f9-463b-9488-9c7d5e86b074/entrygroups/3?fields=DEFAULT
Request body:
{
"product":{
"code":"805693"
},
"quantity":1
}
The following is the response:
{
"entry": {
"cancellableQuantity": 0,
"configurationInfos": [],
"entryNumber": 1,
"product": {
"availableForPickup": true,
"averageRating": 4.565217391304348,
"baseOptions": [],
"categories": [
{
"code": "814",
"name": "Rechargeable Batteries"
},
{
"code": "brand_5",
"name": "Sony"
}
],
"code": "805693",
"configurable": false,
"manufacturer": "Sony",
"name": "InfoLITHIUM™ H Series Battery",
"purchasable": true,
"stock": {
"isValueRounded": false,
"stockLevelStatus": "inStock"
},
"url": "/Open-Catalogue/Components/Power-Supplies/Rechargeable-Batteries/InfoLITHIUM%E2%84%A2-H-Series-Battery/p/805693"
},
"quantity": 1,
"returnableQuantity": 0,
"statusSummaryList": [],
"totalPrice": {
"currencyIso": "USD",
"value": 273
}
},
"quantity": 1,
"quantityAdded": 1,
"statusCode": "success"
}