Search & querying

Aikey's search library is a great way of implementing fast personalised category views and search views.

 

searchTerm
[Not Required]
This is a free text search that accept any type of string. It can be used to implement a free text search function on your site. But without it you get a regular category type result.
orderBy
[Not Required] [Default: Title]
Order of the products returned. Can be set to:
orderByDirection
[Not Required] [Default: DESC]
Can be set to DESC for descending order or ASC for ascending.
limit
[Not Required] [Default: 6]
How many products should be returned.
offset
[Not Required] [Default: 0]
Offset where to start taking products from.
currency
[Not Required] [Default: first found]
What currency and price that should be returned. While this is not required it should always be provided when you use multiple currencies.
priceRange
[Not Required]
The Price Range can be used to filter down products in a certain price range. It is an object with from and to {from: 0, to: 200}.
facets
[Not Required]
Facets use the dynamic properties set to a product to filter down the results. This is sent in as a an object with property name as key and an array of property values as the objects value. {Category: [ "Sneakers", "Boots"]}
curl --location --request GET 'https://api.aikey.io/v1/products/search' \
--header 'X-CLIENTID: ClientId' \
--header 'X-SECRET: ClientSecret' \
--header 'Content-Type: text/plain' \
--data-raw '{
 "userId": "U.5dce535fdafa85.72034206",
 "sessionId": "S.5e0bb971a9a1b0.02111481",
 "searchTerm": "",
 "orderBy": "title",
 "orderByDirection": "DESC",
 "limit": 6,
 "offset": 0,
 "currency": "EUR",
 "priceRange": {"from": 0, "to": 200},
 "properties": {
   "Category": [ "Sneakers", "Boots" ],
   "Color": ["White", "Blue"]
  }   
}'
{
    "message": "Request was successful.",
    "success": true,
    "data": {
        "products": [
            {
                "sku": "123-tommyhilfinger-m",
                "title": "Tommy Hilfiger - Black boots",
                "score": 1,
                "price": {
                    "currency": "EUR",
                    "value": 181
                },
                "properties": [
                    {
                        "name": "",
                        "value": ""
                    },
                    {
                        "name": "Color",
                        "value": ""
                    },
                    {
                        "name": "Gender",
                        "value": "Men"
                    },
                    {
                        "name": "Category",
                        "value": "Boots"
                    },
                    {
                        "name": "Brand",
                        "value": "Tommy Hilfiger"
                    }
                ],
                "link": "https://demo.aikey.io/men/boots/tommy-hilfiger-black-boots/",
                "imageLink": "https://www.aikey.io/media/1090/tommyhilfinger-boots.jfif",
                "description": "Lorem ipsum dolor sit amet."
            },
            {
                "sku": "1505309",
                "title": "Dr Martens – Combs Tech",
                "score": 1,
                "price": {
                    "currency": "EUR",
                    "value": 122
                },
                "properties": [
                    {
                        "name": "Brand",
                        "value": "Dr Martens"
                    },
                    {
                        "name": "Category",
                        "value": "Boots"
                    },
                    {
                        "name": "Gender",
                        "value": "Men"
                    },
                    {
                        "name": "Color",
                        "value": ""
                    },
                    {
                        "name": "",
                        "value": ""
                    }
                ],
                "link": "https://demo.aikey.io/men/boots/dr-martens-combs-tech/",
                "imageLink": "https://www.aikey.io/media/1147/12683673-1-black.jpg",
                "description": "Lorem ipsum dolor sit amet."
            },
            {
                "sku": "boss-socks-m",
                "title": "Boss - Socks",
                "score": 1,
                "price": {
                    "currency": "EUR",
                    "value": 15
                },
                "properties": [
                    {
                        "name": "",
                        "value": ""
                    },
                    {
                        "name": "Color",
                        "value": ""
                    },
                    {
                        "name": "Gender",
                        "value": "Men"
                    },
                    {
                        "name": "Category",
                        "value": "Accessories"
                    },
                    {
                        "name": "Brand",
                        "value": "Boss"
                    }
                ],
                "link": "https://demo.aikey.io/men/accessories/boss-socks/",
                "imageLink": "https://www.aikey.io/media/1100/boss-socls.jpg",
                "description": "Lorem ipsum dolor sit amet."
            },
            {
                "sku": "123-vans-w",
                "title": "Vans Authentic - Yellow",
                "score": 1,
                "price": {
                    "currency": "EUR",
                    "value": 87
                },
                "properties": [
                    {
                        "name": "",
                        "value": ""
                    },
                    {
                        "name": "Color",
                        "value": ""
                    },
                    {
                        "name": "Gender",
                        "value": "Women"
                    },
                    {
                        "name": "Category",
                        "value": "Sneakers"
                    },
                    {
                        "name": "Brand",
                        "value": "Vans"
                    }
                ],
                "link": "https://demo.aikey.io/women/sneakers/vans-authentic-yellow/",
                "imageLink": "https://www.aikey.io/media/1095/vans.jfif",
                "description": "Lorem ipsum dolor sit amet."
            },
            {
                "sku": "123-puma-training-w",
                "title": "Puma – Training mode XT",
                "score": 1,
                "price": {
                    "currency": "EUR",
                    "value": 87
                },
                "properties": [
                    {
                        "name": "",
                        "value": ""
                    },
                    {
                        "name": "Color",
                        "value": ""
                    },
                    {
                        "name": "Gender",
                        "value": "Women"
                    },
                    {
                        "name": "Category",
                        "value": "Sneakers"
                    },
                    {
                        "name": "Brand",
                        "value": "Puma"
                    }
                ],
                "link": "https://demo.aikey.io/women/sneakers/puma-training-mode-xt/",
                "imageLink": "https://www.aikey.io/media/1098/rebook-pastel.jpg",
                "description": "Lorem ipsum dolor sit amet."
            },
            {
                "sku": "puma-storm-w",
                "title": "Puma – STORM.Y",
                "score": 1,
                "price": {
                    "currency": "EUR",
                    "value": 97
                },
                "properties": [
                    {
                        "name": "",
                        "value": ""
                    },
                    {
                        "name": "Color",
                        "value": ""
                    },
                    {
                        "name": "Gender",
                        "value": "Women"
                    },
                    {
                        "name": "Category",
                        "value": "Sneakers"
                    },
                    {
                        "name": "Brand",
                        "value": "Puma"
                    }
                ],
                "link": "https://demo.aikey.io/women/sneakers/puma-stormy/",
                "imageLink": "https://www.aikey.io/media/1099/puma-peacoat.jpg",
                "description": "Lorem ipsum dolor sit amet."
            }
        ],
        "itemCount": 23,
        "facets": {
            "Color": [
                {
                    "label": "Black",
                    "count": 2,
                    "selected": false
                },
                {
                    "label": "Blue",
                    "count": 2,
                    "selected": false
                },
                {
                    "label": "White",
                    "count": 2,
                    "selected": false
                },
                {
                    "label": "Grey",
                    "count": 1,
                    "selected": false
                }
            ],
            "Gender": [
                {
                    "label": "Men",
                    "count": 10,
                    "selected": false
                },
                {
                    "label": "Women",
                    "count": 13,
                    "selected": false
                }
            ],
            "Category": [
                {
                    "label": "Boots",
                    "count": 8,
                    "selected": false
                },
                {
                    "label": "Accessories",
                    "count": 2,
                    "selected": false
                },
                {
                    "label": "Sneakers",
                    "count": 13,
                    "selected": false
                }
            ],
            "Brand": [
                {
                    "label": "Dr Martens",
                    "count": 4,
                    "selected": false
                },
                {
                    "label": "Tommy Hilfiger",
                    "count": 1,
                    "selected": false
                },
                {
                    "label": "Boss",
                    "count": 1,
                    "selected": false
                },
                {
                    "label": "Vans",
                    "count": 1,
                    "selected": false
                },
                {
                    "label": "Nike",
                    "count": 6,
                    "selected": false
                },
                {
                    "label": "Puma",
                    "count": 2,
                    "selected": false
                },
                {
                    "label": "Monki",
                    "count": 1,
                    "selected": false
                },
                {
                    "label": "Vagabond",
                    "count": 1,
                    "selected": false
                },
                {
                    "label": "adidas Originals",
                    "count": 2,
                    "selected": false
                },
                {
                    "label": "Pull&Bear",
                    "count": 1,
                    "selected": false
                },
                {
                    "label": "adidas",
                    "count": 2,
                    "selected": false
                },
                {
                    "label": "Reebok",
                    "count": 1,
                    "selected": false
                }
            ]
        },
        "maxPrice": 210
    }
}