Skip to main content

Recommendations

This API returns AI powered product recommendations based on your configuration for a given page.

Authentication#

You can use API keys or Requesting URLs based on your requirements & preference. Check here to choose one that suits you the best.

Request#

Request Type#

POST

Request Headers#

Content-Type: application/jsonx-api-key: <api_key>
Note:

You can skip sending x-api-key if you choose authentication via Requesting URL.

Endpoint#

The base URL will be provided to you at the time of onboarding.

POST <base_url>/widgets

Request Parameters#

ParamTypeRequiredDescription
mad_uuidstringyesUnique ID to identify the shopper. This should be unique for a particular user session. If you are using the script for tracking events, fetch mad_uuid using this method. If you are only using APIs and not script: use set and get mad_uuid using this method. Note: The same mad uuid should be passed in recommendation, search and events API.
user_idstringyesUnique ID associated by the merchant to the user in the site.
page_namestringyesName of the page for which recommendation is to be fetched. This can be taken from the Experience Details section in the app. Go to Experience Listing Page -> Click on the 'i' icon on the live experience which will open a popup. Pick the value associated with the Page Name label. If page_name is not sent , then module_name is mandatory.
module_namestringnoName of the module for which recommendation is to be fetched. This field needs to be sent when page_name parameter is not used to fetch recommendations.
platformstringyesPlatform where recommendations are viewed. Allowed values: desktop, mobile, android, ios.
product_idstringconditionalIdentifies contextual product's ID in view, for which we require recommendations to be served. Mandatory for contextual recommendations like visually similar products, collaborative filtering etc.
fieldsArray of StringnoList of fields to be fetched for every product in the response. Fields section describes this in detail.
filtersArray of JSON objectsnoList of business rules to be applied to the recommendation results. This overrides the business rules configured in the tool. Filters section describes this in detail
filters_appendArray of JSON objectsnoList of business rules to be applied to the recommendation results. This filter will be applied in addition to the business rules configured in the tool.
Fields#

Fields is a list of strings that indicates the metadata of the products that are returned in the recommendation response. Any field from your catalog can be used here.

Filters#

Filters is a list of business rules that is applied to further refine recommendation results. Ensure that the fields that are defined in business rules are indexed for faster response. The filters applied via the API will always override the filters applied on the tool.

If you need the filters to be applied in addition to the business rules configured in the tool, please use filters_append key. A filter object in the list represents one condition and if there are multiple conditions they are all applied using "AND" operation.

Filter Object Parameters

ParamTypeDescription
fieldMandatory type: stringThe name of the field to apply filter on. For example, brand, category etc.
typeMandatory type: stringThe type of operation
valueMandatory type: stringThe value for the condition

The different values the type parameter supports is described below:

ValuesDescriptionApplicable toValue parameter format
exactUsed for 'equals to' conditionany fielda single value or list of values
not-exactUsed for 'not equals' conditionany fielda single value or list of values
lteUsed for 'less than or equals to' conditionnumbersingle value
ltUsed for 'less than' conditionnumbersingle value
gteUsed for 'greater than or equals to' condition.numbersingle value
gtUsed for 'greater than' conditionnumbersingle value
rangeUsed to indicate a range.numberlist of two values of format [lower-bound, higher-bound]
containsUsed to match the specified words or phrases within a particular stringstringsingle value

The below example shows the filters to be sent to get recommendation results with products of brand Nike or Adidas:

[  {    "field": "brand",    "type": "exact",    "value": [      "Nike",      "Adidas"    ]  }]

Response#

The response will have all the modules placed on the page which is part of a live journey defined in the tool.

Response Parameters#

ParamsDescription
statusIndicates the status of the response. Value ok indicates that the response is successful.
messageDescribes the details of the status other than ok.
dataList of modules that need to be rendered in the page. Every module item will have the name of the module, the number of tiles associated with it and the products that need to be rendered in these tiles.
data -> item -> module_idIndicates the module id used to get the recommendation.
data -> item -> module_nameIndicates the module name used to get the recommendation.
data -> item -> tilesList of tiles associated with the enclosed module.
data -> item -> tiles -> item -> idIndicates the strategy id, that the tile is associated with.
data -> item -> tiles -> item -> nameIndicates the strategy name that the tile is associated with.
data -> item -> tiles -> item -> bundling_typeIs present if applicable. Indicates the bundling strategy used in this tile.
data -> item -> dataList of products to be rendered for the module. If the module is a bundled strategy, then this will be a nested list of products.
_journey_metadata -> audience_idIndicates the audience id for which the recommendation is returned.
_journey_metadata -> page_idIndicates the page id for which the recommendation is returned.
_journey_metadata -> experience_idIndicates the experience id for which the recommendation is returned.
_journey_metadata -> journey_idIndicates the journey id for which the recommendation is returned.

Response Status Code#

Status codes indicate if the response was successful or not. For the different response codes we return, please refer the table below:

Status CodeDescription
200Successful
401Authorization has been denied for this request.
500Unhandled application errors

Response Structure#

{  "status": "ok",  "message": "",  "data": [    {      "module_name": "",      "module_id": "",      "tiles": [        {          "name": "",          "id": "",          "bundling_type": ""        },        {          "name": "",          "id": "",          "bundling_type": ""        }      ],      "data": [        {          "product_id": "",          "field2": "value2"        },        {          "product_id": "",          "field2": "value2"        }      ]    }  ],  "_journey_metadata": {    "audience_id": "",    "page_id": "",    "experience_id": "",    "journey_id": ""  }}

Example 1 - Similarity Module#

Fetching AI recommendations for Product Description Page where response is a similarity module.

Request:

var data = {
"mad_uuid": "a06ca0ed-09ba-4c61-a532-a4ebc5e8a465",
"platform": "desktop",
"product_id": "15015286wq",
"page_name": "Product Description Page"
};
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("POST", "{{base_url}}/widgets");
xhr.setRequestHeader("x-api-key", "9ed6bd6a23db7dd422893e1e0");
xhr.send(data);

Response:

{  "status": "ok",  "message": "",  "data": [    {      "module_name": "Similar - api",      "tiles": [        {          "name": "Visual Similarity",          "id": "3266"        },        {          "name": "Visual Similarity",          "id": "3266"        },        {          "name": "Visual Similarity",          "id": "3266"        },        {          "name": "Visual Similarity",          "id": "3266"        }      ],      "data": [        {          "category": "dresses",          "title": "N°21 Women Short dress Gold 10 UK",          "price": 390,          "image_link": "https://cdn.shopify.com/s/files/1/0504/9152/3250/products/34998328LQ_12_F.jpg?v=1603882417",          "link": "https://vuex-internal-fashion.myshopify.com/products/34998328lq",          "productType": "Dresses",          "ontology": "women>dresses>short dress",          "brand": "N°21",          "product_id": "34998328lq"        },        {          "category": "dresses",          "title": "Dolce & Gabbana Women Short dress Pastel blue 10 UK",          "price": 590,          "image_link": "https://cdn.shopify.com/s/files/1/0504/9152/3250/products/15038426VX_12_F.jpg?v=1603881020",          "link": "https://vuex-internal-fashion.myshopify.com/products/15038426vx",          "productType": "Dresses",          "ontology": "women>dresses>short dress",          "brand": "Dolce & Gabbana",          "product_id": "15038426vx"        },        {          "category": "dresses",          "title": "Hervé Léger Women Short dress Light green S INT",          "price": 950,          "image_link": "https://cdn.shopify.com/s/files/1/0504/9152/3250/products/34820358HP_12_F.jpg?v=1603882314",          "link": "https://vuex-internal-fashion.myshopify.com/products/34820358hp",          "productType": "Dresses",          "ontology": "women>dresses>short dress",          "brand": "Hervé Léger",          "product_id": "34820358hp"        },        {          "category": "dresses",          "title": "Boutique Moschino Women Short dress Dark blue 10 UK",          "price": 279,          "image_link": "https://cdn.shopify.com/s/files/1/0504/9152/3250/products/34992461PI_12_F.jpg?v=1603880803",          "link": "https://vuex-internal-fashion.myshopify.com/products/34992461pi",          "productType": "Dresses",          "ontology": "women>dresses>short dress",          "brand": "Boutique Moschino",          "product_id": "34992461pi"        }      ],      "module_id": "4499"    }  ],  "_journey_metadata": {    "audience_id": "1",    "page_id": "25",    "experience_id": "120",    "journey_id": "56"  }}

Example 2 - Style It With Module#

Fetching AI recommendations for Product Description Page for platform:desktop where response is bundled.

Request:

var data = {
"mad_uuid": "a06ca0ed-09ba-4c61-a532-a4ebc5e8a465",
"platform": "desktop",
"product_id": "15015286wq",
"page_name": "Product Description Page"
};
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("POST", "{{base_url}}/widgets");
xhr.setRequestHeader("x-api-key", "9ed6bd6a23db7dd422893e1e0");
xhr.send(data);

Response:


{  "status": "ok",  "message": "",  "data": [    {      "module_name": "style-it-with",      "tiles": [        {          "name": "Casual Bundling | New",          "bundling_type": "Casual Cross Products",          "id": "372"        },        {          "name": "Casual Bundling | New",          "bundling_type": "Casual Cross Products",          "id": "372"        },        {          "name": "Casual Bundling | New",          "bundling_type": "Casual Cross Products",          "id": "372"        },        {          "name": "Casual Bundling | New",          "bundling_type": "Casual Cross Products",          "id": "372"        },        {          "name": "Casual Bundling | New",          "bundling_type": "Casual Cross Products",          "id": "372"        },        {          "name": "Casual Bundling | New",          "bundling_type": "Casual Cross Products",          "id": "372"        },        {          "name": "Casual Bundling | New",          "bundling_type": "Casual Cross Products",          "id": "372"        },        {          "name": "Casual Bundling | New",          "bundling_type": "Casual Cross Products",          "id": "372"        },        {          "name": "Casual Bundling | New",          "bundling_type": "Casual Cross Products",          "id": "372"        }      ],      "data": [        [          {            "category": "footwear",            "title": "Saint Laurent Women Ankle boots Brown 3 UK",            "price": 890,            "image_link": "https://cdn.shopify.com/s/files/1/0504/9152/3250/products/11826549CE_12_F.jpg?v=1603883513",            "link": "https://vuex-internal-fashion.myshopify.com/products/11826549ce",            "productType": "Footwear",            "ontology": "women>footwear>ankle boots",            "brand": "Saint Laurent",            "product_id": "11826549ce"          },          {            "category": "bags",            "title": "Fendi Women Shoulder bag Ivory -- --",            "price": 1960,            "image_link": "https://cdn.shopify.com/s/files/1/0504/9152/3250/products/45477810RE_12_F.jpg?v=1603877409",            "link": "https://vuex-internal-fashion.myshopify.com/products/45477810re",            "productType": "Bags",            "ontology": "women>bags>shoulder bag",            "brand": "Fendi",            "product_id": "45477810re"          },          {            "category": "eyewear",            "title": "Prada Women Sunglasses Black -- --",            "price": 318,            "image_link": "https://cdn.shopify.com/s/files/1/0504/9152/3250/products/46602886BP_12_F.jpg?v=1603874573",            "link": "https://vuex-internal-fashion.myshopify.com/products/46602886bp",            "productType": "Glasses",            "ontology": "women>eyewear>sunglasses",            "brand": "Prada",            "product_id": "46602886bp"          }        ],        [          {            "category": "footwear",            "title": "Diesel Women Sandals Blue 7.5 UK",            "price": 96,            "image_link": "https://cdn.shopify.com/s/files/1/0504/9152/3250/products/11750697IA_12_F.jpg?v=1603882705",            "link": "https://vuex-internal-fashion.myshopify.com/products/11750697ia",            "productType": "Footwear",            "ontology": "women>footwear>sandals",            "brand": "Diesel",            "product_id": "11750697ia"          },          {            "category": "jewellery",            "title": "Galleria Armadoro Women Earring Gold -- --",            "price": 30,            "image_link": "https://cdn.shopify.com/s/files/1/0504/9152/3250/products/50239511DA_12_F.jpg?v=1603885433",            "link": "https://vuex-internal-fashion.myshopify.com/products/50239511da",            "productType": "Jewellery",            "ontology": "women>jewellery>earring",            "brand": "Galleria Armadoro",            "product_id": "50239511da"          },          {            "category": "eyewear",            "title": "Rejina Pyo X Projekt Produkt Women Sunglasses Brown -- --",            "price": 149,            "image_link": "https://cdn.shopify.com/s/files/1/0504/9152/3250/products/46684725GX_12_F.jpg?v=1603874943",            "link": "https://vuex-internal-fashion.myshopify.com/products/46684725gx",            "productType": "Glasses",            "ontology": "women>eyewear>sunglasses",            "brand": "Rejina Pyo X Projekt Produkt",            "product_id": "46684725gx"          }        ],        [          {            "category": "footwear",            "title": "Dkny Women Low-tops & sneakers White 5.5 UK",            "price": 99,            "image_link": "https://cdn.shopify.com/s/files/1/0504/9152/3250/products/11833641AH_12_F.jpg?v=1603883313",            "link": "https://vuex-internal-fashion.myshopify.com/products/11833641ah",            "productType": "Footwear",            "ontology": "women>footwear>low-tops & sneakers",            "brand": "Dkny",            "product_id": "11833641ah"          },          {            "category": "eyewear",            "title": "Elizabeth And James Women Sunglasses Lilac -- --",            "price": 69,            "image_link": "https://cdn.shopify.com/s/files/1/0504/9152/3250/products/46606563OD_12_F.jpg?v=1603875302",            "link": "https://vuex-internal-fashion.myshopify.com/products/46606563od",            "productType": "Glasses",            "ontology": "women>eyewear>sunglasses",            "brand": "Elizabeth And James",            "product_id": "46606563od"          },          {            "category": "bags",            "title": "Michael Michael Kors Women Handbag Silver -- --",            "price": 137,            "image_link": "https://cdn.shopify.com/s/files/1/0504/9152/3250/products/45455786EX_12_F.jpg?v=1603876178",            "link": "https://vuex-internal-fashion.myshopify.com/products/45455786ex",            "productType": "Bags",            "ontology": "women>bags>handbag",            "brand": "Michael Michael Kors",            "product_id": "45455786ex"          }        ]      ],      "module_id": "1256"    }  ],  "_journey_metadata": {    "audience_id": "1",    "page_id": "25",    "experience_id": "120",    "journey_id": "56"  }}

Example 3 - Multiple Modules#

Fetching AI recommendations for Home Page for platform:mobile and the page contains more than one module.

Request:

var data = {
"mad_uuid": "a06ca0ed-09ba-4c61-a532-a4ebc5e8a465",
"platform": "mobile",
"page_name": "Home Page"
};
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("POST", "{{base_url}}/widgets");
xhr.setRequestHeader("x-api-key", "9ed6bd6a23db7dd422893e1e0");
xhr.send(data);

Response:

{  "status": "ok",  "message": "",  "data": [    {      "module_name": "Inspired by Browsing History 2",      "tiles": [        {          "name": "Inspired By Browsing History",          "id": "995"        },        {          "name": "Inspired By Browsing History",          "id": "995"        },        {          "name": "Inspired By Browsing History",          "id": "995"        },        {          "name": "Inspired By Browsing History",          "id": "995"        }      ],      "data": [        {          "title": "Patrizia Pepe Women Short dress Black 0 Designer",          "price": 109,          "image_link": "https://cdn.shopify.com/s/files/1/0503/3417/1300/products/34807059VW_12_F.jpg?v=1603974606",          "parent_id": "34807059vw",          "link": "https://sales-vuex-fashion.myshopify.com/products/34807059vw",          "ontology": "women>dresses>short dress",          "product_id": "34807059vw"        },        {          "title": "Alberta Ferretti Women Short dress Dark blue 12 UK",          "price": 628,          "image_link": "https://cdn.shopify.com/s/files/1/0503/3417/1300/products/34785159VA_12_F.jpg?v=1603975093",          "parent_id": "34785159va",          "link": "https://sales-vuex-fashion.myshopify.com/products/34785159va",          "ontology": "women>dresses>short dress",          "product_id": "34785159va"        },        {          "title": "Alice + Olivia Women Long dress Black 10 UK",          "price": 580,          "image_link": "https://cdn.shopify.com/s/files/1/0503/3417/1300/products/15010261RK_12_F.jpg?v=1603974385",          "parent_id": "15010261rk",          "link": "https://sales-vuex-fashion.myshopify.com/products/15010261rk",          "ontology": "women>dresses>long dress",          "product_id": "15010261rk"        },        {          "title": "Dsquared2 Women Short dress Black 6 UK",          "price": 390,          "image_link": "https://cdn.shopify.com/s/files/1/0503/3417/1300/products/15007766BJ_12_F.jpg?v=1603974309",          "parent_id": "15007766bj",          "link": "https://sales-vuex-fashion.myshopify.com/products/15007766bj",          "ontology": "women>dresses>short dress",          "product_id": "15007766bj"        }      ],      "module_id": "1744"    },    {      "module_name": "Trending",      "tiles": [        {          "name": "Trending",          "id": "992"        },        {          "name": "Trending",          "id": "992"        },        {          "name": "Trending",          "id": "992"        }      ],      "data": [        {          "title": "Versus Versace Man Backpacks & Bum bags Black -- --",          "price": 274,          "image_link": "https://cdn.shopify.com/s/files/1/0503/3417/1300/products/45429079CU_12_F.jpg?v=1603959090",          "parent_id": "45429079cu",          "link": "https://sales-vuex-fashion.myshopify.com/products/45429079cu",          "ontology": "man>bags>backpacks & bum bags",          "product_id": "45429079cu"        },        {          "title": "Valentino Garavani Man Square scarf Steel grey -- --",          "price": 420,          "image_link": "https://cdn.shopify.com/s/files/1/0503/3417/1300/products/46614169RQ_12_F.jpg?v=1603958268",          "parent_id": "46614169rq",          "link": "https://sales-vuex-fashion.myshopify.com/products/46614169rq",          "ontology": "man>accessories>square scarf",          "product_id": "46614169rq"        },        {          "title": "Valentino Garavani Man Backpacks & Bum bags Dark blue -- --",          "price": 890,          "image_link": "https://cdn.shopify.com/s/files/1/0503/3417/1300/products/45506475OT_12_F.jpg?v=1603959201",          "parent_id": "45506475ot",          "link": "https://sales-vuex-fashion.myshopify.com/products/45506475ot",          "ontology": "man>bags>backpacks & bum bags",          "product_id": "45506475ot"        }      ],      "module_id": "1001"    }  ],  "_journey_metadata": {    "audience_id": "23",    "page_id": "2781",    "experience_id": "1288",    "journey_id": "567"  }}

Example 4 - Auto Bundle Module#

Fetching AI recommendations for Product Description Page for platform desktop for auto bundling module. Auto Bundled modules return bundled output for different themes, which are generated by Algo , based on product in view.
Eg: Style It With module for different occasions.

Request:

var data = {
"mad_uuid": "a06ca0ed-09ba-4c61-a532-a4ebc5e8a465",
"platform": "desktop",
"product_id": "15015286wq",
"page_name": "Product Description Page"
};
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("POST", "{{base_url}}/widgets");
xhr.setRequestHeader("x-api-key", "9ed6bd6a23db7dd422893e1e0");
xhr.send(data);

Response:


{  "status": "ok",  "message": "",  "data": [    {      "module_name": "Style it with",      "tiles": [        {          "name": "Auto bundle",          "bundling_type": "Casual_v1",          "id": "2531"        },        {          "name": "Auto bundle",          "bundling_type": "Casual_v1",          "id": "2531"        },        {          "name": "Auto bundle",          "bundling_type": "Casual_v1",          "id": "2531"        },        {          "name": "Auto bundle",          "bundling_type": "Casual_v1",          "id": "2531"        },        {          "name": "Auto bundle",          "bundling_type": "Party_v1",          "id": "2531"        },        {          "name": "Auto bundle",          "bundling_type": "Party_v1",          "id": "2531"        },        {          "name": "Auto bundle",          "bundling_type": "Party_v1",          "id": "2531"        },        {          "name": "Auto bundle",          "bundling_type": "Party_v1",          "id": "2531"        },        {          "name": "Auto bundle",          "bundling_type": "Office_v1",          "id": "2531"        },        {          "name": "Auto bundle",          "bundling_type": "Office_v1",          "id": "2531"        },        {          "name": "Auto bundle",          "bundling_type": "Office_v1",          "id": "2531"        },        {          "name": "Auto bundle",          "bundling_type": "Office_v1",          "id": "2531"        }      ],      "data": [        {          "bundling_type": "Casual_v1",          "data": [            [              {                "msd_ontology": "women>footwear>sandals>mules",                "product_id": "11633116jo",                "title": "Tory Burch Women Mules Dark blue 2 UK",                "color": "Dark blue",                "price": 162,                "image_link": "https://cdn.shopify.com/s/files/1/0511/2774/6731/products/11633116JO_12_F.jpg?v=1605006991",                "discounted_price": 162,                "link": "https://vuex-uat.myshopify.com/products/11633116jo",                "brand": "Tory Burch"              },              {                "msd_ontology": "women>bags>handbags",                "product_id": "45488936dd",                "title": "3.1 Phillip Lim Women Handbag White -- --",                "color": "White",                "price": 456,                "image_link": "https://cdn.shopify.com/s/files/1/0511/2774/6731/products/45488936DD_12_F.jpg?v=1605014384",                "discounted_price": 456,                "link": "https://vuex-uat.myshopify.com/products/45488936dd",                "brand": "3.1 Phillip Lim"              }            ],            [              {                "msd_ontology": "women>footwear>shoes>ballerinas",                "product_id": "11825267fm",                "title": "8 By Yoox Women Ballet flats Pale pink 2 UK",                "color": "Pale pink",                "price": 110,                "image_link": "https://cdn.shopify.com/s/files/1/0511/2774/6731/products/11825267FM_12_F.jpg?v=1605007942",                "discounted_price": 110,                "link": "https://vuex-uat.myshopify.com/products/11825267fm",                "brand": "8 By Yoox"              },              {                "msd_ontology": "women>jewelry>bracelets",                "product_id": "50237152gl",                "title": "Just Cavalli Women Bracelet Gold -- --",                "color": "Gold",                "price": 71,                "image_link": "https://cdn.shopify.com/s/files/1/0511/2774/6731/products/50237152GL_12_F.jpg?v=1605006359",                "discounted_price": 71,                "link": "https://vuex-uat.myshopify.com/products/50237152gl",                "brand": "Just Cavalli"              }            ]          ]        },        {          "bundling_type": "Party_v1",          "data": [            [              {                "msd_ontology": "women>footwear>sandals>others",                "product_id": "11803191ns",                "title": "Versace Women Sandals Platinum 5.5 UK",                "color": "Platinum",                "price": 555,                "image_link": "https://cdn.shopify.com/s/files/1/0511/2774/6731/products/11803191NS_12_F.jpg?v=1605007150",                "discounted_price": 555,                "link": "https://vuex-uat.myshopify.com/products/11803191ns",                "brand": "Versace"              },              {                "msd_ontology": "women>bags>shoulder_bags",                "product_id": "45510973pg",                "title": "Karl Lagerfeld Women Shoulder bag Black -- --",                "color": "Black",                "price": 202,                "image_link": "https://cdn.shopify.com/s/files/1/0511/2774/6731/products/45510973PG_12_F.jpg?v=1605013893",                "discounted_price": 202,                "link": "https://vuex-uat.myshopify.com/products/45510973pg",                "brand": "Karl Lagerfeld"              }            ],            [              {                "msd_ontology": "women>footwear>others",                "product_id": "11851699kg",                "title": "Dolce & Gabbana Women Court Pink 4 UK",                "color": "Pink",                "price": 590,                "image_link": "https://cdn.shopify.com/s/files/1/0511/2774/6731/products/11851699KG_12_F.jpg?v=1605007958",                "discounted_price": 590,                "link": "https://vuex-uat.myshopify.com/products/11851699kg",                "brand": "Dolce & Gabbana"              },              {                "msd_ontology": "women>jewelry>earrings",                "product_id": "50164108ad",                "title": "Ca&lou Women Earrings Gold -- --",                "color": "Gold",                "price": 109,                "image_link": "https://cdn.shopify.com/s/files/1/0511/2774/6731/products/50164108AD_12_F.jpg?v=1605005666",                "discounted_price": 109,                "link": "https://vuex-uat.myshopify.com/products/50164108ad",                "brand": "Ca&lou"              }            ]          ]        },        {          "bundling_type": "Office_v1",          "data": [            [              {                "msd_ontology": "women>footwear>others",                "product_id": "11582470lr",                "title": "Stuart Weitzman Women Court Pale pink 3.5 UK",                "color": "Pale pink",                "price": 234,                "image_link": "https://cdn.shopify.com/s/files/1/0511/2774/6731/products/11582470LR_12_F.jpg?v=1605008016",                "discounted_price": 234,                "link": "https://vuex-uat.myshopify.com/products/11582470lr",                "brand": "Stuart Weitzman"              },              {                "msd_ontology": "women>jewelry>necklaces",                "product_id": "50236774av",                "title": "Brunello Cucinelli Women Necklace Bronze -- --",                "color": "Bronze",                "price": 664,                "image_link": "https://cdn.shopify.com/s/files/1/0511/2774/6731/products/50236774AV_12_F.jpg?v=1605005865",                "discounted_price": 664,                "link": "https://vuex-uat.myshopify.com/products/50236774av",                "brand": "Brunello Cucinelli"              }            ],            [              {                "msd_ontology": "women>outerwear>blazers",                "product_id": "49221754os",                "title": "Theory Women Blazer Dark blue 16 UK",                "color": "Dark blue",                "price": 209,                "image_link": "https://cdn.shopify.com/s/files/1/0511/2774/6731/products/49221754OS_12_F.jpg?v=1605003996",                "discounted_price": 209,                "link": "https://vuex-uat.myshopify.com/products/49221754os",                "brand": "Theory"              },              {                "msd_ontology": "women>footwear>sandals>others",                "product_id": "11439985ad",                "title": "Saint Laurent Women Sandals Black 6.5 UK",                "color": "Black",                "price": 537,                "image_link": "https://cdn.shopify.com/s/files/1/0511/2774/6731/products/11439985AD_12_F.jpg?v=1605007541",                "discounted_price": 537,                "link": "https://vuex-uat.myshopify.com/products/11439985ad",                "brand": "Saint Laurent"              },              {                "msd_ontology": "women>accessories>watches",                "product_id": "58049491fj",                "title": "Kate Spade New York Women Wrist watch Gold -- --",                "color": "Gold",                "price": 179,                "image_link": "https://cdn.shopify.com/s/files/1/0511/2774/6731/products/58049491FJ_12_F.jpg?v=1605014843",                "discounted_price": 179,                "link": "https://vuex-uat.myshopify.com/products/58049491fj",                "brand": "Kate Spade New York"              }            ]          ]        }      ],      "module_id": "2391"    }  ],  "_journey_metadata": {    "audience_id": "23",    "page_id": "2781",    "experience_id": "1288",    "journey_id": "567"  }}

Example 5 - Request with Region Filter#

If your website & catalog has multi-region data, you will have to pass region filters in the request to get region specific data in the response.

Request:

var data = {
"mad_uuid": "a06ca0ed-09ba-4c61-a532-a4ebc5e8a465",
"platform": "desktop",
"product_id": "15015286wq",
"page_name": "Product Description Page",
"filters_append": [
{
"field": "region_code",
"type": "exact",
"value": [
"US"
]
}
]
};
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("POST", "{{base_url}}/widgets");
xhr.setRequestHeader("x-api-key", "9ed6bd6a23db7dd422893e1e0");
xhr.send(data);

Response:


{  "status": "ok",  "message": "",  "data": [    {      "module_name": "Similar - api",      "tiles": [        {          "name": "Visual Similarity",          "id": "3266"        },        {          "name": "Visual Similarity",          "id": "3266"        },        {          "name": "Visual Similarity",          "id": "3266"        },        {          "name": "Visual Similarity",          "id": "3266"        }      ],      "data": [        {          "category": "dresses",          "title": "N°21 Women Short dress Gold 10 UK",          "price": 390,          "image_link": "https://cdn.shopify.com/s/files/1/0504/9152/3250/products/34998328LQ_12_F.jpg?v=1603882417",          "link": "https://vuex-internal-fashion.myshopify.com/products/34998328lq",          "productType": "Dresses",          "ontology": "women>dresses>short dress",          "brand": "N°21",          "product_id": "34998328lq"        },        {          "category": "dresses",          "title": "Dolce & Gabbana Women Short dress Pastel blue 10 UK",          "price": 590,          "image_link": "https://cdn.shopify.com/s/files/1/0504/9152/3250/products/15038426VX_12_F.jpg?v=1603881020",          "link": "https://vuex-internal-fashion.myshopify.com/products/15038426vx",          "productType": "Dresses",          "ontology": "women>dresses>short dress",          "brand": "Dolce & Gabbana",          "product_id": "15038426vx"        },        {          "category": "dresses",          "title": "Hervé Léger Women Short dress Light green S INT",          "price": 950,          "image_link": "https://cdn.shopify.com/s/files/1/0504/9152/3250/products/34820358HP_12_F.jpg?v=1603882314",          "link": "https://vuex-internal-fashion.myshopify.com/products/34820358hp",          "productType": "Dresses",          "ontology": "women>dresses>short dress",          "brand": "Hervé Léger",          "product_id": "34820358hp"        },        {          "category": "dresses",          "title": "Boutique Moschino Women Short dress Dark blue 10 UK",          "price": 279,          "image_link": "https://cdn.shopify.com/s/files/1/0504/9152/3250/products/34992461PI_12_F.jpg?v=1603880803",          "link": "https://vuex-internal-fashion.myshopify.com/products/34992461pi",          "productType": "Dresses",          "ontology": "women>dresses>short dress",          "brand": "Boutique Moschino",          "product_id": "34992461pi"        }      ],      "module_id": "4499"    }  ],  "_journey_metadata": {    "audience_id": "1",    "page_id": "25",    "experience_id": "120",    "journey_id": "56"  }}

Example 6 - Request for Shop the Look Module#

Fetching AI Shop the Look recommendations for Product Description Page or Listing Page.

Request:

var data = {
"mad_uuid": "a06ca0ed-09ba-4c61-a532-a4ebc5e8a465",
"product_id": "A043950GRAG39Q",
"module_name": "Shop The Look"
};
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("POST", "{{base_url}}/widgets");
xhr.setRequestHeader("x-api-key", "9ed6bd6a23db7dd422893e1e0");
xhr.send(data);

Response:


{  "status": "ok",  "message": "",  "data": [    {      "module_name": "Shop The Look",      "tiles": [        {          "bundling_type": "Shop The Look",          "name": "Shop The Look",          "id": "2334"        },        {          "bundling_type": "Shop The Look",          "name": "Shop The Look",          "id": "2334"        },        {          "bundling_type": "Shop The Look",          "name": "Shop The Look",          "id": "2334"        },        {          "bundling_type": "Shop The Look",          "name": "Shop The Look",          "id": "2334"        }      ],      "errors": {},      "data": [        [          {            "msd_ontology": "women>footwear>sandals>others",            "product_id": "11803191ns",            "title": "Versace Women Sandals Platinum 5.5 UK",            "color": "Platinum",            "price": 555,            "image_link": "https://cdn.shopify.com/s/files/1/0511/2774/6731/products/11803191NS_12_F.jpg?v=1605007150",            "discounted_price": 555,            "link": "https://vuex-uat.myshopify.com/products/11803191ns",            "brand": "Versace"          },          {            "msd_ontology": "women>bags>shoulder_bags",            "product_id": "45510973pg",            "title": "Karl Lagerfeld Women Shoulder bag Black -- --",            "color": "Black",            "price": 202,            "image_link": "https://cdn.shopify.com/s/files/1/0511/2774/6731/products/45510973PG_12_F.jpg?v=1605013893",            "discounted_price": 202,            "link": "https://vuex-uat.myshopify.com/products/45510973pg",            "brand": "Karl Lagerfeld"          },          {            "msd_ontology": "women>footwear>others",            "product_id": "11851699kg",            "title": "Dolce & Gabbana Women Court Pink 4 UK",            "color": "Pink",            "price": 590,            "image_link": "https://cdn.shopify.com/s/files/1/0511/2774/6731/products/11851699KG_12_F.jpg?v=1605007958",            "discounted_price": 590,            "link": "https://vuex-uat.myshopify.com/products/11851699kg",            "brand": "Dolce & Gabbana"          },          {            "msd_ontology": "women>jewelry>earrings",            "product_id": "50164108ad",            "title": "Ca&lou Women Earrings Gold -- --",            "color": "Gold",            "price": 109,            "image_link": "https://cdn.shopify.com/s/files/1/0511/2774/6731/products/50164108AD_12_F.jpg?v=1605005666",            "discounted_price": 109,            "link": "https://vuex-uat.myshopify.com/products/50164108ad",            "brand": "Ca&lou"          }        ]      ],      "module_id": "2334"    }  ],  "_journey_metadata": {}}