Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
Instant Search
Method Objective
The method requests products that match the search query. The method must be called for each entered character of the search query. The search for products starts from the second entered symbol.
Syntax and parameters
Code Block | ||||
---|---|---|---|---|
| ||||
sdk.suggest(params) { callback } |
Name | Type | Requirement | Description |
---|---|---|---|
params | required | Request parameters. See the description below. | |
callback | function | required | Callback-function, where the API response will be passed to. |
Request parameters
Name | Type | Requirement | Description |
---|---|---|---|
query | string | required | The search query text. |
API response
Name | Type | Description |
---|
products | array |
An array of objects with product information. Each object has the following properties:
| ||
products_total | number | The total number of products that match the search query. |
search_query | string | The search query text. |
categories | array | An array of objects with information about the categories matching the search query. Each object has the following properties:
If no links are specified for categories in the product feed, the API will return an empty array for this property. |
queries | array | An array of |
objects with relevant popular queries. Each object has the following properties:
| ||
html | string | Contains a rendered custom HTML template for the Instant Search widget, or null if the HTML template is empty or the default one is used. |
search_query_redirects | object | The object will be available if a redirect is created for the search query: Account -> Search -> Search redirect The object contains the following properties:
|
Example of use
Code Block | ||||
---|---|---|---|---|
| ||||
sdk.suggest(query: "To be or not to be") { searchResult in // features showing instant search widget } |
Full Search
Method Objective
The method requests products that match the full search query and is used to display the search results.
Syntax and parameters
Code Block | ||||
---|---|---|---|---|
| ||||
sdk.search(params) { callback } |
Name | Type | Requirement | Description |
---|---|---|---|
params | enum | required | Request parameters. See the description below. |
callback | function | required | Callback-function, where the API response will be passed to. |
Request Parameters
Name | Type | Requirement | Description |
---|---|---|---|
query | string | required | The search query text. |
limit | number | optionally | The maximum number of products in the API response (by default - 10). |
offset | number | optionally | The offset relative to the first product in the API response |
brands | Dictionary List | optionally | Dictionary List of brands. If used, the API response will return only the products of the listed vendors. The vendors must be listed in the product feed. |
colors | Dictionary List | optionally | Dictionary List of colors. If used, the API response will return the products of the listed colors. The colors of the product should be specified in the product feed. |
fashionSizes | Dictionary List | Dictionary List of fashion sizes. If used, the API response will return the products of the listed sizes. The sizes of the product should be specified in the product feed. | |
priceMin | number | optionally | Minimum product price in API response. |
priceMax | number | optionally | Maximum product price in API response. |
locations | Dictionary List | optionally | Dictionary List of Location IDs. If used, the API response will return products available in the listed locations. |
categories | Dictionary List | optionally | Dictionary List of Category IDs. If used, the API response will return only those products that are in the specified categories. |
sortBy | string | optionally | Sorting products in the API response. Available values:
|
sortDir | string | optionally | Sorting directions for the
|
filters | string | optionally | JSON object with additional request filters. See the example below. |
categoryLimitbrandLimit | number | optionally | How many categories brands for sidebar filter to return. |
extendedcategoryLimit | booleannumber | optionally | Allows getting extended data in the API responseHow many categories for sidebar filter to return. |
exclude | Dictionary List | optionally | Dictionary List of IDs of products to be excluded. |
API response
Name | Type | Description |
---|---|---|
categories | array |
An array of objects with information about the categories matching the search query. Each object has the following properties:
If no links are specified for categories in the product feed, the API will return an empty array for this property. | ||
products | Object Array | An array of objects with product information. Each object has the following properties:
|
productsTotal | number | The total number of products that match the search query. |
queries | array | An array of queries related to the search query. |
Example of use
Code Block | ||||
---|---|---|---|---|
| ||||
sdk.search(query: "To be or not to be", limit: 15, offset: 3, categoryLimit: 5, categories: ["1", "146", "100500"], extended: false, sortBy: "price", sortDir: "asc", locations: ["NY", "LA"], brands: ["Alas", "poor", "Yorick"], filters: ["bluetooth":["yes"],"offers":["15% cashback"],"weight":["1.6"]], priceMin: 1000, priceMax: 5000, colors: ["red", "yellow", "green"], exclude: ["100", "146", "231"]) { searchResult in
// features showing full search widget
} |
Blank Request
Method Objective
The method allows getting the user's recent search queries, as well as recommended suggestions and products for the user.
Syntax and parameters
Code Block | ||||
---|---|---|---|---|
| ||||
sdk.searchBlank() { callback } |
Name | Type | Requirement | Description |
---|---|---|---|
callback | function | required | Callback-function, where the API response will be passed to. |
API response
Name | Type | Description |
---|---|---|
lastQueries | Query array | The user's most recent search queries. Each Query in the array contains the following properties:
|
products | Product array | An array with product information. Each Product has the following properties:
|
lastProducts | boolean | If true, then the products property of the API response contains the products recently viewed by the user, otherwise, it contains the recommended products. |
suggests | Suggest array | User-relevant suggestions. Each Suggest in the array contains the following properties:
|
Example of use
Code Block | ||||
---|---|---|---|---|
| ||||
sdk.searchBlank() { searchResult in
// features showing blank search widget
} |
Column | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Page Navigation
Related Pages
|