Patch an Item
- Shell
- JavaScript
- Ruby
- Python
- PHP
- Java
- C#
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 RequestPATCH https://ac.cnstrc.com/v1/item?key=[your API key]
#
JSON ParametersParameter | Required? | Description |
---|---|---|
item_name | Yes | The name of the item, as it will appear in the results |
section | Yes | Your 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_score | No | A 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) |
keywords | No | An 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. |
url | No | A URL to directly send the user after selecting the item |
image_url | No | A URL that points to an image you'd like displayed next to some item (only applicable when url is supplied) |
description | No | A description for some item (only applicable when url is supplied) |
id | No | An 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. |
facets | No | key/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. |
metadata | No | You 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_ids | No | You can associate each item with one or more groups (i.e. categories). To set up a group hierarchy please contact support@constructor.io. |