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. |
Url
GET http://hostname:port/dw/shop/v17_1/search_suggestion?q={String}&count={Integer}¤cy={String}&locale={String}
Formats
json, xml
Authentication
Name | Description |
---|---|
JWT | Authentication via Customer JWT token. |
None | No authentication. |
Response Document
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.
|
Sample
REQUEST:
GET /dw/shop/v17_1/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": "17.1",
"query": "shi",
"suggested_phrases": [ "shirt" ],
"suggestions": [
{
"categories": [
{
"id": "mens-clothing-dress-shirts",
"link": "http://example.com/dw/shop/v17_1/categories/mens-clothing-dress-shirts?q=shi¤cy=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/v17_1/products/25502296?q=shi¤cy=EUR",
"price": 47.51,
"product_id": "25502296",
"product_name": "Shimmer Blouse"
}]
},
{
"brands": ["Sierra"]
},
{
"content": [
{
"id": "super-save-shipping",
"link": "http://example.com/dw/shop/v17_1/content/super-save-shipping?q=shi¤cy=EUR",
"name": "Super Saver Shipping"
},
{
"id": "checkout",
"link": "http://example.com/dw/shop/v17_1/content/checkout?q=shi¤cy=EUR",
"name": "Checkout"
}]
},
{
"custom_suggestions": ["shift caps lock", "shift", "shirts"]
}
]
}