Search Products By Image API: AI Powered Product Lookup
In the dynamic world of e-commerce, managing and updating product information efficiently is crucial. SightScout provides a powerful visual search API designed to streamline the search process for users by allowing them to find products through images. One of the key features of SightScout is the ability to save and update records in the product index. This is achieved through the Save Records endpoint, which allows developers to add or replace records in the index easily.
What is the Save Records Endpoint?
The Save Records endpoint is an API endpoint that enables developers to add new records or replace existing ones in the SightScout index. This functionality is essential for maintaining an up-to-date product catalog, ensuring that users always have access to the latest product information.
How Does It Work?
When you make a POST request to the Save Records endpoint, SightScout processes the provided data and either adds a new record or updates an existing one based on the objectID. If the objectID is not specified, SightScout automatically generates one. If an existing objectID is provided, the record is completely replaced with the new data, except for the objectID.
Endpoint Details
URL:
POST https://sightscout.net/api/v1/indexes/YOUR_INDEX_HOST/saveRecord
Request Body:
{
"objectID": "your-object-id",
"image_url": "value1",
"product_id": "value2",
"meta_data": "{\"color\":\"azul\",\"talle\":\"M\",\"brand\":\"ExampleBrand\"}"
}
Parameters Explained
- objectID:
- Type: String
- Description: Unique identifier for the record. If not provided, SightScout generates one automatically. When specified, it ensures that the existing record with this objectID is completely replaced with the new data.
- image_url:
- Type: String
- Description: URL of the product image. This image is used by SightScout for visual search matching.
- product_id:
- Type: String (Optional)
- Description: An optional field that allows you to associate multiple images with a single product. This is particularly useful for e-commerce stores where a single product might have multiple images (e.g., different angles, colors, or variants).
- meta_data:
- Type: String (JSON-formatted)
- Description: Additional metadata associated with the product. This can include attributes such as color, size, brand, and more. The metadata is stored as a JSON string and can be used to enhance search filters and improve user experience.
Example Usage
To illustrate, let's consider an example where an e-commerce platform needs to add a new product or update an existing one in their SightScout index.
Request:
{
"objectID": "12345",
"image_url": "https://example.com/images/product1.jpg",
"product_id": "prod_001",
"meta_data": "{\"color\":\"blue\",\"size\":\"M\",\"brand\":\"ExampleBrand\"}"
}
In this example:
- The objectID "12345" ensures that if a record with this ID already exists, it will be replaced with the new data.
- The image_url provides the URL to the product image.
- The product_id "prod_001" allows multiple images to be associated with the same product.
- The meta_data contains additional attributes of the product, such as color, size, and brand, enhancing the search and filtering capabilities.
How to Integrate
- Setup API Access: Ensure you have the necessary API keys and access tokens to authenticate your requests.
- Prepare Data: Gather the product information, including image URLs, product IDs, and metadata.
- Make the Request: Use the provided URL and structure your POST request as shown in the example.
- Handle Responses: Implement error handling to manage successful additions, updates, and any potential issues.
Benefits for Developers
Integrating the Save Records endpoint into your e-commerce platform provides several advantages:
- Efficient Data Management: Easily update or add new product information, ensuring your catalog is always current.
- Enhanced Search Accuracy: By providing detailed metadata, users can enjoy more accurate and refined search results.
- Flexibility: The ability to associate multiple images with a single product ID allows for comprehensive product representation.
Conclusion
The Save Records endpoint in SightScout is a powerful tool for developers looking to maintain an up-to-date and accurate product catalog. By allowing for seamless addition and replacement of product records, this endpoint ensures that your e-commerce platform can deliver a superior shopping experience to your users. Whether you are adding new products or updating existing ones, SightScout's Save Records endpoint offers the flexibility and functionality needed to keep your product information current and accessible.