100 lines
3.6 KiB
Markdown
100 lines
3.6 KiB
Markdown
# API Endpoints
|
|
|
|
## Web Pages
|
|
|
|
| Method | URL | Handler | Description |
|
|
|--------|-----|---------|-------------|
|
|
| GET | `/` | Index | Redirect → `/admin/pricing` |
|
|
| GET | `/admin/pricing` | AdminPricing | Pricing admin (Estimate / Warehouse / Alerts tabs) |
|
|
| GET | `/lot` | Lot | LOT management (LOT / Mappings tabs) |
|
|
| GET | `/pricelists` | Pricelists | Pricelist listing |
|
|
| GET | `/pricelists/:id` | PricelistDetail | Single pricelist view |
|
|
| GET | `/vendor-mappings` | VendorMappings | Vendor mapping UI |
|
|
| GET | `/partials/components` | ComponentsPartial | Components partial |
|
|
| GET/POST | `/setup` | Setup | DB connection setup |
|
|
|
|
---
|
|
|
|
## System
|
|
|
|
| Method | URL | Description |
|
|
|--------|-----|-------------|
|
|
| GET | `/health` | Health check |
|
|
| GET | `/api/ping` | Ping |
|
|
| GET | `/api/db-status` | DB connection status (optional counts) |
|
|
| GET | `/api/current-user` | Current DB user info |
|
|
| POST | `/api/restart` | Graceful process restart |
|
|
| GET/POST | `/api/connection-settings` | DB config UI |
|
|
|
|
---
|
|
|
|
## Components
|
|
|
|
| Method | URL | Description |
|
|
|--------|-----|-------------|
|
|
| GET | `/api/components` | Component list with search/filter |
|
|
| GET | `/api/components/:lot_name` | Component details |
|
|
| GET | `/api/categories` | Category list |
|
|
|
|
---
|
|
|
|
## Pricelists
|
|
|
|
| Method | URL | Description |
|
|
|--------|-----|-------------|
|
|
| GET | `/api/pricelists` | List all pricelists |
|
|
| POST | `/api/pricelists` | Create pricelist (returns task_id) |
|
|
| GET | `/api/pricelists/:id` | Pricelist details |
|
|
| DELETE | `/api/pricelists/:id` | Delete pricelist |
|
|
| GET | `/api/pricelists/:id/items` | Pricelist items |
|
|
| GET | `/api/pricelists/:id/export-csv` | CSV export (streaming) |
|
|
| GET | `/api/pricelists/latest` | Latest pricelist per source |
|
|
|
|
---
|
|
|
|
## Pricing Admin (`/api/admin/pricing/*`)
|
|
|
|
| Method | URL | Description |
|
|
|--------|-----|-------------|
|
|
| GET | `/api/admin/pricing/stats` | Statistics |
|
|
| GET | `/api/admin/pricing/components` | Components with pricing |
|
|
| POST | `/api/admin/pricing/recalculate-all` | Recalculate all prices (returns task_id) |
|
|
| GET | `/api/admin/pricing/lots` | LOT list |
|
|
| GET/POST | `/api/admin/pricing/stock-mappings` | Stock partnumber mappings |
|
|
| GET/POST/DELETE | `/api/admin/pricing/vendor-mappings` | Vendor partnumber mappings (DELETE removes mapping and seen-row from global list) |
|
|
| POST | `/api/admin/pricing/vendor-mappings/import-csv` | Import vendor mappings from CSV (`;`, UTF-8/BOM, columns: vendor;partnumber;lot_name;description;ignore; if ignore is set and lot_name empty → mark ignored) |
|
|
| GET | `/api/admin/pricing/vendor-mappings/export-unmapped-csv` | Export CSV template of unmapped vendor partnumbers for user filling (`vendor;partnumber;lot_name;description;ignore`) |
|
|
| GET | `/api/admin/pricing/alerts` | Alerts list |
|
|
| GET | `/api/admin/pricing/scheduler-runs` | Embedded scheduler job state (`qt_scheduler_runs`) |
|
|
| GET | `/api/admin/pricing/partnumber-books` | List all partnumber book snapshots with item counts |
|
|
| POST | `/api/admin/pricing/partnumber-books` | Create partnumber book snapshot (returns task_id) |
|
|
|
|
---
|
|
|
|
## Tasks (polling)
|
|
|
|
| Method | URL | Description |
|
|
|--------|-----|-------------|
|
|
| GET | `/api/tasks/:id` | Task status and result |
|
|
|
|
---
|
|
|
|
## Sync (diagnostics)
|
|
|
|
| Method | URL | Description |
|
|
|--------|-----|-------------|
|
|
| GET | `/api/sync/status` | Sync status |
|
|
| GET | `/api/sync/info` | Sync info |
|
|
| POST | `/api/sync/components` | Pull components |
|
|
| POST | `/api/sync/pricelists` | Pull pricelists |
|
|
|
|
---
|
|
|
|
## Setup
|
|
|
|
| Method | URL | Description |
|
|
|--------|-----|-------------|
|
|
| GET/POST | `/setup` | DB setup page |
|
|
| POST | `/setup/test` | Test DB connection |
|
|
| GET | `/setup/status` | Setup status |
|