Manual Triggering
It is sometimes desirable to have a Subscription "trigger" for a specific resource. This concept is easiest to explain with an example:
Suppose a REST HOOK subscription Subscription/123
exists with criteria Observation?status=complete
. When an Observation is created with the given status, the subscription will deliver a notification to its intended target. Now suppose you want to manually cause your Observation to be processed a second time (and ultimately re-delivered, assuming it still matches the Subscription criteria) without modifying the Observation.
The $trigger-subscription
operation can be useful in order to cause this subsequent "triggering" to occur.
In order to cause Observation/6
to be triggered for Subscription/123
, the following Parameters resource should be crafted as an operation parameter. Multiple IDs may be specified using multiple parameter repetitions.
{
"resourceType": "Parameters",
"parameter": [
{
"name": "resourceId",
"valueUri": "Observation/6"
}
]
}
Instead of individual resource IDs, a search URL may be used to request a group of resources to be triggered.
{
"resourceType": "Parameters",
"parameter": [
{
"name": "searchUrl",
"valueString": "Observation?date=2018-10-16"
}
]
}
This Parameters resource is then POSTed to the FHIR endpoint via a URL such as the following (the following triggers the resource for the subscription Subscription/123
):
http://localhost:8000/Subscription/123/$trigger-subscription
This Parameters resource may also be POSTed to the Subscription type (instead of an individual Subscription) in order to trigger the resource to all active Subscriptions for which it matches:
http://localhost:8000/Subscription/$trigger-subscription