FHIR
Create Patient's Consolidated Data
Create Patient's Consolidated Data with a FHIR Bundle.
PUT
/medical/v1/patient/{id}/consolidated
x-api-key*
curl --request PUT \
--url https://api.sandbox.metriport.com/medical/v1/patient/{id}/consolidated \
--header 'x-api-key: <x-api-key>' \
--data '{
"resourceType": "<resourcetype>",
"type": "<type>",
"entry": []
}'
Path Params
idrequired
string
The ID of the Patient.
Body
resourceTyperequired
string
The resource needs to be “Bundle”
typerequired
string
The type needs to be “collection”
entryrequired
array
The entry needs to be an array of FHIR resources.
At the moment there is a limit to how much data you can send in a single request. The content-length must not exceed 1MB.
Response
Returns a Bundle of type “transaction-response” with the entry being the outcome of the query.
import { MetriportMedicalApi } from "@metriport/api-sdk";
const metriport = new MetriportMedicalApi("YOUR_API_KEY");
await metriport.createPatientConsolidated(patientId, {
resourceType: "Bundle",
type: "collection",
entry: [
{
resource: {
resourceType: "Appointment",
status: "booked",
participant: [
{
actor: {
reference: `Patient/${patientId}`,
display: "John Doe",
},
status: "accepted",
period: {
start: "2021-05-24T13:21:28.527Z",
end: "2021-05-24T13:21:28.527Z",
},
},
],
meta: {
versionId: "12345",
lastUpdated: "2023-05-24T13:21:28.527Z",
},
},
},
],
});
{
"resourceType": "Bundle",
"id": "bc0fcad0-6457-4b9e-93b3-44212e386138",
"type": "transaction-response",
"entry": [
{
"response": {
"status": "201 Created",
"location": "Appointment/3/_history/1",
"etag": "1",
"lastModified": "2023-07-27T21:29:31.491+00:00",
"outcome": {
"resourceType": "OperationOutcome",
"issue": [
{
"severity": "information",
"code": "informational",
"details": {
"coding": [
{
"system": "https://public.metriport.com/fhir/StructureDefinition/operation-outcome",
"code": "SUCCESSFUL_CREATE",
"display": "Create succeeded."
}
]
},
"diagnostics": "Successfully created resource \"Appointment/3/_history/1\". Took 7ms."
}
]
}
}
}
]
}
curl --request PUT \
--url https://api.sandbox.metriport.com/medical/v1/patient/{id}/consolidated \
--header 'x-api-key: <x-api-key>' \
--data '{
"resourceType": "<resourcetype>",
"type": "<type>",
"entry": []
}'
import { MetriportMedicalApi } from "@metriport/api-sdk";
const metriport = new MetriportMedicalApi("YOUR_API_KEY");
await metriport.createPatientConsolidated(patientId, {
resourceType: "Bundle",
type: "collection",
entry: [
{
resource: {
resourceType: "Appointment",
status: "booked",
participant: [
{
actor: {
reference: `Patient/${patientId}`,
display: "John Doe",
},
status: "accepted",
period: {
start: "2021-05-24T13:21:28.527Z",
end: "2021-05-24T13:21:28.527Z",
},
},
],
meta: {
versionId: "12345",
lastUpdated: "2023-05-24T13:21:28.527Z",
},
},
},
],
});