PI Priced In

API

The register and the models over JSON. No key, no signup. If you are an accounting package, a payroll bureau, or an adviser with a client list, this is the part you want.

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

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