How many active products a rule set would match
Permission
collections:readRate limit writesIdempotent with Idempotency-KeyDry run of a rule set: how many active products it matches and up to 5 of their names (alphabetical). Nothing is saved.
Authorization
ESTAGE-API-KeystringheaderrequiredA project key, est_live_…, from Settings → API keys. Call from server code only.
Body
application/jsonrulesarray of objectrequired≤ 50 items1–50 rules.
Show 3 fields
fieldstringrequired≤ 96 charstitle, product_type, vendor, price, compare_at_price, weight, inventory_total, variant_title, or attribute:<key>.
relationstringrequiredOne of equals, not_equals, contains, not_contains, starts_with, ends_with, greater_than, less_than, is_set, is_not_set
valueanynullableRequired except for is_set / is_not_set.
rules_matchstringdefault "all"One of all, any
Headers
Idempotency-Keystring≤ 255 charsAny unique string per attempt. A retry with the same key gets the first answer back instead of doing the work twice.
RequestcURL
curl --request POST \ --url 'https://api.estage.com/v1/collections/preview-rules' \ --header 'ESTAGE-API-Key: est_live_your-api-key' \ --header 'Content-Type: application/json' \ --header 'Idempotency-Key: your-unique-key' \ --data '{ "rules": [ { "field": "price", "relation": "less_than", "value": 30 } ], "rules_match": "all" }'
OK
{
"data": {
"count": 2,
"sample": [
"Classic Tee",
"Logo Cap"
]
}
}Example. Errors are
{ error: { code, message, details } }.