Visual Search
Website Theme/Blueprint Required Changes
XConnect Hawksearch provides the following API to upload an image for Visual Search:
POST api/xconnect/v1/imagesearch/upload
{
"imageData ": "<valid image data URL> "
}
An example of a :
data:image/png;base64,iVBORw[…]Aysvs==
The image data must be under 5MB and a valid image format. Currently, Hawksearch supports: jpg, png, bmp and gif
This API returns a new GUID. This GUID is then passed to the Opti OOTB products API as a query string to obtain results for the uploaded image:
/api/v2/products?includeSuggestions=true&search=&expand=attributes%2Cfacets%2CvariantTraits%2Cbadges&applyPersonalization=true&relevancy=true&searchImageKey=8285574e-d4b5-4b36-88e3-b338005e8315
Known Limitations
Images are stored in the SharedCacheManager for 30 minutes. After this time, or potentially after server restarts, the uploaded image is no longer available for image search and must be re-uploaded. If this occurs, the (v1 and v2) /products API will return the following error message:
{
error: {
code: "500",
message: "The image key provided was not found or is no longer available. Re-upload upload the image to the api/xconnect/v1/imagesearch/upload API to receive a new image key."
}
}
It is unknown whether this limitation will be addressed at this time
Updated 2 days ago