The validation rule object

📘

This entity stores the validation rules used to limit your promo campaigns.

📘

You can configure Validation Rule to include your own custom error messages which are going to be returned from API upon validation / redemption failure. You can read more here.

Attribute

Description

Example

id string

val_elcvePRgR9L2

object string

Type of the object represented by JSON. Value is validation_rules.

name string

A name of validation rules

Redeemable once for New Customers

created_at string, ISO 8601 date format

2016-11-16T14:14:31Z

updated_at string, ISO 8601 date format

2016-11-16T14:14:31Z

rules object

A set of rules and logic applied between them

{ "1": { "name": "customer.segment", "conditions": { "$is": ["seg_n3vVcU5t0m3rs4rEPr3C1oU5"] } }, "2": { "name": "redemption.count.per_customer", "conditions": { "$less_than_or_equal": [1] } }, "logic": "1 and 2" }

error object

Error message that should be returned from API. You can read more here

{ "error": { "message": "You must be our new customer and have IPhone in shopping cart" }

{
  "id": "val_BHMuN4ZGUsjF",
  "created_at": "2016-09-05",
  "voucher_code": "8ZY60Wtw",
  "id": "val_s3C0nDru7e",
  "name": "Redeemable Once for new Customers",
  "rules": {
    "1": {
      "name": "customer.segment",
      "conditions": {
        "$is": ["seg_n3vVcU5t0m3rs4rEPr3C1oU5"]
      }
    },
    "2": {
      "name": "redemption.count.per_customer",
      "conditions": {
        "$less_than_or_equal": [1]
      }
    },
    "logic": "1 and 2"
  },
  "object": "validation_rules"
}