This API fetches a list of objects identified from the uploaded image. It also returns similar product recommendations for the items detected in the image.
Endpoints
- Production:
https://pathways.dxpapi.com/api/v2/widgets/visual/search/{widget_id}
- Staging:
https://pathways-staging.dxpapi.com/api/v2/widgets/visual/search/{widget_id}
Visual recommendations request
The Visual recommendations API request fetches a list of objects identified from the Item ID and SKU ID combination passed in the query. It also returns similar product recommendations for the objects detected in the image.
A Visual search Request is considered as a Visual recommendations request based on the combination of values of the image_ids
, item_ids
and sku_id
parameters as follows:
image_id passed | item_ids passed | sku_id passed | Request Type |
---|---|---|---|
Yes | No | No | Visual search |
No | Yes | No | Visual recommendations |
No | Yes | Yes | Visual recommendations |
Yes | Yes | Yes/No | Invalid Request - Can't pass image_id and item_ids together |
No | No | Yes/No | Invalid Request - Pass either image_id or item_ids |
Note that it is mandatory to pass the item_ids
parameter for a Visual Recommendations API Request.
Response Example
The response lists the identified objects and retrieves similar product recommendations for all the objects.
If you make a call with object_id, you’ll get targeted results. In the example below, product suggestions are displayed for the object with the "object_id": "1".
{
"response": {
"numFound": 2,
"start": 0,
"docs": [
{
"brand": "GA",
"skuid": "sku211482439",
"pid": "prod253090443",
"thumb_image": "https://media.homeoasis.com/f_auto,q_auto/w_1200,h_1500/01/nm_4357250_100380_m.jpg",
"variants": [
{
"skuid": "sku211482439"
}
],
"price": 2095.0
},
{
"brand": "GA",
"skuid": "sku215611655",
"pid": "prod258280236",
"thumb_image": "https://media.homeoasis.com/f_auto,q_auto/w_1200,h_1500/01/nm_4484851_100380_m.jpg",
"variants": [
{
"skuid": "sku215611655"
}
],
"price": 3995.0
}
]
},
"objects": [
{
"id": 1,
"bbox": [
0,
180,
490,
817
],
"object_type": "dress",
},
{
"id": 2,
"bbox": [
236,
698,
273,
822
],
"object_type": "shoe",
}
],
"metadata": {
"widget": {
"id": "79opvm5j",
"name": "preview",
"description": "preview",
"type": "visual_search",
"rid": "e8811c01-a2f7-4907-a65d-ad42635f8d0e"
},
"response": {
"personalized_results": false,
"fallback": "",
"recall": "pure"
},
"query": {
"image_id": "3d4b4331763c31b39da02704d48e890f90c36ef6b4835eface4820a3e1127987",
"object_id": "1"
}
}
}
{
"response": {
"numFound": 19,
"start": 0,
"docs": [
{
"title": "Techno Cotton Pants, Black",
"thumb_image": "https://www.media.homeoasis.com/product_assets/B/2/X/X/5/NMB2XX5.jpg",
"pid": "prod178830492"
}
]
},
"objects": [
{
"id": 1,
"bbox": [
136,
0,
255,
13
],
"parent_category": "N/A",
"category": "N/A"
},
{
"id": 2,
"bbox": [
121,
6,
272,
414
],
"parent_category": "lowerbody",
"category": "pants"
},
{
"id": 3,
"bbox": [
148,
429,
190,
479
],
"parent_category": "N/A",
"category": "N/A"
},
{
"id": 4,
"bbox": [
202,
431,
240,
479
],
"parent_category": "N/A",
"category": "N/A"
}
],
"metadata": {
"widget": {
"id": "preview",
"name": "preview",
"description": "preview",
"type": "visual_search",
"rid": "53f36486-7637-456c-a8eb-f5831ac2ec94"
},
"response": {
"personalized_results": false,
"fallback": "",
"recall": "pure"
},
"query": {
"image_id": null,
"object_id": -1,
"visual_search_request_type": "recommendations_request"
}
}
}