curl --request POST \
--url https://{base-address}/apis/ecommerce-service/public/discovery/v2/auto-suggest \
--header 'Content-Type: application/json' \
--data '
{
"show_auto_suggester_term": true,
"auto_suggester_term_limit": 123,
"show_category": true,
"include_category_count": true,
"category_limit": 123,
"show_popular_searches": true,
"popular_searches_limit": 123,
"show_recent_searches": true,
"recent_searches_limit": 123,
"show_content_pages": true,
"content_pages_limit": 123,
"show_products": true,
"products_limit": 123,
"search_term": "<string>",
"filter": [
{
"group": {
"operator": "<string>",
"rules": [
{
"action": "<string>",
"field_name": "<string>",
"value": "<string>"
}
]
}
}
],
"is_auto_spellcheck": true,
"out_of_stock": "<string>",
"user_id": "<string>",
"session_id": "<string>",
"preview": true
}
'import requests
url = "https://{base-address}/apis/ecommerce-service/public/discovery/v2/auto-suggest"
payload = {
"show_auto_suggester_term": True,
"auto_suggester_term_limit": 123,
"show_category": True,
"include_category_count": True,
"category_limit": 123,
"show_popular_searches": True,
"popular_searches_limit": 123,
"show_recent_searches": True,
"recent_searches_limit": 123,
"show_content_pages": True,
"content_pages_limit": 123,
"show_products": True,
"products_limit": 123,
"search_term": "<string>",
"filter": [{ "group": {
"operator": "<string>",
"rules": [
{
"action": "<string>",
"field_name": "<string>",
"value": "<string>"
}
]
} }],
"is_auto_spellcheck": True,
"out_of_stock": "<string>",
"user_id": "<string>",
"session_id": "<string>",
"preview": True
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
show_auto_suggester_term: true,
auto_suggester_term_limit: 123,
show_category: true,
include_category_count: true,
category_limit: 123,
show_popular_searches: true,
popular_searches_limit: 123,
show_recent_searches: true,
recent_searches_limit: 123,
show_content_pages: true,
content_pages_limit: 123,
show_products: true,
products_limit: 123,
search_term: '<string>',
filter: [
{
group: {
operator: '<string>',
rules: [{action: '<string>', field_name: '<string>', value: '<string>'}]
}
}
],
is_auto_spellcheck: true,
out_of_stock: '<string>',
user_id: '<string>',
session_id: '<string>',
preview: true
})
};
fetch('https://{base-address}/apis/ecommerce-service/public/discovery/v2/auto-suggest', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{base-address}/apis/ecommerce-service/public/discovery/v2/auto-suggest",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'show_auto_suggester_term' => true,
'auto_suggester_term_limit' => 123,
'show_category' => true,
'include_category_count' => true,
'category_limit' => 123,
'show_popular_searches' => true,
'popular_searches_limit' => 123,
'show_recent_searches' => true,
'recent_searches_limit' => 123,
'show_content_pages' => true,
'content_pages_limit' => 123,
'show_products' => true,
'products_limit' => 123,
'search_term' => '<string>',
'filter' => [
[
'group' => [
'operator' => '<string>',
'rules' => [
[
'action' => '<string>',
'field_name' => '<string>',
'value' => '<string>'
]
]
]
]
],
'is_auto_spellcheck' => true,
'out_of_stock' => '<string>',
'user_id' => '<string>',
'session_id' => '<string>',
'preview' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{base-address}/apis/ecommerce-service/public/discovery/v2/auto-suggest"
payload := strings.NewReader("{\n \"show_auto_suggester_term\": true,\n \"auto_suggester_term_limit\": 123,\n \"show_category\": true,\n \"include_category_count\": true,\n \"category_limit\": 123,\n \"show_popular_searches\": true,\n \"popular_searches_limit\": 123,\n \"show_recent_searches\": true,\n \"recent_searches_limit\": 123,\n \"show_content_pages\": true,\n \"content_pages_limit\": 123,\n \"show_products\": true,\n \"products_limit\": 123,\n \"search_term\": \"<string>\",\n \"filter\": [\n {\n \"group\": {\n \"operator\": \"<string>\",\n \"rules\": [\n {\n \"action\": \"<string>\",\n \"field_name\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n }\n }\n ],\n \"is_auto_spellcheck\": true,\n \"out_of_stock\": \"<string>\",\n \"user_id\": \"<string>\",\n \"session_id\": \"<string>\",\n \"preview\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{base-address}/apis/ecommerce-service/public/discovery/v2/auto-suggest")
.header("Content-Type", "application/json")
.body("{\n \"show_auto_suggester_term\": true,\n \"auto_suggester_term_limit\": 123,\n \"show_category\": true,\n \"include_category_count\": true,\n \"category_limit\": 123,\n \"show_popular_searches\": true,\n \"popular_searches_limit\": 123,\n \"show_recent_searches\": true,\n \"recent_searches_limit\": 123,\n \"show_content_pages\": true,\n \"content_pages_limit\": 123,\n \"show_products\": true,\n \"products_limit\": 123,\n \"search_term\": \"<string>\",\n \"filter\": [\n {\n \"group\": {\n \"operator\": \"<string>\",\n \"rules\": [\n {\n \"action\": \"<string>\",\n \"field_name\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n }\n }\n ],\n \"is_auto_spellcheck\": true,\n \"out_of_stock\": \"<string>\",\n \"user_id\": \"<string>\",\n \"session_id\": \"<string>\",\n \"preview\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{base-address}/apis/ecommerce-service/public/discovery/v2/auto-suggest")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"show_auto_suggester_term\": true,\n \"auto_suggester_term_limit\": 123,\n \"show_category\": true,\n \"include_category_count\": true,\n \"category_limit\": 123,\n \"show_popular_searches\": true,\n \"popular_searches_limit\": 123,\n \"show_recent_searches\": true,\n \"recent_searches_limit\": 123,\n \"show_content_pages\": true,\n \"content_pages_limit\": 123,\n \"show_products\": true,\n \"products_limit\": 123,\n \"search_term\": \"<string>\",\n \"filter\": [\n {\n \"group\": {\n \"operator\": \"<string>\",\n \"rules\": [\n {\n \"action\": \"<string>\",\n \"field_name\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n }\n }\n ],\n \"is_auto_spellcheck\": true,\n \"out_of_stock\": \"<string>\",\n \"user_id\": \"<string>\",\n \"session_id\": \"<string>\",\n \"preview\": true\n}"
response = http.request(request)
puts response.read_body{
"Status": "success",
"Data": {
"categories": [
{
"name": "<string>",
"page_slug": "<string>",
"product_count": 123
}
],
"auto_suggester": [
"<string>"
],
"popular_searches": [
"<string>"
],
"redirect_url": "<string>",
"products": [
{
"sku": "<string>",
"matched_sku": "<string>",
"position": 123,
"id": "<string>",
"score": 123,
"variant_skus": [
"<string>"
],
"variants": [
{
"id": "<string>",
"title": "<string>",
"price": "<string>",
"sku": "<string>",
"position": 123,
"compare_at_price": "<string>",
"selected_options": [
{
"name": "<string>",
"value": "<string>"
}
],
"inventory_quantity": 123,
"inventory_policy": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"image": {
"id": "<string>",
"url": "<string>",
"alt_text": "<string>"
},
"inventory_item": {
"measurement": {
"weight": {
"unit": "<string>",
"value": 123
}
}
},
"__parent_id": "<string>",
"graphql_id": "<string>",
"image_id": "<string>",
"weight": 123,
"weight_unit": "<string>"
}
],
"name": "<string>",
"brand": "<string>",
"calculated_price": 123,
"description": "<string>",
"inventory_level": 123,
"images": [
{
"id": "<string>",
"url": "<string>",
"altText": "<string>",
"graphql_id": "<string>",
"src": "<string>"
}
],
"variant_options": [
{
"id": "<string>",
"name": "<string>",
"position": 123,
"values": [
"<string>"
],
"optionValues": [
{
"id": "<string>"
}
]
}
],
"category_meta": [
{
"id": "<string>",
"name": "<string>",
"provider_id": 123
}
],
"provider_id": "<string>",
"page_slug": "<string>",
"pin": true,
"slot": true
}
],
"_meta_": {
"tenant_id": "<string>",
"workspace_id": "<string>",
"env_type": "<string>",
"store_hash": "<string>",
"content_model_id": "<string>",
"_fields_": {}
}
}
}{
"Status": "failure",
"Data": {
"Status": "failure",
"Error": {
"message": "<string>",
"name": "<string>",
"code": "<string>"
}
}
}{
"Status": "failure",
"Data": {
"Status": "failure",
"Error": {
"message": "<string>",
"name": "<string>",
"code": "<string>"
}
}
}{
"Status": "failure",
"Data": {
"Status": "failure",
"Error": {
"message": "<string>",
"name": "<string>",
"code": "<string>"
}
}
}Auto Suggest
Returns search suggestions, category hints, popular/recent queries, content-page matches, and product previews based on a partially typed search term. Supports spell-correction and preview mode.
curl --request POST \
--url https://{base-address}/apis/ecommerce-service/public/discovery/v2/auto-suggest \
--header 'Content-Type: application/json' \
--data '
{
"show_auto_suggester_term": true,
"auto_suggester_term_limit": 123,
"show_category": true,
"include_category_count": true,
"category_limit": 123,
"show_popular_searches": true,
"popular_searches_limit": 123,
"show_recent_searches": true,
"recent_searches_limit": 123,
"show_content_pages": true,
"content_pages_limit": 123,
"show_products": true,
"products_limit": 123,
"search_term": "<string>",
"filter": [
{
"group": {
"operator": "<string>",
"rules": [
{
"action": "<string>",
"field_name": "<string>",
"value": "<string>"
}
]
}
}
],
"is_auto_spellcheck": true,
"out_of_stock": "<string>",
"user_id": "<string>",
"session_id": "<string>",
"preview": true
}
'import requests
url = "https://{base-address}/apis/ecommerce-service/public/discovery/v2/auto-suggest"
payload = {
"show_auto_suggester_term": True,
"auto_suggester_term_limit": 123,
"show_category": True,
"include_category_count": True,
"category_limit": 123,
"show_popular_searches": True,
"popular_searches_limit": 123,
"show_recent_searches": True,
"recent_searches_limit": 123,
"show_content_pages": True,
"content_pages_limit": 123,
"show_products": True,
"products_limit": 123,
"search_term": "<string>",
"filter": [{ "group": {
"operator": "<string>",
"rules": [
{
"action": "<string>",
"field_name": "<string>",
"value": "<string>"
}
]
} }],
"is_auto_spellcheck": True,
"out_of_stock": "<string>",
"user_id": "<string>",
"session_id": "<string>",
"preview": True
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
show_auto_suggester_term: true,
auto_suggester_term_limit: 123,
show_category: true,
include_category_count: true,
category_limit: 123,
show_popular_searches: true,
popular_searches_limit: 123,
show_recent_searches: true,
recent_searches_limit: 123,
show_content_pages: true,
content_pages_limit: 123,
show_products: true,
products_limit: 123,
search_term: '<string>',
filter: [
{
group: {
operator: '<string>',
rules: [{action: '<string>', field_name: '<string>', value: '<string>'}]
}
}
],
is_auto_spellcheck: true,
out_of_stock: '<string>',
user_id: '<string>',
session_id: '<string>',
preview: true
})
};
fetch('https://{base-address}/apis/ecommerce-service/public/discovery/v2/auto-suggest', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{base-address}/apis/ecommerce-service/public/discovery/v2/auto-suggest",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'show_auto_suggester_term' => true,
'auto_suggester_term_limit' => 123,
'show_category' => true,
'include_category_count' => true,
'category_limit' => 123,
'show_popular_searches' => true,
'popular_searches_limit' => 123,
'show_recent_searches' => true,
'recent_searches_limit' => 123,
'show_content_pages' => true,
'content_pages_limit' => 123,
'show_products' => true,
'products_limit' => 123,
'search_term' => '<string>',
'filter' => [
[
'group' => [
'operator' => '<string>',
'rules' => [
[
'action' => '<string>',
'field_name' => '<string>',
'value' => '<string>'
]
]
]
]
],
'is_auto_spellcheck' => true,
'out_of_stock' => '<string>',
'user_id' => '<string>',
'session_id' => '<string>',
'preview' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{base-address}/apis/ecommerce-service/public/discovery/v2/auto-suggest"
payload := strings.NewReader("{\n \"show_auto_suggester_term\": true,\n \"auto_suggester_term_limit\": 123,\n \"show_category\": true,\n \"include_category_count\": true,\n \"category_limit\": 123,\n \"show_popular_searches\": true,\n \"popular_searches_limit\": 123,\n \"show_recent_searches\": true,\n \"recent_searches_limit\": 123,\n \"show_content_pages\": true,\n \"content_pages_limit\": 123,\n \"show_products\": true,\n \"products_limit\": 123,\n \"search_term\": \"<string>\",\n \"filter\": [\n {\n \"group\": {\n \"operator\": \"<string>\",\n \"rules\": [\n {\n \"action\": \"<string>\",\n \"field_name\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n }\n }\n ],\n \"is_auto_spellcheck\": true,\n \"out_of_stock\": \"<string>\",\n \"user_id\": \"<string>\",\n \"session_id\": \"<string>\",\n \"preview\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{base-address}/apis/ecommerce-service/public/discovery/v2/auto-suggest")
.header("Content-Type", "application/json")
.body("{\n \"show_auto_suggester_term\": true,\n \"auto_suggester_term_limit\": 123,\n \"show_category\": true,\n \"include_category_count\": true,\n \"category_limit\": 123,\n \"show_popular_searches\": true,\n \"popular_searches_limit\": 123,\n \"show_recent_searches\": true,\n \"recent_searches_limit\": 123,\n \"show_content_pages\": true,\n \"content_pages_limit\": 123,\n \"show_products\": true,\n \"products_limit\": 123,\n \"search_term\": \"<string>\",\n \"filter\": [\n {\n \"group\": {\n \"operator\": \"<string>\",\n \"rules\": [\n {\n \"action\": \"<string>\",\n \"field_name\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n }\n }\n ],\n \"is_auto_spellcheck\": true,\n \"out_of_stock\": \"<string>\",\n \"user_id\": \"<string>\",\n \"session_id\": \"<string>\",\n \"preview\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{base-address}/apis/ecommerce-service/public/discovery/v2/auto-suggest")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"show_auto_suggester_term\": true,\n \"auto_suggester_term_limit\": 123,\n \"show_category\": true,\n \"include_category_count\": true,\n \"category_limit\": 123,\n \"show_popular_searches\": true,\n \"popular_searches_limit\": 123,\n \"show_recent_searches\": true,\n \"recent_searches_limit\": 123,\n \"show_content_pages\": true,\n \"content_pages_limit\": 123,\n \"show_products\": true,\n \"products_limit\": 123,\n \"search_term\": \"<string>\",\n \"filter\": [\n {\n \"group\": {\n \"operator\": \"<string>\",\n \"rules\": [\n {\n \"action\": \"<string>\",\n \"field_name\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n }\n }\n ],\n \"is_auto_spellcheck\": true,\n \"out_of_stock\": \"<string>\",\n \"user_id\": \"<string>\",\n \"session_id\": \"<string>\",\n \"preview\": true\n}"
response = http.request(request)
puts response.read_body{
"Status": "success",
"Data": {
"categories": [
{
"name": "<string>",
"page_slug": "<string>",
"product_count": 123
}
],
"auto_suggester": [
"<string>"
],
"popular_searches": [
"<string>"
],
"redirect_url": "<string>",
"products": [
{
"sku": "<string>",
"matched_sku": "<string>",
"position": 123,
"id": "<string>",
"score": 123,
"variant_skus": [
"<string>"
],
"variants": [
{
"id": "<string>",
"title": "<string>",
"price": "<string>",
"sku": "<string>",
"position": 123,
"compare_at_price": "<string>",
"selected_options": [
{
"name": "<string>",
"value": "<string>"
}
],
"inventory_quantity": 123,
"inventory_policy": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"image": {
"id": "<string>",
"url": "<string>",
"alt_text": "<string>"
},
"inventory_item": {
"measurement": {
"weight": {
"unit": "<string>",
"value": 123
}
}
},
"__parent_id": "<string>",
"graphql_id": "<string>",
"image_id": "<string>",
"weight": 123,
"weight_unit": "<string>"
}
],
"name": "<string>",
"brand": "<string>",
"calculated_price": 123,
"description": "<string>",
"inventory_level": 123,
"images": [
{
"id": "<string>",
"url": "<string>",
"altText": "<string>",
"graphql_id": "<string>",
"src": "<string>"
}
],
"variant_options": [
{
"id": "<string>",
"name": "<string>",
"position": 123,
"values": [
"<string>"
],
"optionValues": [
{
"id": "<string>"
}
]
}
],
"category_meta": [
{
"id": "<string>",
"name": "<string>",
"provider_id": 123
}
],
"provider_id": "<string>",
"page_slug": "<string>",
"pin": true,
"slot": true
}
],
"_meta_": {
"tenant_id": "<string>",
"workspace_id": "<string>",
"env_type": "<string>",
"store_hash": "<string>",
"content_model_id": "<string>",
"_fields_": {}
}
}
}{
"Status": "failure",
"Data": {
"Status": "failure",
"Error": {
"message": "<string>",
"name": "<string>",
"code": "<string>"
}
}
}{
"Status": "failure",
"Data": {
"Status": "failure",
"Error": {
"message": "<string>",
"name": "<string>",
"code": "<string>"
}
}
}{
"Status": "failure",
"Data": {
"Status": "failure",
"Error": {
"message": "<string>",
"name": "<string>",
"code": "<string>"
}
}
}Headers
Optional customer group identifier for segment-specific responses.
eCommerce provider for contextualizing the API call (e.g., shopify, magento, etc.).
Query Parameters
Comma-separated list of fields to include in the response
Specifies the language or region for the response data
Identifier of the store within the eCommerce platform.
Sales or distribution channel identifier.
Identifier for the regional location from the BigCommerce admin panel.
Currency code for price displays.
Whether to include metadata about the fields in the response. If true, returns metadata for each filterable field.
Comma-separated list of fields to include for content pages
Body
Request body
Whether to show the auto-suggester term
Limit for the number of auto-suggester terms to return.
Whether to show product category name suggestions.
Whether to include the number of products per category
Max number of categories to return.
Whether to Include popular search phrases.
Max number of popular searches to return.
Whether to show user’s recent search history.
Max number of recent searches to return.
Whether to show matching content pages in the result.
Max number of content pages to return.
Whether to show products in the result.
Max number of product suggestions to return.
Partial search input for which suggestions are requested.
Query filter expression to narrow results
Show child attributes
Show child attributes
Whether to auto-correct misspellings in the search term.
Whether to include/ exclude/ bury out-of-stock items
Unique identifier for the user ID or user email.
Identifier for the user's session id.
Whether this is a preview mode request. If true, the suggestions returns in preview mode.