Printago API
POST /v1/routing-rules/preview

Preview a routing rule's impact

See what saving a rule would change, without saving it Compares the rules as saved with the same rules after `draft` is saved, over the jobs queued now and every printer. Pass `ruleId` when the draft is an edit of a saved rule; leave it out for a new rule. A draft with `enabled: false` is previewed as that rule being switched off. Counts are of job and printer pairs, and cover only the pairs that were evaluated: when the queue is too long to check in one request, `truncated` is true and `evaluated.jobs` is the head of the queue that was checked, out of `queued.jobs`. Up to 20 examples come back for each direction of change. A draft that fails validation returns 400 with `errors`, as creating it would.

Requires: routingRules.view

Request Body

The draft rule, and the saved rule it replaces if any

RoutingRulePreviewRequest
draftrequired
object
enabledoptional
boolean
Defaults to true. A draft that is off is previewed as the rule being off.
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.
rightoptional
object
Left out for the operators that take no value: `exists`, `isEmpty`.
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.
rightoptional
object
Left out for the operators that take no value: `exists`, `isEmpty`.
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[]
ruleIdoptional
string
The saved rule the draft would replace. Left out for a new rule.
pattern: ^[a-z0-9]{24}$

Example Request

application/json
{
  "ruleId": "string",
  "draft": {
    "enabled": true,
    "whenExpr": {
      "all": []
    },
    "expr": {
      "all": []
    }
  }
}

Response Schema

RoutingRulePreview
blockedAfterrequired
number
Pairs blocked with the draft in place.
blockedBeforerequired
number
Pairs the saved rules block.
evaluatedrequired
object
jobsrequired
number
pairsrequired
number
printersrequired
number
newlyBlockedrequired
object
countrequired
number
examplesrequired
object[]
childPartNameoptional
string
On a merged plate, the part the rule keeps off the printer.
jobLabelrequired
string
jobsrequired
number
How many jobs this example stands for.
printerIdrequired
string
pattern: ^[a-z0-9]{24}$
printerNamerequired
string
printJobIdrequired
string
The first of the jobs, in queue order.
pattern: ^[a-z0-9]{24}$
ruleIdoptional
string
The rule that blocks the pair: after the change if newly blocked, before it if newly allowed.
pattern: ^[a-z0-9]{24}$
ruleNameoptional
string
newlyUnblockedrequired
object
countrequired
number
examplesrequired
object[]
childPartNameoptional
string
On a merged plate, the part the rule keeps off the printer.
jobLabelrequired
string
jobsrequired
number
How many jobs this example stands for.
printerIdrequired
string
pattern: ^[a-z0-9]{24}$
printerNamerequired
string
printJobIdrequired
string
The first of the jobs, in queue order.
pattern: ^[a-z0-9]{24}$
ruleIdoptional
string
The rule that blocks the pair: after the change if newly blocked, before it if newly allowed.
pattern: ^[a-z0-9]{24}$
ruleNameoptional
string
queuedrequired
object
The whole pending queue, evaluated or not.
jobsrequired
number
truncatedrequired
boolean
True when the queue had more pairs than one request evaluates.

Example Response

201 OK — application/json
{
  "queued": {
    "jobs": 1
  },
  "evaluated": {
    "jobs": 1,
    "printers": 1,
    "pairs": 1
  },
  "blockedBefore": 1,
  "blockedAfter": 1,
  "newlyBlocked": {
    "count": 1,
    "examples": [
      {
        "printJobId": "string",
        "jobLabel": "string",
        "jobs": 1,
        "printerId": "string",
        "printerName": "string",
        "ruleId": "string",
        "ruleName": "string",
        "childPartName": "string"
      }
    ]
  },
  "newlyUnblocked": {
    "count": 1,
    "examples": [
      {
        "printJobId": "string",
        "jobLabel": "string",
        "jobs": 1,
        "printerId": "string",
        "printerName": "string",
        "ruleId": "string",
        "ruleName": "string",
        "childPartName": "string"
      }
    ]
  },
  "truncated": true
}