POST reverse_allocation¶
Reverse an Active Allocation Run. Creates a reversal run and cancels the original.
Endpoint¶
POST /api/method/konsol.api.reverse_allocation
Authentication: Required (Frappe session cookie)
Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
name |
string | Yes | Document name of the Allocation Run to reverse |
What Happens¶
- Validates the run is in "Active" status
- Creates a new Allocation Run with
reversal_ofpointing to the original - Submits the reversal (becomes Active, synced to ClickHouse)
- Cancels the original (status set to "Reversed", synced to ClickHouse)
Response¶
{
"message": {
"original": "ARUN-2025-P6-0001",
"reversal": "ARUN-2025-P6-0002",
"status": "Reversed"
}
}
Example¶
curl -X POST http://localhost:8069/api/method/konsol.api.reverse_allocation \
-H "Content-Type: application/json" \
-b "cookies.txt" \
-d '{"name": "ARUN-2025-P6-0001"}'
Error Responses¶
Wrong status¶
{
"exc_type": "ValidationError",
"_server_messages": "[\"Cannot reverse: current status is 'Reversed', expected 'Active'\"]"
}
dbt Impact¶
After reversal:
- Original run:
status = 'Reversed'— excluded fromgold_allocation_results - Reversal run:
status = 'Active'— included ingold_allocation_results - Both appear in
gold_allocation_audit_trailfor full traceability
See also: run_allocation, allocation_history