SearchSuggestion Resource (Shop API 16.4)

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_4/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.afterGET

afterGET (doc : Document) : Status

The function is called after the request has been processed.

Parameters:
doc - the document
Returns:
  • Status.OK for success.
  • Status.ERROR in case something went wrong.

Sample

REQUEST:
GET /dw/shop/v16_4/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.4",
    "query": "shi",
    "suggested_phrases": [ "shirt" ],
    "suggestions": [
    {
        "categories": [
            {
                "id": "mens-clothing-dress-shirts",
                "link": "http://example.com/dw/shop/v16_4/categories/mens-clothing-dress-shirts?q=shi&client_id=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"&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_4/products/25502296?q=shi&client_id=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"&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_4/content/super-save-shipping?q=shi&client_id=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"&currency=EUR",
            "name": "Super Saver Shipping"
        },
        {
            "id": "checkout",
            "link": "http://example.com/dw/shop/v16_4/content/checkout?q=shi&client_id=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"&currency=EUR",
            "name": "Checkout"
        }]
    },
    {
        "custom_suggestions":  ["shift caps lock", "shift", "shirts"]
    }
]

}