En regel består af JSON objekter med disse egenskaber:
‘type’ – Regel type
‘data’ – Den data der skal anvendes
‘operator’ – Den operator der skal bruges
‘operand’ – Argumentet af operatoren
Denne tabel beskriver de forskellige regel typer, data og operators:
Regel type | Regel data | Regel operator |
---|---|---|
data | ^\d+$ | startswith |
data | ^\d+$ | endswith |
data | ^\d+$ | greaterequals |
data | ^\d+$ | greater |
data | ^\d+$ | less |
data | ^\d+$ | lessequals |
data | ^\d+$ | contains |
data | ^\d+$ | equals |
data | ^\d+$ | notequals |
data | ^\d+$ | notstartswith |
data | ^\d+$ | notendswith |
data | ^\d+$ | notcontains |
data | ^\d+$ | empty |
data | ^\d+$ | notempty |
data | ^\d+$ | intlessequals |
data | ^\d+$ | intgreaterequals |
data | ^\d+$ | intgreater |
data | ^\d+$ | intless |
data | ^\d+$ | intequals |
data | ^\d+$ | intnotequals |
subscriber | ^email$ | startswith |
subscriber | ^email$ | endswith |
subscriber | ^email$ | greaterequals |
subscriber | ^email$ | greater |
subscriber | ^email$ | less |
subscriber | ^email$ | lessequals |
subscriber | ^email$ | contains |
subscriber | ^email$ | equals |
subscriber | ^email$ | notequals |
subscriber | ^email$ | notstartswith |
subscriber | ^email$ | notendswith |
subscriber | ^email$ | notcontains |
subscriber | ^subscriptions$ | has_active_subscription_on |
subscriber | ^subscriptions$ | has_no_active_subscription_on |
subscription | ^activated$ | after |
subscription | ^activated$ | before |
subscription | ^deliveries$ | received |
subscription | ^deliveries$ | not_clicked |
subscription | ^deliveries$ | clicked |
subscription | ^deliveries$ | read_online |
subscription | ^deliveries$ | read |
subscription | ^deliveries$ | not_received |
subscription | ^deliveries$ | not_read |
subscription | ^deliveries$ | not_read_online |
subscription | ^(views|clicks)$ | inactivity_after |
subscription | ^(views|clicks)$ | activity_after |
subscription | ^(views|clicks)$ | activity_before |
subscription | ^(views|clicks)$ | inactivity_before |
Sætte det sammen til et regelsæt
Regelsættet er en liste af JSON objekter (reglerne) og en logisk aktion ‘and’ eller ‘or’:
{"mode": "and", rules:[...]}
Og med ‘or’:
{"mode": "or", rules:[...]}
Et færdigt regelsæt kunne se sådan ud:
{"mode": "and", rules:[{
"type": "subscription",
"data": "views",
"operator": "inactivity_after",
"operand": "2013-01-01 00:00:00"
}, {
"type": "subscriber",
"data": "email",
"operator": "endswith",
"operand": "@hotmail.com"
}]}