Patch an Item

search suggestion
curl -X PATCH -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 PATCH -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.

The patch operation modifies an item's attributes in your index if the item already exists, or does nothing if the item does not exist. Every field except id and item_name can be patched.

To patch an item in your index, use the PATCH /item call. The options are the same as for the standard Add an Item resource: item_name and section are required and all other parameters are optional.

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

Note that since the item_name parameter is mandatory, one can not use the Patch an Item resource to update the item name.

Also note that item attributes are patched independently: patching the image_url field will not affect the url field and vice versa. That is the main difference between the Patch an Item and the Modify an Item resource: Modify an Item replaces all meta information.

HTTP Request#

PATCH 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 array 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.