SearchSuggestion resource (Shop API 19.1)

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/v19_1/search_suggestion?q={String}&count={Integer}&currency={String}&locale={String}

Formats

json, xml

Authentication

Name Description
JWT Authentication via Customer JWT token.
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.beforeGET

beforeGET () : Status

The function is called before the request will be processed.

Returns:
a non-null Status ends the hook execution
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/v19_1/search_suggestion?q=shi&count=1&currency=EUR 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
Cache-Control: max-age=900,must-revalidate
Content-Length: 1337

{
  "_v": "19.1",
  "brand_suggestions": {
    "brands": [
      "Sega"
    ],
    "suggested_phrases": [
      {
        "exact_match": false,
        "phrase": "Sega"
      }
    ],
    "suggested_terms": [
      {
        "original_term": "shi",
        "terms": [
          {
            "completed": false,
            "corrected": true,
            "exact_match": false,
            "value": "sega"
          }
        ]
      }
    ]
  },
  "category_suggestions": {
    "categories": [
      {
        "id": "mens-clothing-dress-shirts",
        "link": "http://example.com/dw/shop/v19_1/categories/mens-clothing-dress-shirts?count=1&q=shi&currency=EUR",
        "name": "Dress Shirts",
        "parent_category_name": "Clothing"
      }
    ],
    "suggested_phrases": [
      {
        "exact_match": false,
        "phrase": "Dress Shirts"
      }
    ],
    "suggested_terms": [
      {
        "original_term": "shi",
        "terms": [
          {
            "completed": true,
            "corrected": false,
            "exact_match": false,
            "value": "shirts"
          }
        ]
      }
    ]
  },
  "content_suggestions": {
    "content": [
      {
        "id": "super-save-shipping",
        "link": "http://example.com/dw/shop/v19_1/content/super-save-shipping?count=1&q=shi&currency=EUR",
        "name": "Super Saver Shipping"
      }
    ],
    "suggested_phrases": [
      {
        "exact_match": false,
        "phrase": "shipping"
      }
    ],
    "suggested_terms": [
      {
        "original_term": "shi",
        "terms": [
          {
            "completed": true,
            "corrected": false,
            "exact_match": false,
            "value": "shipping"
          }
        ]
      }
    ]
  },
  "custom_suggestions": {
    "custom_suggestions": [
      "Point and Shoot"
    ],
    "suggested_phrases": [
      {
        "exact_match": false,
        "phrase": "Point and Shoot"
      }
    ],
    "suggested_terms": [
      {
        "original_term": "shi",
        "terms": [
          {
            "completed": false,
            "corrected": true,
            "exact_match": false,
            "value": "shoot"
          },
          {
            "completed": false,
            "corrected": true,
            "exact_match": false,
            "value": "short"
          }
        ]
      }
    ]
  },
  "product_suggestions": {
    "products": [
      {
        "currency": "EUR",
        "link": "http://example.com/dw/shop/v19_1/products/25591125?count=1&q=shi&currency=EUR",
        "price": 29.51,
        "product_id": "25591125",
        "product_name": "Striped Shirt"
      }
    ],
    "suggested_phrases": [
      {
        "exact_match": false,
        "phrase": "shirt"
      }
    ],
    "suggested_terms": [
      {
        "original_term": "shi",
        "terms": [
          {
            "completed": true,
            "corrected": false,
            "exact_match": false,
            "value": "shirt"
          },
          {
            "completed": true,
            "corrected": false,
            "exact_match": false,
            "value": "shirts"
          }
        ]
      }
    ]
  },
  "query": "shi"
}