SearchSuggestion Resource (Shop API 16.9)

Summary

Http Method Resource Description
GET /Search_suggestion Provides keyword search functionality for products, categories, content, brands and custom suggestions. Returns suggested products, suggested categories, suggested content, suggested brands and custom suggestions for the given search phrase.

Search Products

Provides keyword search functionality for products, categories, content, brands and custom suggestions. Returns suggested products, suggested categories, suggested content, suggested brands and custom suggestions for the given search phrase.

Url

GET http://hostname:port/dw/shop/v16_9/search_suggestion?q={String}&count={Integer}&currency={String}&locale={String}

Formats

json, xml

Authentication

Name Description
None No authentication.

Response Document

SuggestionResult

Query Parameters

Parameter Type Description Constraints
count Integer The maximum number of suggestions per request. Default value is 5. This affects all types of suggestions (category, product, content, brand, custom suggestions). maxIntegerValue=10, minIntegerValue=1
currency String The currency mnemonic specified for price. This parameter is effective only for product suggestions.  
locale String    
q String The query phrase to search for. maxLength=50, minLength=3, nullable=false

Customization

This Resource supports server-side customization.

Extension Point Method Detail
dw.ocapi.shop.search_suggestion.modifyGETResponse

modifyGETResponse (doc : SuggestionResult ) : Status

The function is called after the request has been processed.

Parameters:
doc - the document
Returns:
a non-null Status ends the hook execution

Sample

REQUEST:
GET /dw/shop/v16_9/search_suggestion HTTP/1.1
Host: example.com
Cookie: dwsid=tYlzC3YbZNo13dV5XS4OGzg0wClZGz4yThXHrvEZNUlT2ohYzMFyPJin5cW0wleUaxMnraXcEbg4mnymdroMlA==;
        dwanonymous_9727b83e8e864fa4b6902a37bc70a12d=bcdlZDxB7h5YakHw3p1ZTDPihp;
        dwsecuretoken_9727b83e8e864fa4b6902a37bc70a12d=5Kx5-2P7jj5WoxeTiWwHNBJ6QV39Io5SNA==
Content-Type: application/json; charset=UTF-8

RESPONSE:
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8

{
    "_v": "16.9",
    "query": "shi",
    "suggested_phrases": [ "shirt" ],
    "suggestions": [
    {
        "categories": [
            {
                "id": "mens-clothing-dress-shirts",
                "link": "http://example.com/dw/shop/v16_9/categories/mens-clothing-dress-shirts?q=shi&currency=EUR",
                "name": "Dress Shirts",
                "parent_category_id": "mens-clothing"
            }
        ]
    },
    {
        "products": [
        {
            "currency": "EUR",
            "image": 
            {
                "alt": "Shimmer Blouse, , medium",
                "link": "http://example.com/on/demandware.static/Sites-SiteGenesis-Site/Sites-apparel-catalog/default/dw60e6c73c/images/medium/PG.10220987.JJ493XX.PZ.jpg",
                "title": "Shimmer Blouse, "
            },
            "link": "http://example.com/dw/shop/v16_9/products/25502296?q=shi&currency=EUR",
            "price": 47.51,
            "product_id": "25502296",
            "product_name": "Shimmer Blouse"
        }]
    },
    {
        "brands": ["Sierra"]
    },
    {
        "content": [
        {
            "id": "super-save-shipping",
            "link": "http://example.com/dw/shop/v16_9/content/super-save-shipping?q=shi&currency=EUR",
            "name": "Super Saver Shipping"
        },
        {
            "id": "checkout",
            "link": "http://example.com/dw/shop/v16_9/content/checkout?q=shi&currency=EUR",
            "name": "Checkout"
        }]
    },
    {
        "custom_suggestions":  ["shift caps lock", "shift", "shirts"]
    }
]

}
OCAPI obsolete versions 13.x and 14.x will be end of life in 2020 and versions 15.x and 16.x in 2021. For dates and more information, see the OCAPI versioning and deprecation policy and this Knowledge Article.
X Privacy Update: We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used. By continuing to use this site you are giving us your consent to do this. Privacy Policy.