Rules
Simulate a draft rule
Dry-run a draft rule (not yet saved) against sample event data. The draft is validated exactly like rule create, then evaluated; nothing is persisted and no ledger changes occur.
post/v1/rules/simulate
Request
- Base URL: https://api.scrip.dev
- URL: https://api.scrip.dev/v1/rules/simulate
- Auth: HTTP bearer
Request body
Response
Simulation result
Example response
{
"evaluation": {
"matched": true,
"reason": "no such key: amount",
"results": [
{
"action": {
"amount": "${{ event.amount * 10 }}",
"asset_id": "a3bb189e-8bf9-4c8b-9be0-6b5d2f4e7a02",
"type": "CREDIT"
},
"result": {
"amount": "750",
"asset_symbol": "POINTS",
"description": "Credit 750 POINTS to participant",
"to_bucket": "AVAILABLE"
}
}
],
"status": "EVALUATED"
},
"rule": {
"condition": "event.type == 'purchase' && event.amount > 0",
"id": "c9f0f895-fb98-4b39-9f86-1e5a0d3e2b03",
"name": "Purchase Reward",
"order": 1
},
"warnings": [
{
"code": "unknown_state_key",
"key": "purchaseCnt",
"kind": "counter",
"message": "unknown counter \"purchaseCnt\" on participant: no rule in this program writes it; did you mean \"purchase_count\"?",
"scope": "participant",
"suggestion": "purchase_count"
}
]
}Changes
No recorded changes to this operation across all 1 revision of this API.