Skip to main content

Additional Options

Custom Headers

If you need to customize the headers that are used in the requests, you can specify them as an additional argument to all API calls.

const myHeaders = { "X-Custom-Header": "abc" };
const patient: Resources.Patient = await plasma.readPatient(patientId, myHeaders);

Or, if you want to apply a set of headers to all requests, you can use this workaround:

plasma.restClient.defaultHeaders = { "X-Custom-Header": "abc" };

Non-OOP Function Calls

It is recommended to use the Plasma FHIR Client in an Object Oriented fashion, but it is not strictly required. If you'd like, you can specify the location of the FHIR server and your authentication info along with every API call. This could be useful in environments where you cannot persist objects.

const fhirUrl = "http://.../fhir/r4";
const authHeader = "Bearer 123123123";
const plasma = new PlasmaFHIRClient("", "", "");
const patient: Resources.Patient = await plasma.readPatient(patientId, {}, fhirUrl, authHeader);