Add Cantaloupe Sync API documentation

2026-05-21 19:20:03 -04:00
parent 241f46b6d6
commit fe59b0df93
+19 -1
@@ -21,7 +21,25 @@ NPMPlus proxy updated: forward_port 8901 → 8090, forward_scheme https → http
## Endpoints
See the [[Home]] page for full endpoint documentation.
All standard admin CRUD endpoints for users, customers, locations, rooms, geofences, settings, activity log, stats, CSV exports, and database management.
### Cantaloupe Sync API (since f7ffa0e)
Staged import pipeline for Cantaloupe machine data:
| Method | Path | Description |
|--------|------|-------------|
| POST | `/api/admin/cantaloupe/sync` | Upload Excel, parse, diff, store as pending batch |
| GET | `/api/admin/cantaloupe/batches` | List all sync batches (filterable by status) |
| GET | `/api/admin/cantaloupe/batches/{id}` | Full batch detail with row-level diff |
| POST | `/api/admin/cantaloupe/batches/{id}/approve` | Apply staged data (upsert assets/customers/locations) |
| POST | `/api/admin/cantaloupe/batches/{id}/reject` | Discard batch, clear raw_data |
**Database table:** `cantaloupe_sync_batches` — id, status (pending/approved/rejected/error), created_at, approved_at, file_path, row_count, diff_summary (JSON), raw_data (JSON), error_message.
**Column mapping:** Heuristic word-subset matching of Excel headers to canteen schema fields (machine_id, serial_number, name, customer, location, address, etc.)
**Tests:** 10 unit tests (test_cantaloupe_sync.py) + 23 integration tests (test_sync_api.py). All 33 pass.
## Related