Skip to content

FiberPath API Reference

The FastAPI service in fiberpath_api/ exposes thin wrappers around the core planning, simulation, validation, and streaming engines. All endpoints accept and return JSON and are designed for headless automation (GUI/HMI integrations, CI pipelines, etc.).

Planning

POST /plan/from-file

Request body:

{"path": "/absolute/path/to/input.wind"}

Response body (fields abbreviated):

{
  "commands": 1234,
  "output": "/absolute/path/to/input.gcode",
  "timeSeconds": 42.5,
  "towMeters": 8.1,
  "layers": [
    {
      "index": 1,
      "wind_type": "helical",
      "commands": 456,
      "time_s": 12.3,
      "tow_m": 1.9
    }
  ]
}

Simulation

POST /simulate/from-file

Request:

{"path": "/absolute/path/to/output.gcode"}

Response:

{
  "commands": 789,
  "moves": 300,
  "estimated_time_s": 95.2,
  "total_distance_mm": 1234.5,
  "tow_length_mm": 1234.5,
  "average_feed_rate_mmpm": 7200.0
}

Validation

POST /validate/from-file

Request:

{"path": "/absolute/path/to/input.wind"}

Response:

{"status": "ok", "path": "/absolute/path/to/input.wind"}

Streaming

POST /stream/

Request:

{
  "gcode": "; Parameters ...\nG0 X0 Y0\n",
  "port": "COM5",
  "baud_rate": 250000,
  "dry_run": true
}

Response:

{
  "commands_streamed": 100,
  "total_commands": 100,
  "dry_run": true
}

All endpoints return non-2xx responses (400/404/502) with a {"detail": "..."} payload when validation fails or the underlying engine reports an error. Use FastAPI's autogenerated docs at /docs for interactive exploration.