Guides

How to implement the "SearchProduct by Id" API

Catalog management

Whenever a product is queried by OmniChat, this API will be called, and must return a list containing a single product, following the pattern below:

[
    {
        "blocked": false,
        "objectId": "12345",
        "name": "iPhone 14 Pro",
        "productDescription": "Produto de teste",
        "externalUrl": "https://www.apple.com/br/iphone-14-pro/",
        "mainVariant": {
            "objectId": "12345-1",
            "externalImageURL": "https://www.apple.com/newsroom/images/product/iphone/geo/Apple-iPhone-14-Pro-iPhone-14-Pro-Max-deep-purple-220907-geo_inline.jpg.large.jpg",
            "erpId": "12345-2",
            "name": "iPhone 14 Pro 128gb Purple",
            "visible": true,
            "price": 9499.99,
            "salePrice": 9400,
            "quantity": 30,
            "sellerId": "1",
            "sellerName": "Apple",
            "width": 7.15,
            "height": 14.8,
            "variantLength": 1,
            "weight": 206,
            "variations": [
                {
                    "key": "Cor",
                    "value": "Purple"
                },
                {
                    "key": "Memória",
                    "value": "128gb"
                }
            ]
        },
        "variants": [
            {
                "objectId": "12345-1",
                "externalImageURL": "https://www.apple.com/newsroom/images/product/iphone/geo/Apple-iPhone-14-Pro-iPhone-14-Pro-Max-deep-purple-220907-geo_inline.jpg.large.jpg",
                "erpId": "54321-1",
                "name": "iPhone 14 Pro 128gb Purple",
                "visible": true,
                "price": 9499.99,
                "salePrice": 9400,
                "quantity": 30,
                "sellerId": "1",
                "sellerName": "Apple",
                "width": 7.15,
                "height": 14.8,
                "variantLength": 1,
                "weight": 206,
                "variations": [
                    {
                        "key": "Cor",
                        "value": "Purple"
                    },
                    {
                        "key": "Memória",
                        "value": "128gb"
                    }
                ]
            },
            {
                "objectId": "12345-2",
                "externalImageURL": "https://store.storeimages.cdn-apple.com/4982/as-images.apple.com/is/iphone-14-pro-gold-witb-202209_FMT_WHH?wid=560&hei=744&fmt=jpeg&qlt=90&.v=1660789320262",
                "erpId": "54321-2",
                "name": "iPhone 14 Pro 128gb Gold",
                "visible": true,
                "price": 9399.99,
                "salePrice": 9200,
                "quantity": 28,
                "sellerId": "1",
                "sellerName": "Apple",
                "width": 7.15,
                "height": 14.8,
                "variantLength": 1,
                "weight": 206,
                "variations": [
                    {
                        "key": "Cor",
                        "value": "Gold"
                    },
                    {
                        "key": "Memória",
                        "value": "128gb"
                    }
                ]
            },
            {
                "objectId": "12345-3",
                "externalImageURL": "https://www.apple.com/newsroom/images/product/iphone/geo/Apple-iPhone-14-Pro-iPhone-14-Pro-Max-silver-220907-geo_inline.jpg.large.jpg",
                "erpId": "54321-2",
                "name": "iPhone 14 Pro 128gb Silver",
                "visible": true,
                "price": 9499.99,
                "salePrice": 9499.99,
                "quantity": 0,
                "sellerId": "1",
                "sellerName": "Apple",
                "width": 7.15,
                "height": 14.8,
                "variantLength": 1,
                "weight": 206,
                "variations": [
                    {
                        "key": "Cor",
                        "value": "Gold"
                    },
                    {
                        "key": "Memória",
                        "value": "128gb"
                    }
                ]
            }
        ],
        "sellOutOfStock": false,
        "trackInventory": true
    }
]

To perform the search by id, you will receive in your endpoint the queryParams with the ID value and the queryParams query informing the id to be searched.

Example:

curl --location 'https://your_endpoint?searchType=ID&query=123