Files
QuoteForge/bible/04-api.md

4.5 KiB

04 — API and Web Routes

API Endpoints

Setup

Method Endpoint Purpose
GET /setup Initial setup page
POST /setup Save connection settings
POST /setup/test Test MariaDB connection
GET /setup/status Setup status

Components

Method Endpoint Purpose
GET /api/components List components (metadata only)
GET /api/components/:lot_name Component by lot_name
GET /api/categories List categories

Quote

Method Endpoint Purpose
POST /api/quote/validate Validate line items
POST /api/quote/calculate Calculate quote (prices from pricelist)
POST /api/quote/price-levels Prices by level (estimate/warehouse/competitor)

Pricelists (read-only)

Method Endpoint Purpose
GET /api/pricelists List pricelists (source, active_only, pagination)
GET /api/pricelists/latest Latest pricelist by source
GET /api/pricelists/:id Pricelist by ID
GET /api/pricelists/:id/items Pricelist line items
GET /api/pricelists/:id/lots Lot names in pricelist

GET /api/pricelists?active_only=true returns only pricelists that have synced items (item_count > 0).

Configurations

Method Endpoint Purpose
GET /api/configs List configurations
POST /api/configs Create configuration
GET /api/configs/:uuid Get configuration
PUT /api/configs/:uuid Update configuration
DELETE /api/configs/:uuid Archive configuration
POST /api/configs/:uuid/refresh-prices Refresh prices from pricelist
POST /api/configs/:uuid/clone Clone configuration
POST /api/configs/:uuid/reactivate Restore archived configuration
POST /api/configs/:uuid/rename Rename configuration
POST /api/configs/preview-article Preview generated article for a configuration
POST /api/configs/:uuid/rollback Roll back to a version
GET /api/configs/:uuid/versions List versions
GET /api/configs/:uuid/versions/:version Get specific version

Projects

Method Endpoint Purpose
GET /api/projects List projects
POST /api/projects Create project
GET /api/projects/:uuid Get project
PUT /api/projects/:uuid Update project
DELETE /api/projects/:uuid Archive project variant (soft-delete via is_active=false; fails if project has no variant set — main projects cannot be deleted this way)
GET /api/projects/:uuid/configs Project configurations

Sync

Method Endpoint Purpose Flow
GET /api/sync/status Overall sync status read-only
GET /api/sync/readiness Preflight status (ready/blocked/unknown) read-only
GET /api/sync/info Data for sync modal read-only
GET /api/sync/users-status Users status read-only
GET /api/sync/pending List pending changes read-only
GET /api/sync/pending/count Count of pending changes read-only
POST /api/sync/push Push pending → MariaDB SQLite → MariaDB
POST /api/sync/components Pull components MariaDB → SQLite
POST /api/sync/pricelists Pull pricelists MariaDB → SQLite
POST /api/sync/all Full sync: push + pull + import bidirectional
POST /api/sync/repair Repair broken entries in pending_changes SQLite

If sync is blocked by the readiness guard: all POST sync methods return 423 Locked with reason_code and reason_text.

Export

Method Endpoint Purpose
POST /api/export/csv Export configuration to CSV

Export filename format: YYYY-MM-DD (ProjectCode) ConfigName Article.csv (uses project.Code, not project.Name)


Web Routes

Route Page
/configs Configuration list
/configurator Configurator
/configs/:uuid/revisions Configuration revision history
/projects Project list
/projects/:uuid Project details
/pricelists Pricelist list
/pricelists/:id Pricelist details
/setup Connection settings

Rollback API (details)

POST /api/configs/:uuid/rollback
Content-Type: application/json

{
  "target_version": 3,
  "note": "optional comment"
}

Response: updated configuration with the new version.