API Reference - Migz93/3dq GitHub Wiki

API Reference

3DQ provides a RESTful API that powers the frontend and can also be used for integrations with other systems. This reference documents the available endpoints.

Base URL

All API endpoints are relative to your 3DQ instance URL:

http://your-server:6123/api

Authentication

Currently, the API does not require authentication. It is designed to be used within a trusted network environment.

Settings Endpoints

Get All Settings

GET /api/settings

Returns all application settings as key-value pairs.

Update a Setting

PUT /api/settings/:key

Updates a specific setting.

Request Body:

{
  "value": "new-value"
}

Get Next Quote Number

GET /api/settings/quote/next-number

Returns the next available quote number.

Filament Endpoints

Get All Filaments

GET /api/filaments

Returns all filaments in the database.

Get Active Filaments

GET /api/filaments/active

Returns only active (non-archived) filaments.

Get a Single Filament

GET /api/filaments/:id

Returns a specific filament by ID.

Create a Filament

POST /api/filaments

Creates a new filament.

Request Body:

{
  "name": "Prusament PLA Galaxy Black",
  "type": "PLA",
  "diameter": 1.75,
  "spool_weight": 1000,
  "spool_price": 29.99,
  "density": 1.24,
  "color": "#000000",
  "link": "https://prusament.com/galaxy-black"
}

Update a Filament

PUT /api/filaments/:id

Updates an existing filament.

Delete a Filament

DELETE /api/filaments/:id

Deletes a filament if it's not used in any quotes.

Toggle Filament Status

PATCH /api/filaments/:id/toggle-status

Archives or unarchives a filament.

Printer Endpoints

Get All Printers

GET /api/printers

Returns all printers in the database.

Get Active Printers

GET /api/printers/active

Returns only active (non-archived) printers.

Get a Single Printer

GET /api/printers/:id

Returns a specific printer by ID.

Create a Printer

POST /api/printers

Creates a new printer.

Request Body:

{
  "name": "Bambu Lab X1 Carbon",
  "material_diameter": 1.75,
  "price": 1199,
  "depreciation_time": 8000,
  "service_cost": 200,
  "power_usage": 100
}

Update a Printer

PUT /api/printers/:id

Updates an existing printer.

Delete a Printer

DELETE /api/printers/:id

Deletes a printer if it's not used in any quotes.

Toggle Printer Status

PATCH /api/printers/:id/toggle-status

Archives or unarchives a printer.

Hardware Endpoints

Get All Hardware Items

GET /api/hardware

Returns all hardware items in the database.

Get Active Hardware Items

GET /api/hardware/active

Returns only active (non-archived) hardware items.

Get a Single Hardware Item

GET /api/hardware/:id

Returns a specific hardware item by ID.

Create a Hardware Item

POST /api/hardware

Creates a new hardware item.

Request Body:

{
  "name": "M3x10mm Socket Head Screw",
  "unit_price": 0.15,
  "link": "https://example.com/screws"
}

Update a Hardware Item

PUT /api/hardware/:id

Updates an existing hardware item.

Delete a Hardware Item

DELETE /api/hardware/:id

Deletes a hardware item if it's not used in any quotes.

Toggle Hardware Status

PATCH /api/hardware/:id/toggle-status

Archives or unarchives a hardware item.

Quote Endpoints

Get All Quotes

GET /api/quotes

Returns all quotes in the database.

Get a Single Quote

GET /api/quotes/:id

Returns a specific quote by ID, including all related data (filaments, hardware, print setup, labor).

Create a Quote

POST /api/quotes

Creates a new quote.

Request Body:

{
  "title": "Tardis Lightbox",
  "customer_name": "John Smith",
  "date": "2023-06-01",
  "notes": "Blue filament preferred",
  "markup_percent": 50,
  "discount_percent": 0,
  "quantity": 1,
  "is_quick_quote": false
}

Update a Quote

PUT /api/quotes/:id

Updates an existing quote.

Delete a Quote

DELETE /api/quotes/:id

Deletes a quote and all associated data.

Generate an Invoice

GET /api/quotes/:id/invoice/:type

Generates an HTML invoice for a quote. The :type parameter can be either client or internal.

Spoolman Integration Endpoints

Get Spoolman Status

GET /api/spoolman/status

Returns the current status of the Spoolman integration.

Test Spoolman Connection

POST /api/spoolman/test-connection

Tests the connection to the configured Spoolman instance.

Request Body:

{
  "url": "http://spoolman.local:7912"
}

Sync Filaments from Spoolman

POST /api/spoolman/sync

Synchronizes filament data from Spoolman to 3DQ.

Response Format

All API responses follow a standard format:

Success Response

{
  "success": true,
  "data": { ... }
}

Error Response

{
  "success": false,
  "error": "Error message"
}

Error Codes

Standard HTTP status codes are used:

  • 200: Success
  • 400: Bad Request
  • 404: Not Found
  • 500: Server Error
⚠️ **GitHub.com Fallback** ⚠️