BioT Interceptor Plugins

BioT Interceptor plugins are lambda code that is called before or after an API call and lets the plugin modify the call request or response accordingly. The plugins are useful when you want to modify an API request before it is processed by BioT or modify the response before it arrives to the UI.

Flow Example

720

Subscribing to Events

To subscribe to an API, call the subscribe API of the service:
POST https://your-biot-domain.com/dispatcher/v1/hooks/interceptions/subscribe

ParameterDescriptionFormat
typeThe type of interception. Meaning pre, post or entity interception.Values:PRE_REQUEST,POST_REQUEST,ADAPT_ENTITY
apiIdThe API to intercept. The signature of the API made of the request type and URL signature.Example: PATCH/organization/v1/users/patients/{id}
entityNameShould be provided only in ADAPT_ENTITY mode.usage-session
generic-entity
caregiver
patient
organization-user
organization
device
command
device-alert
patient-alert
endpointA valid URI for the platform to call when the event is triggered.
Mandatory.
https://my-web-hook.com
executionOrderOptional parameter to determine the plugin execution order if multiple interceptors exists for the same API

Interceptor Plugin Deployment

For detailed instructions on how to deploy an interceptor plugin click here.

Blocking a Requests/Responses

Interceptor plugins can also block the normal flow of a request or response.
To modify the response, instead of returning a success code (2XX) in the HTTP response, return a client error code (4XX) or server error code (5XX) along with the following response structure:

{
  "code": "ENTITY_NOT_FOUND",
  "message": "Entity with id [c36cca98-29b1-41a7-90a7-91d2540c4e2d] not found",
  "serviceName": "XYZ Plugin",
  "traceId": "a07a7e532f3541d8",
  "environment": "develop",
  "details": {
    "additionalProp1": {},
    "additionalProp2": {},
    "additionalProp3": {}
  }
}

BioT will intercept the response. If the response code doesn't belong to the 2XX family (indicating success), BioT will halt the normal flow and replace the response with the interceptor's response.