Add an Item

search suggestion
curl -X POST -H "Content-Type: application/json" \
-d '{"item_name": "Golden Retriever",
"section": "Search Suggestions"}' \
-u"[your token]:" "https://ac.cnstrc.com/v1/item?key=[your API key]"
product
curl -X POST -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",
"facets": {
"Personality": ["Friendly", "Playful"]
},
"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
}
],
"metadata": { "animal": "dog" },
"group_ids": [ "23", "45" ]}'\
-u"[your token]:" "https://ac.cnstrc.com/v1/item?key=[your API key]"
info

The above command returns a 204 Success response on success.

To add an item to your index, use the POST /item call. The item_name is required. You can also pass in an optional suggested_score between 1 and 100 million, which 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). You can also optionally pass in the item's keywords to give us more meta information and help us better determine how and where to display the item when autocompleting. If you would like to add an item that points to a direct link, just pass in that link as a url. Finally, 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.

HTTP Request#

POST https://ac.cnstrc.com/v1/item?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.
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.
metadataNoYou can associate schema-less data with items by passing in an object of keys and values. To configure search and display of this data reach out to support@constructor.io.
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. group_ids can be used as filters in search, autosuggest, and browse requests.
variationsNoList of this item's variations. See Variations