Add or Update an Item

search suggestion
curl -X PUT -H "Content-Type: application/json" \
-d '{"item_name": "Golden Retriever",
"section": "Search Suggestions"}' \
-u"[your token]:" "https://ac.cnstrc.com/v1/item?force=1&key=[your API key]"
product
curl -X PUT -H "Content-Type: application/json" \
-d '{"item_name": "Labradoodle",
"section":"Products",
"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" ]}'\
-u"[your token]:" "https://ac.cnstrc.com/v1/item?key=[your API key]"
info

The above commands return a 204 Success response on success.

An add or update operation (also known as an UPSERT) updates an item in your index if it already exists, or adds the item to your index if it does not yet exist.

To add or update an item in your index, use the PUT /item call, with ?force=1. Options are the same as for the standard Add an Item call: item_name and section are required and all other parameters are optional.

We determine whether an item already exists based on the optional id set for the item, or if not present, the item_name and section.

HTTP Request#

PUT https://ac.cnstrc.com/v1/item?force=1&key=[your API key]

JSON Parameters#

ParameterRequired?Description
item_nameYesThe name of the item, as it will appear in the results
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.
suggested_scoreNoA number between 1 and 100 million that will influence the item's initial ranking relative to other item scores (the higher the score, the higher in the list of suggestions the item will appear)
keywordsNoAn array of keywords for this item. Keywords are useful if you want a product name to appear when a user enters a searchterm that isn't in the product name itself.
urlNoA URL to directly send the user after selecting the item
image_urlNoA URL that points to an image you'd like displayed next to some item (only applicable when url is supplied)
descriptionNoA description for some item (only applicable when url is supplied)
idNoAn arbitrary ID you would like associated with this item. You can use this field to store your own IDs of the items to more easily access them in other API calls.
metadataNoYou can associate schema-less data with items by passing in an array of keys and values. To configure search and display of this data reach out to support@constructor.io.
facetsNokey/value pairs that can be associated with an item and used to filter them during a search. You can associate multiple values with the same key, by making values a list. Facets can be used as filters in search, autosuggest, and browse requests.
group_idsNoYou can associate each item with one or more groups (i.e. categories). To set up a group hierarchy please contact support@constructor.io.