While FHIR topic-based subscriptions are functional, they will no longer receive active development or new features. For enhanced capabilities and ongoing support, please use Aidbox topic-based subscriptions. This newer implementation offers improved performance, flexibility, and will continue to be developed to meet future needs.

Create Subscription - POST /fhir/Subscription

Creates a new subscription. Takes params depending on the current version of FHIR used in Aidbox.

The R4B Subscriptions resource uses FHIR extension fields that should be written according to the specification .
You should also add the subscription backport profile URL to your resource's meta.profile field.

Parameters

ParameterTypeRequiredDescription
metaobjectfalse
meta.profilestring[]trueExtension URL:
http://hl7.org/fhir/uv/subscriptions-backport/StructureDefinition/backport-subscription
idstringfalseIdentifier of the resource. Will be auto-generated if not provided.
reasonstringfalseHuman readable reason for subscription.
criteriastringtrue

Canonical URL for the topic used to generate events.


Example: http://aidbox.app/SubscriptionTopic/patient-test-1

criteria.extension:

filterCriteria

string[]false

The filters applied to events in the following format:


[resourceType.]filterParameter=[modifier]value

filterParameter above should be one of the filter names defined by the relevant SubscriptionTopic

(canFilterBy.filterParameter field).

resourceType and modifiers should be the ones allowed in the corresponding canFilterBy.filterParameter of the relevant SubscriptionTopic as well.

resourceType is only necessary for disambiguation.

When multiple filters are applied, it evaluates to true if all the conditions applicable to that resource are met; otherwise, it returns false (i.e., logical AND).


Example: patient-birth=gt2005-01-01T01:00:00Z

channel.extension:

heartbeatPeriod

integerfalse

Interval in seconds to send 'heartbeat' notification.


Default value: 120

channel.extension:

timeout

integerfalse

Timeout in seconds to attempt notification delivery.


Default value: 30

channel.extension:

maxCount

integerfalse

Maximum number of triggering resources included in notification bundles.


Default value: 10

channel.typestringtrueThe type of channel to send notifications on.

Supported values: rest-hook
channel.headerstring[]false

Additional headers/information to send as part of the notification. For the rest-hook channel type, this will be HTTP request headers.


Example: ["random-header: secret123"]

channel.endpointstringfalse

The URL that describes the actual end-point to send messages to.


Example: https://my.app/endpoint

channel.payloadstringfalseMIME-type to send, or omit for no payload.

Supported values: application/fhir+json

channel.payload.extension:

content

stringfalse

Notification content level.


Supported values: empty, id-only, full-resource.

Default value: empty

statusstringfalse

Status of the subscription.

On the creation of this resource, the status is always requested and other values will be ignored.

endstringfalseWhen to automatically delete the subscription.

Example

POST /fhir/Subscription
content-type: text/yaml
accept: text/yaml

meta:
  profile:
  - http://hl7.org/fhir/uv/subscriptions-backport/StructureDefinition/backport-subscription
criteria: http://aidbox.app/SubscriptionTopic/patient-test-1
channel:
  extension:
  - url: http://hl7.org/fhir/uv/subscriptions-backport/StructureDefinition/backport-heartbeat-period
    valueUnsignedInt: 60
  - url: http://hl7.org/fhir/uv/subscriptions-backport/StructureDefinition/backport-timeout
    valueUnsignedInt: 1
  - url: http://hl7.org/fhir/uv/subscriptions-backport/StructureDefinition/backport-max-count
    valuePositiveInt: 2
  type: rest-hook
  endpoint: http://localhost:27193/patient-test-1
  payload: application/fhir+json
  _payload:
    extension:
    - url: http://hl7.org/fhir/uv/subscriptions-backport/StructureDefinition/backport-payload-content
      valueCode: id-only
resourceType: Subscription
reason: R4/B Test Topic-Based Subscription for Patient resources
status: active
id: subscription-patient-test-1
end: '2020-12-31T12:00:00Z'

Subscription Status - GET /fhir/Subscription/[id]/$status

This operation is used to get the current status information about a topic-based Subscription.

Returns FHIR bundle where the SubscriptionStatus resource is the only entry element.

Example

GET /fhir/Subscription/subscription-patient-test-1/$status
content-type: text/yaml
accept: text/yaml

Subscription Events - GET /fhir/Subscription/[id]/$events

This operation is used to search for and get notifications that have been previously triggered by a topic-based Subscription.

Returns FHIR bundle where the SubscriptionStatus resource is the first entry element, and triggered events are the rest.

Parameters

ParameterTyperequiredDescription
eventsSinceNumberintegerfalseThe starting event number, inclusive of this event (lower bound).
eventsUntilNumberintegerfalseThe ending event number, inclusive of this event (upper bound).

If the params above are not provided, returns the latest 20 events.

Example

GET /fhir/Subscription/subscription-patient-test-1/$events
content-type: text/yaml
accept: text/yaml

Subscription and events RPC

Returns all data about subscription and its events.

RPC endpoint: fhir.topic-based-subscription/get-subscription-by-id

Parameters

ParameterTypeDescription
idstringid of subscription
events-limitintLimit of events to fetch. Default is 10.

Example

POST /rpc

method: fhir.topic-based-subscription/get-subscription-by-id
params:
  id: subscription-patient-test-1

Delete Subscription - DELETE /fhir/Subscription/[id]

Delete Subscription resource.

ParameterTypeDescription
resourceobjectDeleted Subscription resource.

Example

DELETE /fhir/Subscription/subscription-patient-test-1