API

How Flexpress uses WowCalculator once Steve approves the calculations.
OpenAPI description

Two ways in

  1. Call the API. Flexpress posts a job and gets back the cost, the price and the profit. Nothing else changes in Flexpress.
  2. Use the engine directly. WowCalculator.Engine is a plain class library with no database or web dependencies. Flexpress can reference it and call JobCalculator.Calculate(...) itself, loading the same settings.

Endpoints

CallWhat it does
GET /api/v1/healthIs it up.
GET /api/v1/productsProducts and formats WowCalculator knows (Flexpress ids).
GET /api/v1/products/{id}One product: its choices, route and a default job to start from.
POST /api/v1/calculateCost, price and profit for a job. 422 with errors when it can't be made.
POST /api/v1/calculate/ladderThe same job at several quantities: { "job": {…}, "quantities": [100, 250, 500] }.
POST /api/v1/syncSync from Flexpress now (for example right after a product is saved in Flexpress).
When Api:Key is set in appsettings, every call must send it as the X-Api-Key header.

A job, in Flexpress's terms

Every id is Flexpress's own: product, format, paper category (material), lamination and foil colour. A basket item maps across field by field.

POST /api/v1/calculate
{
  "productId": 7,
  "formatId": 56,
  "quantity": 500,
  "inner": {
    "paperCategoryId": 10,
    "colours": 4,
    "sides": 2,
    "laminationId": 2,
    "laminationSides": 2
  },
  "turnaround": "Standard"
}

200 OK
{
  "productName": "Regular Business Cards",
  "totalItems": 500,
  "cost": { "materialCost": 22.91, "labourCost": 55.73, "fullCost": 78.64, "materials": [ … ], "times": [ … ], "parts": [ … ] },
  "price": { "marginPercent": 64, "price": 65.00, "profitAfterMaterialPercent": 64.8, "light": "Green", "steps": [ … ] }
}

From a Flexpress basket item

Job fieldFlexpress ShoppingCartItem / OrderItem
productId, formatIdProductId, ProductFormatId
landscapeOrientation == "Landscape"
quantity, versions, pages, fileCopiesQuantity, Versions, Pages, FileCopies
inner.paperCategoryId / cover.paperCategoryIdthe inner and cover paper category
inner.colours, inner.sidesprinting option (4 or 1) and sides (1 or 2)
laminationId, laminationSides; spotUvCoverage, spotUvSides; foilCoverage, foilColourId, foilSidesthe part's finishing choices
optionsthe chosen add-ons: option code to selection name
turnaround"Saver", "Standard" or "Express"
pdfProofProofing == "PDF Proof Required"
An unhandled error has occurred. Reload 🗙

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.