Upsert a work session
Insert the work session, or update it when a row with a conflicting unique key already exists. update is required and lists which columns to overwrite on conflict.
Authorizations
Organization-scoped API key. Create one in the BuildingSwell app under Organization settings, API keys.
Path Parameters
Record id.
Query Parameters
Columns to overwrite when the row already exists. Repeat the parameter for each column: a single comma-separated value is read as one column name and fails at the database. Without the parameter the request is rejected with 400.
Body
Leave shiftWorkHours out and BuildingSwell fills it from the person's shop shift for startDate, stamping the shop timezone onto it. Leave metadata.costCode out and it is resolved from the deliverable, then its station, then its ancestors, then the project, then the route; if none of those carry one, the key is left off entirely.
One person can hold only one open session per deliverable. A second attempt comes back as 409.
Deliverable the time was logged against.
Person who did the work.
Department the session belongs to.
When the session started, in UTC.
Unique id. Generated on create unless you supply one.
When the session ended, in UTC. null means it is still open.
true when someone has edited the session by hand.
Who last changed the session.
The shift the record was worked against. Break times are local wall-clock, not UTC.
System the session came from, for example quickbase.
Sync state for the external system.
"synced"
Free-form key-value store. No key is guaranteed to be present, and a missing key is not the same as a null one. See the resource guide for which paths populate costCode and unionCode.
When the record was created.
When the record last changed.
Response
The upserted work session.
Time one person logged against one deliverable. An open session has no endDate.