Batch Add Items

search suggestions
curl -X POST -H "Content-Type: application/json" \
-d '{"items": [ {"item_name": "Golden Retriever"}, {"item_name": "Poodle"} ],
"section":"Search Suggestions"}' \
-u"[your token]:" "https://ac.cnstrc.com/v1/batch_items?key=[your API key]"
products
curl -X POST -H "Content-Type: application/json" \
-d '{
"section":"Products",
"items": [
{
"item_name": "Labradoodle",
"suggested_score": 360,
"keywords": ["poodle","labrador","retriever"],
"url": "http://www.mydogs.com/labradoodle",
"image_url": "https://images.mydogs.com/labradoodle.jpg",
"description": "A crossbreed dog created by crossing the Labrador Retriever and the Poodle",
"metadata": { "animal": "dog" },
"group_ids": [ "23", "45" ],
"variations": [
{
"id": "labradoodle-brown",
"facets": {
"Color": ["Brown"]
},
"image_url": "https://images.mydogs.com/labradoodle-brown.jpg",
"suggested_score": 100,
"metadata": {
"is_default": true
}
},
{
"item_name": "Black Labradoodle",
"id": "labradoodle-black",
"facets": {
"Color": ["Black"]
},
"image_url": "https://images.mydogs.com/labradoodle-black.jpg",
"suggested_score": 200
}
]
},
{
"item_name": "Australian Shepherd",
"suggested_score": 130,
"keywords": ["aussie"],
"url": "http://www.mydogs.com/australian_shepherd",
"image_url": "https://images.mydogs.com/australian_shepherd.jpg",
"description": "A medium-sized breed of dog developed on ranches in the Western United States",
"metadata": { "animal": "dog" },
"group_ids": [ "67", "89" ]
}
]
}' \
-u"[your token]:" "https://ac.cnstrc.com/v1/batch_items?key=[your API key]"
info

The above command(s) return a 204 Success response on success.

To add multiple items to your index as a batch, use the POST /batch_items call. The items parameter is required and is a list of items with the same attributes as defined in the Add an Item resource. Because your autosuggest and search results can have multiple sections, like categories, search suggestions, and direct links to products, you must specify which section you are adding an item to. You can do this with the section parameter.

There is a limit of 1,000 items per batch request.

HTTP Request#

POST https://ac.cnstrc.com/v1/batch_items?key=[your API key]

JSON Parameters#

ParameterRequired?Description
itemsYesA list of items with the same attributes as defined in the Add an Item resource
sectionYesYour autosuggest and search results can have multiple sections like "Products" and "Search Suggestions". This indicates which section this item is for. See your dashboard for the section names to use.