GET /api/v1/rules
Every rule in the register, with its dates, status and source.
curl https://pricedin.xinru-hub.duckdns.org/api/v1/rules
GET /api/v1/rules/{id}
One rule.
curl https://pricedin.xinru-hub.duckdns.org/api/v1/rules/employment-leave-act
POST /api/v1/assess
A business in, a dated assessment out: every rule priced, with the arithmetic, the range, and the budgetable subtotal.
curl -X POST https://pricedin.xinru-hub.duckdns.org/api/v1/assess \
-H 'content-type: application/json' \
-d '{"staff":24,"wageBill":1150000,"casualShare":0.42,
"nearMinimum":9,"longShiftShare":0.2,
"vehicles":3,"petrolVehicles":2,
"fleetKm":42000,"fleetEconomy":8.4}'The contract
- Every figure carries its basis. A number without the arithmetic that produced it is not something you can put in front of a client, so every impact has a
basisstring alongside it. - Ranges are real.
low,midandhighare three different numbers wherever a rate is not set. Rendering onlymidreproduces the mistake this whole thing exists to avoid. - Unpriced is not zero. A rule the profile cannot feed comes back with
unpriced: trueand no figures, excluded from the totals. Treating it as zero would silently understate a client's exposure. - Status is in the payload.
enacted,announcedandannual revieware not interchangeable and the response never flattens them. - A field we do not recognise is refused. The form on this site calls these
wagesandkm; the API calls themwageBillandfleetKm. Posting the short names would otherwise decode to a business with no payroll and no fleet, and come back as a correct assessment of a company that does not exist. So an unknown field is a400that names what this endpoint takes. - Nothing posted here is stored. The assess endpoint holds a request in memory and forgets it.
Running it over a client list
The obvious loop, and the reason the endpoint takes one business rather than many: run it per client, keep certain for the budget conversation and the range for the risk one.
while read -r name staff wages casual; do
printf '%s\t' "$name"
curl -s -X POST https://pricedin.xinru-hub.duckdns.org/api/v1/assess \
-H 'content-type: application/json' \
-d "{\"staff\":$staff,\"wageBill\":$wages,\"casualShare\":$casual}" |
grep -o '"certain": [0-9.]*'
done < clients.tsv