Batch Add or Update Items
- Shell
- JavaScript
- Ruby
- Python
- PHP
- Java
- C#
info
The above command(s) return a 204 Success response on success.
A batch add or update allows you to add a group of items to your index without first checking to make sure no item in the batch already exists.
Any items that don't already exist are created, and any items that already exist are updated. This is also known as an UPSERT
operation.
To add or update a batch of items to your index, use the PUT /batch_items
call, with ?force=1
. Options are the same as for the standard Batch Add Items
call: item_name
and section
are required and all other parameters are optional.
We determine whether items already exist based on the item_name
and section
set for each item. However, if the optional id
parameter is set for the items, we determine whether items already exist using this parameter.
There is a limit of 1,000 items per batch request.
#
HTTP RequestPUT https://ac.cnstrc.com/v1/batch_items?force=1&key=[your API key]
#
JSON ParametersParameter | Required? | Description |
---|---|---|
section | Yes | Your autosuggest and search reuslts 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. |
items | Yes | A list of items with the same attributes as defined in the Add an Item resource |