Getting Started
API Reference
- Facility
- Patient
- Document
- FHIR
- Network
- Settings
Handling Data
FHIR
- FHIR Overview
- Data Types
- Resources
- Extensions
FHIR
Create Patient's Consolidated Data
Create Patient’s Consolidated Data with a FHIR Bundle.
PUT
/
medical
/
v1
/
patient
/
{id}
/
consolidated
Copy
Ask AI
curl --request PUT \
--url https://api.sandbox.metriport.com/medical/v1/patient/{id}/consolidated \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '{
"resourceType": "<string>",
"type": "<string>",
"entry": [
{
"resource": {}
}
]
}'
Copy
Ask AI
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",
},
},
},
],
});
Path Params
The ID of the Patient.
Body
The resource needs to be “Bundle”
The type needs to be “collection”
The entry needs to be an array of BackboneElement, containing:
The FHIR resource being contributed.
See an example on Contributing Data.
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 (and 50 resources when in sandbox
).
Response
Returns a Bundle of type “transaction-response” with the entry being the outcome of the query.
Copy
Ask AI
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",
},
},
},
],
});
Copy
Ask AI
{
"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."
}
]
}
}
}
]
}
Copy
Ask AI
curl --request PUT \
--url https://api.sandbox.metriport.com/medical/v1/patient/{id}/consolidated \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '{
"resourceType": "<string>",
"type": "<string>",
"entry": [
{
"resource": {}
}
]
}'
Copy
Ask AI
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",
},
},
},
],
});
Assistant
Responses are generated using AI and may contain mistakes.