Skip to content

Attach a Capability

A capability is the way you say "this room has a whiteboard", "this charger handles CCS2 at 150 kW", or "this desk has a sit stand". The same capability row can attach to many objects, and a single object can carry many capabilities. See Capability for the model.

Two writes:

  1. Create the capability row.
  2. Attach it to a target object.

1. Create the Capability

POST /capability

json
{
  "name": "Whiteboard",
  "description": "A wall mounted whiteboard with markers in the room.",
  "value": { "size": "200x120cm", "markers": true },
  "owner_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}

value is a free form JSON payload. The shape is whatever your consumers expect; the platform does not interpret it.

For a capability that renders to the user, add a render template using Go text/template syntax and an optional locale map for translations.

json
{
  "name": "Whiteboard",
  "value": { "size": "200x120cm" },
  "locale": {
    "name": { "eng": "Whiteboard", "nob": "Tavle" }
  },
  "render": "{{ localize \"name\" }} ({{ path \"size\" }})",
  "owner_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}

The server fills rendered on read from value and locale, ready to display in a UI.

Capture data.id as capability_id.

2. Attach the Capability

POST /capability/{capability_id}/object

json
{
  "object_type": "public.bookable",
  "object_id": "c3d4e5f6-a7b8-9012-cdef-345678901234",
  "owner_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "priority": 0,
  "reason": "Built in fixture"
}

Attach the same capability to a Bookable Type instead to give every bookable of that type the capability automatically.

object_type accepts the standard schema qualified types listed on the Capability concept page.

Reading Capabilities Off a Bookable

GET /bookable/{id}/capability returns both the capabilities attached directly to the bookable and those attached to its type, merged into one list. That is what a frontend renders next to the room name.

Updating

PUT /capability/{id} and PATCH /capability/{id} modify the capability row. Every object the capability is attached to picks up the change on the next read, so updating "Whiteboard" once updates the rendered label on every room that carries it.