Printago API
POST /v1/routing-rules/validate

Validate a routing rule

Check a rule without saving it Runs the checks that creating or updating a rule runs: every field exists, each operator suits its field's type, values have the right type and are allowed values, dates can be read, and `whenExpr` reads only the part, SKU, order and order item. A rule that fails them comes back with `valid: false` and the reasons, as a 200.

Requires: routingRules.view

Request Body

The `whenExpr` and `expr` to check

RoutingRuleValidateRequest
exprrequired
object
Variant 1AllExprTrue when every condition in the list is true.
allrequired
object[]
Variant 2AnyExprTrue when at least one condition in the list is true.
anyrequired
object[]
Variant 3NotExprTrue when the condition is false.
notrequired
object
Variant 1AllExprTrue when every condition in the list is true.
allrequired
object[]
Variant 2AnyExprTrue when at least one condition in the list is true.
anyrequired
object[]
Variant 3NotExprTrue when the condition is false.
Variant 4CmpExprOne field compared with a value or with another field.
cmprequired
enum
in<>contains!=>=<=betweenexists==containsAnycontainsAllisEmptymatches
leftrequired
object
A reference to an attribute on one side of the pairing.
pathrequired
string
Catalog path, e.g. `userTags`, `source`, `custom.batchColor`.
refrequired
"order" | "sku" | "printer" | "part" | "orderItem"
orderskuprinterpartorderItem
rightoptional
object
Left out for the operators that take no value: `exists`, `isEmpty`.
Variant 1RefA reference to an attribute on one side of the pairing.
pathrequired
string
Catalog path, e.g. `userTags`, `source`, `custom.batchColor`.
refrequired
"order" | "sku" | "printer" | "part" | "orderItem"
orderskuprinterpartorderItem
Variant 2LiteralA constant literal operand.
constrequired
string | number | boolean | string | number[]
Variant 4CmpExprOne field compared with a value or with another field.
cmprequired
enum
in<>contains!=>=<=betweenexists==containsAnycontainsAllisEmptymatches
leftrequired
object
A reference to an attribute on one side of the pairing.
pathrequired
string
Catalog path, e.g. `userTags`, `source`, `custom.batchColor`.
refrequired
"order" | "sku" | "printer" | "part" | "orderItem"
orderskuprinterpartorderItem
rightoptional
object
Left out for the operators that take no value: `exists`, `isEmpty`.
Variant 1RefA reference to an attribute on one side of the pairing.
pathrequired
string
Catalog path, e.g. `userTags`, `source`, `custom.batchColor`.
refrequired
"order" | "sku" | "printer" | "part" | "orderItem"
orderskuprinterpartorderItem
Variant 2LiteralA constant literal operand.
constrequired
string | number | boolean | string | number[]
whenExproptionalnullable
object
Variant 1AllExprTrue when every condition in the list is true.
allrequired
object[]
Variant 2AnyExprTrue when at least one condition in the list is true.
anyrequired
object[]
Variant 3NotExprTrue when the condition is false.
notrequired
object
Variant 1AllExprTrue when every condition in the list is true.
allrequired
object[]
Variant 2AnyExprTrue when at least one condition in the list is true.
anyrequired
object[]
Variant 3NotExprTrue when the condition is false.
Variant 4CmpExprOne field compared with a value or with another field.
cmprequired
enum
in<>contains!=>=<=betweenexists==containsAnycontainsAllisEmptymatches
leftrequired
object
A reference to an attribute on one side of the pairing.
pathrequired
string
Catalog path, e.g. `userTags`, `source`, `custom.batchColor`.
refrequired
"order" | "sku" | "printer" | "part" | "orderItem"
orderskuprinterpartorderItem
rightoptional
object
Left out for the operators that take no value: `exists`, `isEmpty`.
Variant 1RefA reference to an attribute on one side of the pairing.
pathrequired
string
Catalog path, e.g. `userTags`, `source`, `custom.batchColor`.
refrequired
"order" | "sku" | "printer" | "part" | "orderItem"
orderskuprinterpartorderItem
Variant 2LiteralA constant literal operand.
constrequired
string | number | boolean | string | number[]
Variant 4CmpExprOne field compared with a value or with another field.
cmprequired
enum
in<>contains!=>=<=betweenexists==containsAnycontainsAllisEmptymatches
leftrequired
object
A reference to an attribute on one side of the pairing.
pathrequired
string
Catalog path, e.g. `userTags`, `source`, `custom.batchColor`.
refrequired
"order" | "sku" | "printer" | "part" | "orderItem"
orderskuprinterpartorderItem
rightoptional
object
Left out for the operators that take no value: `exists`, `isEmpty`.
Variant 1RefA reference to an attribute on one side of the pairing.
pathrequired
string
Catalog path, e.g. `userTags`, `source`, `custom.batchColor`.
refrequired
"order" | "sku" | "printer" | "part" | "orderItem"
orderskuprinterpartorderItem
Variant 2LiteralA constant literal operand.
constrequired
string | number | boolean | string | number[]

Example Request

application/json
{
  "whenExpr": {
    "all": []
  },
  "expr": {
    "all": []
  }
}

Response Schema

RoutingRuleValidation
errorsrequired
object[]
fieldrequired
"expr" | "when"
Which half of the rule the error is in.
exprwhen
messagerequired
string
refoptional
string
The field (`entity.path`) the error is about, when there is one.
validrequired
boolean

Example Response

201 OK — application/json
{
  "valid": true,
  "errors": [
    {
      "field": "expr",
      "message": "string",
      "ref": "string"
    }
  ]
}