Cyclers

Record a cycler's open service as done

Record service as done on a cycler.

Two paths behind one endpoint, chosen by whether the cycler is currently out of service:

  • Open event (it was taken out first): that event is completed and every channel incident pointing at it is closed in one write, so the cycler cannot end up half returned to service.
  • No open event: the common case of "I calibrated this, log it". A single already-completed event is recorded from the request's event_type. Nothing was taken out, so nothing needs returning, and no one has to open an event purely so it can be closed.

Either way a calibration advances last_calibrated_at — the only supported way that field moves — and optionally updates calibration_interval_days.

Addressed by cycler rather than by event id because a cycler has at most one open event: the caller already knows which cycler it serviced, and looking up the event id first would be a round-trip that proves nothing.

post/cyclers/{cycler_id}/service_events/complete

Path parameters

cycler_idstring required

Request body

object required

Response

Successful Response

idstring required

Unique identifier for the service event

organization_idstring required

Organization this service event belongs to.

project_idstring required

Project that owns the cycler (pinned to it by FK)

cycler_idstring required

The cycler being serviced

event_type'calibration' | 'preventive_maintenance' | 'firmware' | 'repair' | 'other' required

What kind of work took (or will take) a cycler out of service.

Mirrors the cycler_service_events_shape_check CHECK constraint. Stored as CHECK-constrained text rather than a Postgres enum so the allowed set can be widened by swapping a constraint — ALTER TYPE ... ADD VALUE does not compose with the additive-migration rule.

calibration is the one that feeds cyclers.last_calibrated_at: completing an event of this type is what advances the calibration clock.

scheduled_forstring date-time nullable

When the visit is booked. Required while the event is open; null is allowed on an event recorded after the fact.

scheduled_untilstring date-time nullable

When the booked visit is expected to end, making the booking a span rather than a start instant. Null on rows predating the column and on events recorded after the fact. A plan, not a constraint: a visit may legitimately run past it.

performed_atstring date-time nullable

When the service was actually done. Null means the event is still open — at most one such event per cycler.

notesstring nullable

Free-text detail about the service

created_bystring nullable

User who opened or recorded the event

performed_bystring nullable

User who recorded the service as done

created_atstring date-time required

Timestamp when the event row was created

updated_atstring date-time required

Timestamp when the event row was last updated

Changes

No recorded changes to this endpoint across all 1 revision of this API.