Zum Inhalt springen

Accept a Spoolman spool event and print its label

POST
/api/v1/webhook/spoolman
curl --request POST \
--url https://example.com/api/v1/webhook/spoolman \
--header 'Content-Type: application/json' \
--header 'X-API-Key: example' \
--data '{ "quantity": 1, "spool_id": "example", "type": "example" }'

Receives a Spoolman webhook event for a spool update and prints the spool label through the print queue, like POST /api/v1/print. Requires the X-API-Key header — returns 503 when the key is not configured, 401 when the key is wrong, 422 when required payload fields are missing and 429 above the per-key rate limit. Printer and lookup errors (no tape, printer disabled or offline, integration failed) are answered as by POST /api/v1/print (409/422/502/503); an unknown spool or product answers 404 app-lookup-not-found and an integration that is not configured 503 integration_not_configured (both in the problem-detail body shape). Nothing is queued. On success returns 202 with the new job’s UUID; the queue worker prints it. One label is printed; quantity is accepted but not printed.

X-API-Key
required
X-Api-Key
string
Media typeapplication/json
SpoolmanWebhookPayload

Event payload emitted by Spoolman when a spool is updated.

object
quantity
Quantity

Optional remaining filament in grams. Accepted, not printed yet (see #284)

Any of:
number
spool_id
required
Spool Id

Spoolman spool identifier (as a string to accept both int and str JSON input)

string
type
required
Type

Event type string (e.g. ‘updated’, ‘created’, ‘consumed’)

string

Example generated

{
"quantity": 1,
"spool_id": "example",
"type": "example"
}

Successful Response

Media typeapplication/json
WebhookAcceptedResponse

202 Accepted response body for both webhook endpoints.

object
job_id
required
Job Id

UUID of the new print job. Webhook jobs have no owner: an admin or SSO caller can follow it under GET /api/v1/jobs/{job_id}

string format: uuid

Example generated

{
"job_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"
}

Validation Error

Media typeapplication/json
object
detail
required
object
error_code
required
string
error_detail
Any of:
object
key
additional properties
any
error_message
required
string

Example generated

{
"detail": {
"error_code": "example",
"error_detail": {},
"error_message": "example"
}
}