More Info
Software Development Kit
How to access the Medical API using our SDK
We’ve developed an SDK to help you get access to our API without the HTTP plumbing. It’s currently only available for Node-based applications (let us know what other languages you’d like to see it available on).
The SDK is available as an NPM package and you can access it here.
To install:
npm install --save @metriport/api-sdk
Initialize it like so:
import { MetriportMedicalApi } from "@metriport/api-sdk";
const metriportClient = new MetriportMedicalApi("YOUR_API_KEY");
Some examples of usage, once the API client is initialized:
// Create a Facility
const patient = await metriportClient.createFacility({
// facility data
});
// Get a Patient
const patient = await metriportClient.getPatient(patientId);
// List the given Patient's available documents/records
const documents = await metriportClient.listDocuments(patientId, facilityId);
The operations available follow the API specification, with this pattern:
GET /
endpoints are exposed aslist<EntityNameInPlural>()
GET /:id
endpoints are exposed asget<EntityName>()
POST /
endpoints are exposed ascreate<EntityName>()
PUT /:id
endpoints are exposed asupdate<EntityName>()
DELETE /:id
endpoints are exposed asremove<EntityName>()
The client source code contain only the exposed operations and is available here.