Sample request and response to integrate a preview search widget

The following sections contain sample requests and responses for two scenarios, when a user first clicks in a search field and when a user types in a search field.

First click, no keyphrase

This is a sample request and response for when a user first clicks with a search field before they type anything.

Request

RequestResponse
{
    "context": {
        "page": {
            "uri": "/"
        },
        "user": {
            "uuid": "sampleUUID"
        }
    },
    "widget": {
        "rfkid": "rfkid_7"
    },
    "n_item": 3,
    "suggestion": {
        "keyphrase": {
            "max": 4
        }
    },
    "facet": {
        "total": true,
        "category_accessory": {
            "sort": {
                "value": [
                    {
                        "type": "count"
                    }
                ]
            }
        }
    },
    "content": {
        "product": {
            "field": {
                "value": [
                    "size",
                    "color_swatch"
                ]
            }
        }
    },
    "appearance": {}
}

Response

Within the content response object, there is a nested product and then value object. You can get the information you need to populate one product slot from the keys and values in the value object.

RequestResponse
{

    "total_item": 2993,
    "suggestion": {
        "trending_category": [
            {
                "text": "bobs",
                "in_content": "product",
                "id": "suggestion_idYm9icw=="
            },
            {
                "text": "work and safety",
                "in_content": "product",
                "id": "suggestion_idd29yayBhbmQgc2FmZXR5"
            },
            {
                "url": "/technologies/comfort-technologies/",
                "text": "comfort technologies",
                "in_content": "product",
                "id": "suggestion_idY29tZm9ydCB0ZWNobm9sb2dpZXM="
            },
            {
                "url": "/technologies/collections/womens/foamies/",
                "text": "foamies",
                "in_content": "product",
                "id": "suggestion_idZm9hbWllcw=="
            }
        ]
    },
    "url": "?data%3D%7B%22widget%22%3A%20%7B%22rfkid%22%3A%20%22rfkid_6%22%2C%20%22used_in%22%3A%20%22common_across_pages%22%2C%20%22variation_id%22%3A%20%22570628%22%2C%20%22type%22%3A%20%22preview_search%22%7D%2C%20%22context%22%3A%20%7B%22page%22%3A%20%7B%22uri%22%3A%20%22%5C%5C%22%7D%2C%20%22user%22%3A%20%7B%22uuid%22%3A%20%22sampleUUID%22%7D%7D%2C%20%22force_v2_specs%22%3A%20true%2C%20%22content%22%3A%20%7B%22product%22%3A%20%7B%22max%22%3A%203%7D%7D%2C%20%22suggestion%22%3A%20%7B%22trending_category%22%3A%20%7B%22max%22%3A%204%2C%20%22in_content%22%3A%20%7B%22type%22%3A%20%22product%2Carticle%22%7D%7D%7D%2C%20%22query%22%3A%20%7B%22orig_keyphrase%22%3A%20%22%22%2C%20%22keyphrase%22%3A%20%22%22%7D%2C%20%22n_item%22%3A%203%7D",
    "widget": {
        "rfkid": "rfkid_6",
        "used_in": "common_across_pages",
        "variation_id": "570628",
        "type": "preview_search"
    },
    "dt": 57,
    "ts": 1654199819426,
    "content": {
        "product": {
            "total_item": 2993,
            "n_item": 3,
            "value": [
                {
                    "division_name": "BOBS WOMENS",
                    "prod_color_count": "15",
                    "color": "NVY",
                    "price": "50.00",
                    "category_names": [
                        "campaign",
                        "Slip-Ons",
                        "Shop",
                        "Women",
                        "Casual Sneakers",
                        "beach-casuals",
                        "Collections",
                        "Canvas Shoes",
                        "Shoes",
                        "Women-shop-all"
                    ],
                    "sku_url": "/m/in-stock/bobs-b-cute/33492_NVY.html",
                    "swatch_index": 0,
                    "variation_product_id": "33492_NVY",
                    "brands": [
                        "BOBS"
                    ],
                    "swatch": [
                        {
                            "swatch_landing_url": "/m/in-stock/bobs-b-cute/33492_NVY.html",
                            "sku_url": "/m/in-stock/bobs-b-cute/33492_NVY.html",
                            "color": "NVY",
                            "swatch_image_url": "https://www.url.com/dw/image/v2/BDCN_PRD/on/33492_NVY_hero.jpg?sw=200",
                            "swatch_style": "#0e1e53",
                            "primary_color": "NAVY",
                            "sku_image_url": "https://www.url.com/dw/image/v2/BDCN_PRD/on/33492_NVY.jpg?sw=1300"
                        }
                    ],
                    "id": 1172123856,
                    "webwidth_flag": "0",
                    "size": "6.5",
                    "sku": "193113978349",
                    "skuid": 97004056,
                    "color_swatch_show_count": 8,
                    "name": "Women's BOBS B Cute",
                    "color_swatch": [
                        {
                            "swatch_landing_url": "/women/shoes/bobs-b-cute/33492_BURG.html",
                            "color": "BURG",
                            "swatch_style": "#000000",
                            "primary_color": "RED",
                            "swatch_image_url": "https://www.url.com/dw/image/v2/dw2963ecb4/images/large/33492_BURG_hero.jpg?sw=200"
                        }
                    ],
                    "style_num": "33492",
                    "original_name": "BOBS B Cute",
                    "url": "/m/in-stock/bobs-b-cute/33492_NVY.html",
                    "image_url": "https://www.url.com/dw/image/v2/default/dw132e8fc8/images/large/33492_NVY.jpg?sw=1300",
                    "final_price": "50.00",
                    "primary_color": "NAVY",
                    "product_group": "33492",
                    "brand": "BOBS",
                    "sku_image_url": "https://www.url.com//large/33492_NVY.jpg?sw=1300",
                    "thumbnail_image_url": "https://www.url.com/dw/image/v2//images/large/33492_NVY.jpg?sw=400"
                },
                {
                    "division_name": "FOAMIES WOMENS",
                    "prod_color_count": "3",
                    "color": "NVY",
                    "price": "48.00",
                    "category_names": [
                        "campaign",
                        "Slip-Ons",
                        "Shop",
                        "Women",
                        "Shoes",
                        "Machine Washable",
                        "Women-shop-all"
                    ],
                    "sku_url": "/new-arrivals/women/foamies-summit---keep-steady/111416_NVY.html",
                    "swatch_index": 0,
                    "variation_product_id": "111416_NVY",
                    "brands": [
                        "Foamies"
                    ],
                    "swatch": [
                        {
                            "swatch_landing_url": "/new-arrivals/women/foamies-summit---keep-steady/111416_NVY.html",
                            "sku_url": "/new-arrivals/women/foamies-summit---keep-steady/111416_NVY.html",
                            "color": "NVY",
                            "swatch_image_url": "https://www.url.com/dw/image/v2/BDCN_/dw6f62d0bb/images/large/111416_NVY_hero.jpg?sw=200",
                            "swatch_style": "#0e1e53",
                            "primary_color": "NAVY",
                            "sku_image_url": "https://www.url.com"
                        }
                    ],
                    "id": 1221834104,
                    "webwidth_flag": "0",
                    "size": "8.0",
                    "sku": "195969596135",
                    "skuid": 1989586689,
                    "color_swatch_show_count": 0,
                    "name": "Women's Foamies: Summit - Keep Steady",
                    "color_swatch": [
                        {
                            "swatch_landing_url": "/new-arrivals/women/foamies-summit---keep-steady/111416_NVY.html",
                            "color": "NVY",
                            "swatch_style": "#0e1e53",
                            "primary_color": "NAVY",
                            "swatch_image_url": "https://www.url.com/dw/image/v2/BDCN_PRD/111416_NVY_hero.jpg?sw=200"
                        }
                    ],
                    "style_num": "111416",
                    "original_name": "Foamies: Summit - Keep Steady",
                    "url": "/new-arrivals/women/keep-steady/111416_NVY.html",
                    "image_url": "https://www.url.com/dw/image/v2/BDCN_PRD/on/111416_NVY.jpg?sw=1300",
                    "final_price": "48.00",
                    "primary_color": "NAVY",
                    "product_group": "111416",
                    "brand": "Foamies",
                    "sku_image_url": "https://www.url.com/dw/image/v2/BDCN_PRD/on/large/111416_NVY.jpg?sw=1300",
                    "thumbnail_image_url": "https://www.url.com/dw/image/v2/BDCN_PRD/on/large/111416_NVY.jpg?sw=400"
                },
                {
                    "division_name": "SPORT WOMENS",
                    "prod_color_count": "7",
                    "color": "CCPR",
                    "price": "65.00",
                    "category_names": [
                        "campaign",
                        "Athletic Sneakers",
                        "Shop",
                        "Women",
                        "Shop by Activity",
                        "Collections",
                        "Wide",
                        "Shoes",
                        "Sport",
                        "Women-shop-all"
                    ],
                    "sku_url": "/women/shoes/summits/12980_CCPR.html",
                    "swatch_index": 0,
                    "variation_product_id": "12980_CCPR",
                    "brands": [
                        "Sport"
                    ],
                    "swatch": [
                        {
                            "swatch_landing_url": "/women/shoes/summits/12980_CCPR.html",
                            "secondary_color": "PURPLE",
                            "sku_url": "/women/shoes/summits/12980_CCPR.html",
                            "color": "CCPR",
                            "swatch_image_url": "https://www.url.com/dw/image/large/12980_CCPR_hero.jpg?sw=200",
                            "swatch_style": "#000000",
                            "primary_color": "GRAY",
                            "sku_image_url": "https://www.url.com/dw/image/v2/12980_CCPR.jpg?sw=1300"
                        }
                    ],
                    "id": 1523412663,
                    "webwidth_flag": "0",
                    "size": "7.0",
                    "sku": "193642278781",
                    "skuid": 1121978043,
                    "color_swatch_show_count": 4,
                    "name": "Women's Summits",
                    "color_swatch": [
                        {
                            "swatch_landing_url": "/women/shoes/summits/12980_BBK.html",
                            "color": "BBK",
                            "swatch_style": "#000000",
                            "primary_color": "BLACK",
                            "swatch_image_url": "https://www.url.com/?sw=200"
                        }
                    ],
                    "style_num": "12980",
                    "original_name": "Summits",
                    "url": "/women/shoes/summits/12980_CCPR.html",
                    "image_url": "https://www.url.com/dw/image/v2/12980_CCPR.jpg?sw=1300",
                    "final_price": "65.00",
                    "primary_color": "GRAY",
                    "product_group": "12980",
                    "brand": "Sport",
                    "sku_image_url": "https://www.url.com/dw/image/v2/BDCN_PRD/on/large/12980_CCPR.jpg?sw=1300",
                    "thumbnail_image_url": "https://www.url.com/dw/image/v2/BDCN_PRD/12980_CCPR.jpg?sw=400"
                }
            ]
        }
    },
    "page_number": 1,
    "total_page": 998,
    "rid": "response_id:45123878:e531a3cecaed360b330228e6da9a188039dbc563",
    "query2id": {
        "keyphrase": "keyphrase"
    },
    "n_item": 3
}

Next click, with keyphrase

This is a sample request and response for when a user starts typing a keyphrase in the search field.

Request

RequestResponse
{
    "context": {
        "page": {
            "uri": "/"
        },
        "user": {
            "uuid": "sampleUUID"
        }
    },
    "widget": {
        "rfkid": "rfkid_6"
    },
    "n_item": 3,
    "query": {
        "keyphrase": {
            "value": [
                "pink"
            ]
        }
    },
    "suggestion": {
        "keyphrase": {
            "max": 4
        }
    },
    "content": {
        "product": {}
    }
}

Response

Within the content response object, there is a nested product and then value object. You can get the information you need to populate one product slot from the keys and values in the value object.

RequestResponse
{
    "autocomplete": "pink",
    "total_item": 412,
    "suggestion": {
        "keyphrase": [
            {
                "text": "pink",
                "freq": 2,
                "in_content": "product",
                "id": "suggestion_idcGluaw=="
            },
            {
                "text": "bobs kitten pink",
                "freq": 1,
                "in_content": "product",
                "id": "suggestion_idYm9icyBraXR0ZW4gcGluaw=="
            },
            {
                "text": "bezel pink",
                "freq": 1,
                "in_content": "product",
                "id": "suggestion_idYmV6ZWwgcGluaw=="
            },
            {
                "text": "bezel pink watch",
                "freq": 1,
                "in_content": "product",
                "id": "suggestion_idYmV6ZWwgcGluayB3YXRjaA=="
            }
        ]
    },
    "url": "?data%3D%7B%22widget%22%3A%20%7B%22rfkid%22%3A%20%22rfkid_6%22%2C%20%22used_in%22%3A%20%22common_across_pages%22%2C%20%22variation_id%22%3A%20%22570628%22%2C%20%22type%22%3A%20%22preview_search%22%7D%2C%20%22context%22%3A%20%7B%22page%22%3A%20%7B%22uri%22%3A%20%22%5C%5C%22%7D%2C%20%22user%22%3A%20%7B%22uuid%22%3A%20%22sampleUUID%22%7D%7D%2C%20%22force_v2_specs%22%3A%20true%2C%20%22content%22%3A%20%7B%22product%22%3A%20%7B%22max%22%3A%203%7D%7D%2C%20%22suggestion%22%3A%20%7B%22keyphrase%22%3A%20%7B%22max%22%3A%204%2C%20%22in_content%22%3A%20%7B%22type%22%3A%20%22product%2Carticle%22%7D%7D%7D%2C%20%22query%22%3A%20%7B%22orig_keyphrase%22%3A%20%22pink%22%2C%20%22keyphrase%22%3A%20%22pink%22%7D%2C%20%22n_item%22%3A%203%7D",
    "widget": {
        "rfkid": "rfkid_6",
        "used_in": "common_across_pages",
        "variation_id": "570628",
        "type": "preview_search"
    },
    "dt": 73,
    "ts": 1654199356162,
    "content": {
        "product": {
            "total_item": 412,
            "n_item": 3,
            "value": [
                {
                    "division_name": "O-T-G SANDALS WOMENS",
                    "prod_color_count": "3",
                    "color": "ROS",
                    "price": "69.00",
                    "category_names": [
                        "Ultra Go",
                        "Goga Mat",
                        "Sandals",
                        "Women",
                        "Website Premieres",
                        "on-the-go",
                        "Arch Fit",
                        "Shoes",
                        "Machine Washable",
                        "GOwalk",
                        "Women-shop-all"
                    ],
                    "sku_url": "/women/shoes/shoesonline-astonish/140226_ROS.html",
                    "swatch_index": 0,
                    "variation_product_id": "140226_ROS",
                    "brands": [
                        "Shoes Performance"
                    ],
                    "swatch": [
                        {
                            "swatch_landing_url": "/women/shoes/shoesonline--astonish/140226_ROS.html",
                            "sku_url": "/women/shoes/shoesonline--astonish/140226_ROS.html",
                            "color": "ROS",
                            "swatch_image_url": "https://www.shoesonline.com/dw/image/v2/BDCN_PRD/on/images/large/140226_ROS_hero.jpg?sw=200",
                            "swatch_style": "#000000",
                            "primary_color": "PINK",
                            "sku_image_url": "https://www.shoesonline.com/dw/image/v2/BDCN_PRD/on/images/large/140226_ROS.jpg?sw=1300"
                        }
                    ],
                    "id": 1278829169,
                    "webwidth_flag": "0",
                    "size": "10.0",
                    "sku": "194880386238",
                    "skuid": 1113241529,
                    "color_swatch_show_count": -2,
                    "name": "Women's Shoes GOwalk Arch Fit - Astonish",
                    "color_swatch": [
                        {
                            "swatch_landing_url": "/women/shoes/shoesonline--astonish/140226_ROS.html",
                            "color": "ROS",
                            "swatch_style": "#000000",
                            "primary_color": "PINK",
                            "swatch_image_url": "https://www.shoesonline.com/dw/image/v2/BDCN_PRD/on/images/large/140226_ROS_hero.jpg?sw=200"
                        }
                    ],
                    "style_num": "140226",
                    "original_name": "Shoes GOwalk Arch Fit - Astonish",
                    "url": "/women/shoes/shoesonline--astonish/140226_ROS.html",
                    "image_url": "https://www.shoesonline.com/dw/image/v2/BDCN_PRD/on/images/large/140226_ROS.jpg?sw=1300",
                    "final_price": "69.00",
                    "primary_color": "PINK",
                    "product_group": "140226",
                    "brand": "Shoes Performance",
                    "sku_image_url": "https://www.shoesonline.com/dw/image/v2/BDCN_PRD/on/images/large/140226_ROS.jpg?sw=1300",
                    "thumbnail_image_url": "https://www.shoesonline.com/dw/image/v2/BDCN_PRD/on/images/large/140226_ROS.jpg?sw=400"
                },
                {
                    "division_name": "CALI",
                    "prod_color_count": "1",
                    "color": "BLSH",
                    "price": "45.00",
                    "category_names": [
                        "Sandals",
                        "Website Premieres",
                        "Shoes"
                    ],
                    "sku_url": "/m/in-stock/pop-ups---femme-glam/119054_BLSH.html",
                    "swatch_index": 0,
                    "variation_product_id": "119054_BLSH",
                    "brands": [
                        "Cali"
                    ],
                    "swatch": [
                        {
                            "swatch_landing_url": "/m/in-stock/pop-ups---femme-glam/119054_BLSH.html",
                            "sku_url": "/m/in-stock/pop-ups---femme-glam/119054_BLSH.html",
                            "color": "BLSH",
                            "swatch_image_url": "https://www.shoesonline.com/dw/image/v2/dwdea4485c/images/large/119054_BLSH_hero.jpg?sw=200",
                            "swatch_style": "#000000",
                            "primary_color": "PINK",
                            "sku_image_url": "https://www.shoesonline.com/dw/image/v2/dwdea4485c/images/large/119054_BLSH.jpg?sw=1300"
                        }
                    ],
                    "id": 1172595074,
                    "webwidth_flag": "0",
                    "size": "7.0",
                    "sku": "194428401386",
                    "skuid": 752775911,
                    "color_swatch_show_count": -2,
                    "name": "Women's Pop Ups - Femme Glam",
                    "color_swatch": [
                        {
                            "swatch_landing_url": "/m/in-stock/pop-ups---femme-glam/119054_BLSH.html",
                            "color": "BLSH",
                            "swatch_style": "#000000",
                            "primary_color": "PINK",
                            "swatch_image_url": "https://www.shoesonline.com/dw/image/v2/dwdea4485c/images/large/119054_BLSH_hero.jpg?sw=200"
                        }
                    ],
                    "style_num": "119054",
                    "original_name": "Pop Ups - Femme Glam",
                    "url": "/m/in-stock/pop-ups---femme-glam/119054_BLSH.html",
                    "image_url": "https://www.shoesonline.com/dw/image/v2/dwdea4485c/images/large/119054_BLSH.jpg?sw=1300",
                    "final_price": "45.00",
                    "primary_color": "PINK",
                    "product_group": "119054",
                    "brand": "Cali",
                    "sku_image_url": "https://www.shoesonline.com/dw/image/v2/dwdea4485c/images/large/119054_BLSH.jpg?sw=1300",
                    "thumbnail_image_url": "https://www.shoesonline.com/dw/image/v2/dwdea4485c/images/large/119054_BLSH.jpg?sw=400"
                },
                {
                    "division_name": "SPORT WOMENS",
                    "prod_color_count": "2",
                    "color": "ROS",
                    "price": "72.00",
                    "category_names": [
                        "campaign",
                        "Vegan",
                        "Slip-Ons",
                        "Shop",
                        "Women",
                        "Casual Sneakers",
                        "Shoes",
                        "Sport",
                        "Machine Washable",
                        "Women-shop-all"
                    ],
                    "sku_url": "/women/shoes/ultra-flex---pure-spark/149427_ROS.html",
                    "swatch_index": 0,
                    "variation_product_id": "149427_ROS",
                    "brands": [
                        "Sport"
                    ],
                    "swatch": [
                        {
                            "swatch_landing_url": "/women/shoes/ultra-flex---pure-spark/149427_ROS.html",
                            "sku_url": "/women/shoes/ultra-flex---pure-spark/149427_ROS.html",
                            "color": "ROS",
                            "swatch_image_url": "https://www.shoesonline.com/dw/image/v2/dwb24c028e/images/large/149427_ROS_hero.jpg?sw=200",
                            "swatch_style": "#000000",
                            "primary_color": "PINK",
                            "sku_image_url": "https://www.shoesonline.com/dw/image/v2/dwb24c028e/images/large/149427_ROS.jpg?sw=1300"
                        }
                    ],
                    "id": 907973660,
                    "webwidth_flag": "0",
                    "size": "7.5",
                    "sku": "195204880159",
                    "skuid": 511615796,
                    "color_swatch_show_count": -2,
                    "name": "Women's Ultra Flex - Pure Spark",
                    "color_swatch": [
                        {
                            "swatch_landing_url": "/women/shoes/ultra-flex---pure-spark/149427_ROS.html",
                            "color": "ROS",
                            "swatch_style": "#000000",
                            "primary_color": "PINK",
                            "swatch_image_url": "https://www.shoesonline.com/dw/image/v2/dwb24c028e/images/large/149427_ROS_hero.jpg?sw=200"
                        }
                    ],
                    "style_num": "149427",
                    "original_name": "Ultra Flex - Pure Spark",
                    "url": "/women/shoes/ultra-flex---pure-spark/149427_ROS.html",
                    "image_url": "https://www.shoesonline.com/dw/image/v2/dwb24c028e/images/large/149427_ROS.jpg?sw=1300",
                    "final_price": "72.00",
                    "primary_color": "PINK",
                    "product_group": "149427",
                    "brand": "Sport",
                    "sku_image_url": "https://www.shoesonline.com/dw/image/v2/dwb24c028e/images/large/149427_ROS.jpg?sw=1300",
                    "thumbnail_image_url": "https://www.shoesonline.com/dw/image/v2/dwb24c028e/images/large/149427_ROS.jpg?sw=400"
                }
            ]
        }
    },
    "page_number": 1,
    "total_page": 138,
    "rid": "response_id:45123878:38a807581f0eec241b1db4ba3c3c141e4a67aa4c",
    "query2id": {
        "keyphrase": "keyphrasecGluaw=="
    },
    "n_item": 3
}

Do you have some feedback for us?

If you have suggestions for improving this article,