Patch Existing Rules

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

curl -X PATCH -H "Content-Type: application/json" \
-d '{
"slot_rules": [
{
"target": "facet_group",
"rule": {
"name": "Brand",
"position": 2
},
"active": true
},
{
"target": "facet_option",
"facet_group_name": "Size"
"rule": {
"name": "L",
"position": 1
},
"active": true
}
],
"blacklist_rules": [
{
"target": "facet_group",
"rule": {
"name": "Color"
},
"active": true
},
{
"target": "facet_option",
"facet_group_name": "Size"
"rule": {
"name": "XL"
},
"active": true
}
]
}' \
-u"[your token]:" "https://ac.cnstrc.com/refined_filters/group_id/dog%20food?key=[your index key]&section=Products&response_section=facets"
info

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

HTTP Request#

PATCH https://ac.cnstrc.com/refined_filters/[filter_name]/[filter_value]?key=[your index key]&section=[section]&response_section=facets

URL Parameters#

ParameterDescription
filter_nameThe name of the facet you'd like to patch facet configuration rules for.
filter_valueThe value of the facet you'd like to patch facet configuration rules for.
sectionYesThe index section you'd like to retrieve results from (typically Products).

JSON Specifications#

Example JSON:

{
"slot_rules": [
{
"target": "facet_group",
"rule": {
"name": "Brand",
"position": 2
},
"active": true
},
{
"target": "facet_option",
"facet_group_name": "Size",
"rule": {
"name": "L",
"position": 1
},
"active": true
}
],
"blacklist_rules": [
{
"target": "facet_group",
"rule": {
"name": "Color"
}
},
{
"target": "facet_option",
"facet_group_name": "Size",
"rule": {
"name": "XL"
}
}
]
}
info

Use the target field to specify if the rule should be applied to a facet group or facet option.

If target is set to facet_option you need to specifiy the parent facet_group_name as well.

Types of rules#

idDescription
slot_rulesWith slot rules, you can pin a facet group or facet option to a particular position. Provide a target (i.e. facet_group or facet_option) and provide name and a particular position for the facet group or option.
blacklist_rulesRemove matching items from recall.

Parameters#

ParameterRequired?Description
ruleYesRules can accept an object of the various rule specs as show in the above JSON example.
activeNoYour facet configuration rules can be defined but set to inactive if you wish by setting active field to false.
targetYesSpecifies if the rule should be applied to a facet group or option.
facet_group_nameNoThis field is required if target is set to facet_option. It specifies the parent facet group name this option-based rule should apply to.