Aidbox subscriptions module is a way to subscribe and get notifications about updating resources on server. It introduces two new resourceTypes into Aidbox:
SubsSubscription — meta-resource, which binds events (create/update/delete resource) with communication channel through which subscriber will be notified about.
SubsNotification — resource, which represents notification with its status (sent or not).
In order to start receive notifications, you have to register your services as a subscriber in Aidbox by creating SubsSubscription resource.
As external service to integrate Aidbox with we will you RequestCatcher. We will use aidbox name, so the final name of our service will be https://aidbox.requestcatcher.com/. You can use your own name, doesn't matter.
Open https://aidbox.requestcatcher.com/ in new tab, then create next SubsSubsription resource in your Aidbox instance:
POST /SubsSubscriptionid: new-patient-substatus: activetrigger:Patient:event: ['create']channel:type: rest-hookendpoint: https://aidbox.requestcatcher.com/new-patienttimeout: 1000payload:content: full-resourcecontentType: json
After you did it aidbox sends on channel.endpoint handshake notification, which you can see on your opened tab with RequestCatcher.
Let's create new patient then.
POST /Patientid: john-smithname:- given: [John]family: Smith# Response: 201 Created
Then you can back to RequestCatcher service and see new notification.
And next, you can see SubsNotification resource created for this notification in Aidbox.
GET /SubsNotification?_sort=-lastUpdated# Responsetype: searchsetresourceType: Bundleentry:- resource:id: 17efebc5-c4e2-4db8-b999-dd5c24b7dfc5resourceType: SubsNotificationstatus: successduration: 99response: {body: request caught, status: 200}notification:type: notificationevent: createresource:id: john-smithname:- given: [John]family: SmithresourceType: Patientsubscription: {id: new-patient-sub, resourceType: SubsSubscription}# ... other notification
If you will update your patient, then notification will not be created, because we subscribed only for creation of Patient resource.
PUT /Patient/john-smithname:- given: [John]family: Smithgender: male# Response: 200 OK
Check RequestCatcher and SubsNotification. You will not find new notification there.