Skip to content

Application Platform

Applications add HTTP endpoints to the server. An App resource describes the application and its backend. A CustomOperation resource describes one endpoint. The gateway routes requests that match no built-in route to these operations.

App and CustomOperation are internal resources, served at the root rather than under /fhir.

POST /App
Authorization: Bearer {admin token}
Content-Type: application/json
{
"resourceType": "App",
"name": "Patient portal",
"status": "active",
"secret": "change-me",
"endpoint": {
"url": "https://portal.example.org/octofhir",
"timeout": 30
},
"operations": [
{
"id": "summary",
"method": "GET",
"path": ["portal", "summary", ":id"],
"type": "app"
}
]
}
Field Meaning
name Required
status active, inactive or suspended
secret Required, stored as a hash
endpoint The backend: url, and timeout in seconds
operations Inline operations
subscriptions Event subscriptions, see below
resources Resources to provision, as a JSON string

status decides whether an App is active. The inline operations of an App that is not active are not routed.

Creating or updating an App reconciles what is derived from it: CustomOperation resources from operations, AppSubscription resources from subscriptions, and the provisioned resources.

A standalone operation:

POST /CustomOperation
Authorization: Bearer {admin token}
Content-Type: application/json
{
"resourceType": "CustomOperation",
"app": {"reference": "App/portal"},
"path": "/portal/patient-count",
"method": "GET",
"type": "sql",
"sql": "SELECT count(*) FROM patient",
"active": true
}

path is absolute. A segment starting with : matches any value, as in /users/:id. A standalone operation has its own active field.

Paths may not collide with another App’s operations, and may not use the prefixes /fhir, /oauth, /admin, /api, /ui, /healthz, /readyz, /metrics, /$graphql, or the internal resource paths such as /User and /App.

Type What it does Configuration
proxy Forwards the request to a URL proxy.url, proxy.timeout, proxy.headers
sql Runs a read-only SELECT and returns rows as JSON sql
fhirpath Evaluates an expression against the request body fhirpath
handler Calls a Rust handler registered in the server’s HandlerRegistry handler
app Posts a structured request to the App’s endpoint includeRawBody
websocket Proxies a WebSocket to a backend, for inline operations websocket.url, websocket.subprotocols, websocket.forwardAuthInQuery

Inline operations in App.operations use app by default. The server registers no handler of its own.

The gateway posts JSON to the App’s endpoint, with operationId, operationPath, method, auth, pathParams, queryParams and body. The backend answers with status, body, and optionally headers and fhirWrapper, or with a plain response, which is passed through.

An operation with "public": true needs no authentication. Any other operation needs one. policy narrows it further:

Field Meaning
authType forward (default): the OAuth token. app: the App’s secret in X-App-Secret
roles Required roles
scopes Required OAuth scopes
compartment patient or practitioner
script A policy script

App.subscriptions become AppSubscription resources. Each has a trigger: a resourceType, an event (create, update or delete) and an optional fhirpath that has to give true. A change that matches goes to its channel, its notification, or both:

{
"id": "new-results",
"trigger": {"resourceType": "Observation", "event": "create", "fhirpath": "status = 'final'"},
"channel": {"type": "webhook", "endpoint": "https://portal.example.org/events"},
"notification": {
"provider": "NotificationProvider/mail",
"channel": ["email"],
"template": "result-ready",
"recipient": {"fhirpath": "subject"},
"delay": {"relativeTo": "issued", "offset": "PT1H"}
}
}
Part What happens
channel POST to endpoint with subscription, event and resource, through the outbound policy
notification A notification is queued per channel, with the resource’s simple elements as template data
recipient.fhirpath Text (an email or URL), a ContactPoint, or a Reference whose telecom holds the address
delay Sends at the date relativeTo gives, moved by the ISO 8601 offset (-PT24H is a day before)

A delete is matched against the resource as it was. For FHIR topic-based subscriptions, see Subscriptions.