Sample request and response to integrate a search page widget
The following sections contain a sample request and response for the scenario described in Create a request to get search page data.
Request
Request
{ "context": { "page": { "uri": "/search" }, "user": { "uuid": "sampleUUID" } }, "widget": { "rfkid": "rfkid_7" }, "n_item": 1, "page_number": 1, "query": { "keyphrase": { "value": [ "sanda" ] } }, "suggestion": { "keyphrase": { "max": 1 } }, "facet": { "all": true }, "sort": { "value": [ { "name": "rating", "order": "desc" } ] }, "content": { "product": {} } ,"request_for":["query"] }
Response
Response
Here is how to read the response to get the data you need:
-
Within the content response object, there is a nested
productand thenvalueobject. You can get the information you need to populate one product slot from the keys and values in thevalueobject. -
Get the order of facets from the
facet_namesarray, the facet name from thedisplay_namekey of the response facet object, and the content from thevaluekey of the response facet object.
Here is a sample response:
{ "facet": { "genders": { "number_of_products": 1131, "display_name": "Gender", "value": [ { "count": 620, "text": "Women's", "id": "facet_idV29tZW4ncw==", "in_content": "product" }, { "count": 322, "text": "Men's", "id": "facet_idTWVuJ3M=", "in_content": "product" } ] }, "sizes": { "number_of_products": 1131, "display_name": "Sizes", "value": [ { "count": 412, "text": "5.0", "id": "facet_idNS4w", "in_content": "product" }, { "count": 569, "text": "6.0", "id": "facet_idNi4w", "in_content": "product" } ] }, "kidsSizeBucket": { "number_of_products": 1650, "display_name": "Age Group", "value": [ { "count": 118, "text": "Little Kids", "id": "facet_idTGl0dGxlIEtpZHM=", "in_content": "product" }, { "count": 50, "text": "Toddlers", "id": "facet_idVG9kZGxlcnM=", "in_content": "product" } ] }, "webwidths": { "number_of_products": 1083, "display_name": "Width", "value": [ { "count": 1073, "text": "Medium", "id": "facet_idTWVkaXVt", "in_content": "product" }, { "count": 114, "text": "Wide", "id": "facet_idV2lkZQ==", "in_content": "product" } ] }, "technology_feature_name": { "number_of_products": 625, "display_name": "Feature", "value": [ { "count": 328, "text": "Memory Foam", "id": "facet_idTWVtb3J5IEZvYW0=", "in_content": "product" }, { "count": 205, "text": "Air-Cooled Memory Foam", "id": "facet_idQWlyLUNvb2xlZCBNZW1vcnkgRm9hbQ==", "in_content": "product" } ] }, "cattype": { "number_of_products": 1084, "display_name": "Occasion", "value": [ { "count": 794, "text": "Casual", "id": "facet_idQ2FzdWFs", "in_content": "product" }, { "count": 299, "text": "Athletic", "id": "facet_idQXRobGV0aWM=", "in_content": "product" } ] }, "brands": { "number_of_products": 1072, "display_name": "Collection", "value": [ { "count": 250, "text": "Performance", "id": "facet_idU2tlY2hlcnMgUGVyZm9ybWFuY2U=", "in_content": "product" }, { "count": 156, "text": "Sport", "id": "facet_idU3BvcnQ=", "in_content": "product" } ] }, "category_shape": { "number_of_products": 1084, "display_name": "Style", "value": [ { "count": 444, "text": "Sandal", "id": "facet_idU2FuZGFs", "in_content": "product" }, { "count": 385, "text": "Sneaker", "id": "facet_idU25lYWtlcg==", "in_content": "product" } ] }, "primary_color": { "number_of_products": 6168, "display_name": "Color", "value": [ { "count": 685, "text": "BLACK", "id": "facet_idQkxBQ0s=", "in_content": "product" }, { "count": 77, "text": "BLUE", "id": "facet_idQkxVRQ==", "in_content": "product" } ] } }, "total_item": 1131, "facet_names": [ "genders", "sizes", "kidsSizeBucket", "webwidths", "technology_feature_name", "cattype", "brands", "category_shape", "primary_color" ], "suggestion": { "keyphrase": [ { "text": "sandal", "freq": 1292, "in_content": "product", "id": "suggestion_idc2FuZGFs" } ] }, "url": "?data%3D%7B%22sdesc%22%7D%2C%20%22max%22%3A%201%722%3A%20%22sandal%22%7D%2C%20%22n_item%22%3A%201%7D", "widget": { "rfkid": "rfkid_7", "used_in": "page", "variation_id": "592734", "type": "content_grid" }, "dt": 81, "ts": 1654137529683, "autocomplete": "sandal", "request_for": { "query": { "orig_keyphrase": "sanda", "keyphrase": "sandal" } }, "page_number": 1, "total_page": 1131, "rid": "response_id:45123878:34f26239177a9137ff4a2360fa0ad9f85b355ea8", "content": { "product": { "total_item": 1131, "n_item": 1, "value": [ { "division_name": "CALI", "prod_color_count": "5", "color": "SLT", "price": "65.00", "category_names": [ "Women", "Breathable", "Sandals", "Shoes", "Website Premieres", "Stretch Fit", "Arch Fit", "Women-shop-all" ], "sku_url": "/women/shoes/arch-fit---city-catch/119236_SLT.html", "swatch_index": 0, "variation_product_id": "119236_SLT", "brands": [ "Arch Fit" ], "swatch": [ { "swatch_landing_url": "/women/shoes/<URL>.html", "sku_url": "/women/shoes/<URL>.html", "color": "SLT", "swatch_image_url": "https://<url>", "swatch_style": "#000000", "primary_color": "BLUE", "sku_image_url": "https://" }, { "swatch_landing_url": "/women/shoes/<url>.html", "sku_url": "/women/shoes/<url>.html", "color": "NVY", "swatch_image_url": "https://<url>", "swatch_style": "#0e1e53", "primary_color": "NAVY", "sku_image_url": "https://<url>" } ], "id": 997986357, "webwidth_flag": "0", "size": "7.0", "sku": "195204519462", "skuid": 1816486109, "color_swatch_show_count": 2, "name": "Women's Arch Fit - City Catch", "color_swatch": [ { "swatch_landing_url": "/women/shoes/<url>.html", "color": "SLT", "swatch_style": "#000000", "primary_color": "BLUE", "swatch_image_url": "" }, { "swatch_landing_url": "/women/shoes/<url>.html", "color": "NVY", "swatch_style": "#0e1e53", "primary_color": "NAVY", "swatch_image_url": "https://<url>" } ], "style_num": "119236", "original_name": "Arch Fit - City Catch", "url": "/women/shoes/<url>", "image_url": "https://<url>", "final_price": "65.00", "primary_color": "BLUE", "product_group": "119236", "brand": "Arch Fit", "sku_image_url": "https://<url>", "thumbnail_image_url": "https://<url>" } ] } }, "query2id": { "keyphrase": "keyphrasec2FuZGE=" }, "n_item": 1 }