Search Product
the Search Product eCommerce API documentation. This API allows you to search for products within our eCommerce platform. You can retrieve detailed information about products, such as their name, price, description, and availability.
Endpoint:
api/customer/products/search
Http Method:
POST
Request Body:
Key | Type | Description |
---|---|---|
q | String | It allows you to specify a keyword to search for within the products. |
brand_ids | Array | An array that allows you to filter products by specific brand IDs. You can provide one or more brand IDs to narrow down the search results to products from those brands. |
sub_categories_slugs | Array | An array that allows you to filter products by specific sub-category slugs. |
categories | Array | An array that allows you to filter products by specific category IDs. You can provide one or more category IDs to restrict the search results to products within those categories. |
category_slug | string | Filter products by a specific category slug. |
price_from | Integer | The minimum price of the products you want to search for. You can set a numeric value to filter products with prices equal to or higher than the specified value. |
price_to | Integer | The maximum price of the products you want to search for. You can set a numeric value to filter products with prices equal to or lower than the specified value. |
page | Integer | The page number of the search results. It is commonly used for pagination, allowing you to retrieve a specific page of results. |
page_size | Integer | The number of products to be returned per page. It controls the size of each page of search results. |
sort | Integer | A sorting criteria for the search results. You can define how the products should be sorted, such as by price, name, or any other relevant attribute. |
group_slugs | Array | An array that allows you to filter products based on specific group slug. |
list_ids | Array | An array that allows you to filter products based on specific list IDs. You can provide one or more list IDs to narrow down the search results to products within those lists. |
promotions | Array | A boolean flag that indicates whether you want to include promotions in the search results. If set to true, promotions will be included; if set to false, promotions will be excluded. |
in_stock | Integer | This parameter allows you to filter products based on their availability. You can specify values like "true" or "false" to search for products that are in stock or out of stock, respectively. |
vendor_id | Integer | Filter prices of products by a vendor ID. It restricts the search results to prices within the specified vendor. |
نصيحة
When the ENABLE_SEARCH_SIDE_FILTERS
configuration is disable, sending a request to the API will hide the sidebar, providing a streamlined search experience without filtering options.
- Query Parameters:
Key | Type | Description |
---|---|---|
enable_search_side_filters | Boolean | This parameter allows you to control the visibility of sidebar filters. When set to true, the API response will include sidebar details. |
- Success Response:
Key | Type | Description |
---|---|---|
total | Integer | The total number of products that match the search criteria. |
total_products | Integer | The total number of products that match the search criteria. |
min_price | Integer | The minimum price of the products that match the search criteria. |
max_price | Integer | The maximum price of the products that match the search criteria. |
products | Array | An array of products that match the search criteria. |
products_options | Array | An array of products options that match the search criteria. |
sub_categories | Array | An array of sub-categories that match the search criteria. |
brands | Array | An array of brands that match the search criteria. |
200 OK - If the request was successful
{
"code": 200,
"data": {
"total": 23,
"total_products": 228,
"min_price": 149,
"max_price": 3499,
"products": [
{
"id": 2253,
"brand": {
"id": 37,
"name": "Honor",
"name_ar": "هونر",
"name_en": null,
"image": "https://etisal-storeapi.supercommerce.io/storage/uploads/gn2Ajs-1615981987.png"
},
"parent_id": null,
"sku": "main_Honor_X9a",
"slug": "Honor-X9a",
"name": "Honor X9a",
"name_en": "Honor X9a",
"name_ar": "هونر X9a",
"image": "https://docapi.supercommerce.io/storage/uploads/1-honor-x9a-8gb-256gb-midnight-black-1689769189.webp",
"price": 16777,
"discount_price": 16499,
"direct_discount": true,
"category": {
"id": 1081,
"name": "Mobiles",
"name_ar": "موبايل",
"slug": "mobiles",
"sub_categories": [
{
"id": 1089,
"name": "Honor",
"name_ar": "هونر",
"slug": "honor"
}
]
},
"type": 1,
"product_variants_options": [
{
"option": {
"id": 122,
"name": "Color",
"name_ar": "اللون",
"name_en": "Color",
"description": null,
"type": "4",
"preview_type": 1,
"default": false,
"order": 10
},
"values": [
{
"id": 107,
"name": "Black",
"image": "https://docapi.supercommerce.io/storage/uploads/1-honor-x9a-8gb-256gb-midnight-black-1689769205.webp",
"color_code": "#000000"
},
{
"id": 116,
"name": "Green",
"image": "https://docapi.supercommerce.io/storage/uploads/1-honor-x9a-8gb-256gb-emereld-green-1689773008.webp",
"color_code": "#00FF00"
},
"id": 108,
"name": "Silver",
"image": "https://docapi.supercommerce.io/storage/uploads/1-honor-x9a-8gb-256gb-titanuim-silver-1689773164.webp",
"color_code": "#C0C0C0"
}
]
}
],
"product_variants": [
{
"id": 2254,
"name": "Honor X9a 8GB RAM 256GB - Midnight Black",
"slug": "honor-x9a-black",
"share_link": "https://doc.supercommerce.io/en/honor-x9a-black",
"name_en": "Honor X9a 8GB RAM 256GB - Midnight Black",
"name_ar": "هونر X9a رام 8 جيجا بايت - مساحة 256 جيجا بايت - اسود",
"sku": "5109ANPY",
"barcode": null,
"price": 16777,
"discount_price": 16499,
"stock": 10,
"image": "https://docapi.supercommerce.io/storage/uploads/1-honor-x9a-8gb-256gb-midnight-black-1689769189.webp",
"parent_id": 2253,
}
],
"active": true,
//...
}
],
"products_options": [],
"sub_categories": [],
"brands": [],
}
}
معلومات
Check the following section to learn more about the Search Product API Reference