Create a new catalog item
Adds a new item to the catalog.
- The
attributesfield structure is required and depends on thecategory. See schema description for details. - The
item_vectorfield is optional. Send a 32-dimension array or omit/sendnullif no vector is available. - The
idfield should not be provided; it's generated by the server.
Body
Required
Catalog item to add.
-
The category of the item. Determines the structure of 'attributes'.
Values are
tops,dresses,pants,outerwear,shoes, oraccessories. -
The name of the catalog item.
-
Identifier for the item's brand.
-
URL link to the item's product page.
-
Price of the item.
-
URL link to an image of the item.
-
Key-value pairs describing item-specific attributes. Required keys depend on the
categoryfield. See the mainCatalogItemschema description for the expected structure per category.Additional properties are allowed.
-
Optional 32-dimensional vector embedding for the item. Omit or send
nullif no vector is available.At least
32but not more than32elements.
POST
/api/catalog
curl \
--request POST 'http://localhost:8000/api/catalog' \
--header "Content-Type: application/json" \
--data '{"price":79.5,"brand_id":"brand_summer","category":"dresses","item_img":"https://example.com/images/dresses/floral-sundress.jpg","item_url":"https://example.com/products/dresses/floral-sundress","item_name":"Floral Print Sundress","attributes":{"fit":"A-Line","size":"S","colors":["Yellow","White","Green"],"gender":"Female","leg_cut":"N/A","pattern":"Floral","materials":["Rayon"],"neck_line":"V-Neck","seasonality":"Summer","closure_type":"Zipper","skirt_length":"Knee Length","back_exposure":"Low Back","sleeve_length":"Sleeveless","shoulder_exposure":"Spaghetti Straps"},"item_vector":[0.91,0.82,0.73,0.64,0.55,0.46,0.37,0.28,-0.19,-0.1,-0.21,-0.32,-0.43,-0.54,-0.65,-0.76,0.95,0.86,0.77,0.68,0.59,0.5,0.41,0.32,-0.23,-0.14,-0.25,-0.36,-0.47,-0.58,-0.69,-0.8]}'
Request examples
Example adding a dress with a vector
{
"price": 79.5,
"brand_id": "brand_summer",
"category": "dresses",
"item_img": "https://example.com/images/dresses/floral-sundress.jpg",
"item_url": "https://example.com/products/dresses/floral-sundress",
"item_name": "Floral Print Sundress",
"attributes": {
"fit": "A-Line",
"size": "S",
"colors": [
"Yellow",
"White",
"Green"
],
"gender": "Female",
"leg_cut": "N/A",
"pattern": "Floral",
"materials": [
"Rayon"
],
"neck_line": "V-Neck",
"seasonality": "Summer",
"closure_type": "Zipper",
"skirt_length": "Knee Length",
"back_exposure": "Low Back",
"sleeve_length": "Sleeveless",
"shoulder_exposure": "Spaghetti Straps"
},
"item_vector": [
0.91,
0.82,
0.73,
0.64,
0.55,
0.46,
0.37,
0.28,
-0.19,
-0.1,
-0.21,
-0.32,
-0.43,
-0.54,
-0.65,
-0.76,
0.95,
0.86,
0.77,
0.68,
0.59,
0.5,
0.41,
0.32,
-0.23,
-0.14,
-0.25,
-0.36,
-0.47,
-0.58,
-0.69,
-0.8
]
}
{
"price\"": 24.99,
"brand_id": "brand_basics",
"category": "tops",
"item_url": "https://example.com/products/tops/classic-crew-tee",
"item_img\"": "https://example.com/images/tops/classic-crew-tee.jpg",
"item_name": "Classic Crew Neck T-Shirt",
"attributes\"": {
"fit": "Regular",
"size": "M",
"colors": [
"Heather Gray"
],
"pattern": "Solid",
"neckline": "Crew Neck",
"materials": [
"Cotton",
"Polyester"
],
"closure_type": "Pullover",
"sleeve_length": "Short Sleeve"
},
"item_vector\"": null
}
{
"price": 110.0,
"brand_id": "brand_footwear",
"category": "shoes",
"item_img": "https://example.com/images/shoes/leather-sneakers-white.jpg",
"item_url": "https://example.com/products/shoes/leather-sneakers-white",
"item_name": "Classic Leather Sneakers",
"attributes": {
"size": 9.5,
"wide": "Standard",
"boots": "Not Boots",
"heels": "Flat",
"colors": [
"White",
"Blue accent"
],
"gender": "Unisex",
"pattern": "Solid with stripe",
"materials": [
"Leather Upper",
"Rubber Sole"
],
"seasonality": "All-Season",
"shoe_height": "Low Top"
}
}
Response examples (201)
{
"id": 42,
"category": "tops",
"item_name": "string",
"brand_id": "string",
"item_url": "string",
"price": 42.0,
"item_img": "string",
"attributes": {},
"item_vector": [
42.0
]
}
Response examples (400)
{
"error": "string"
}
Response examples (500)
{
"error": "string"
}