Patch Existing Rules

Patching rules will only change those rules that are specified in the request.

curl -X PUT -H "Content-Type: application/json" \
-d '{
"slot_rules": [
{
"rule": {
"item_id": "yarn_ball",
"position": 2
},
"active": true,
"start_time": "2018-06-28 01:34:08",
"end_time": "2018-06-30 01:34:08"
}
]
}' \
-u"[your token]:" "https://ac.cnstrc.com/v1/refined_collections/cat%20playthings?key=[your index key]&section=Products"
info

The above command returns a 204 Success response on success. For simplicity sake, a 204 Success response will be returned even if the item already exists.

HTTP Request#

PATCH https://ac.cnstrc.com/v1/refined_collections/[collection_id]?key=[your index key]&section=[section]

URL Parameters#

ParameterDescription
collection_idThe id of the collection you'd like to patch searchandizing rules for.
sectionYesThe index section you'd like to searchandize collections within (typically Products).

JSON Specifications#

Example JSON:

{
"slot_rules": [
{
"rule": {
"item_id": "yarn_ball",
"position": 1
},
"active": true,
"start_time": "2018-06-28 01:34:08",
"end_time": "2018-06-30 01:34:08"
}
],
"whitelist_rule": {
"rule": {
"filters": { "brand": ["cat toys"] }
},
"end_time": "2018-06-28 01:34:08"
},
"blacklist_rules": [
{
"rule": {
"filters": { "type": ["food"] }
},
"start_time": "2018-06-28 01:34:08",
"end_time": "2018-06-30 01:34:08"
}
],
"boost_rules": [
{
"rule": {
"filters": { "color": ["red"] },
"boost": 0.5
}
}
]
}

Types of rules#

idDescription
slot_rulesWith slot rules, you can add an item to recall and pin it to a particular position. Provide item_id and a particular position for the item(s).
boost_rulesBoost or bury the score (and in turn, ranking) of matching items.
whitelist_ruleRestrict recall to only the matching items.
blacklist_rulesRemove matching items from recall.

Parameters#

ParameterRequired?Description
ruleYesRules can accept an object of the various rule specs as shown in the above JSON example.
activeNoYour searchandizing rules can be defined but set to inactive if you wish by setting active field to false.
start_timeNoStart time of when the searchandizing rule should be enabled.
end_timeNoEnd time of when the searchandizing rule should be disabled.