PUT
/
medical
/
v1
/
patient
/
{id}
/
consolidated
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": [
    {}
  ]
}'
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

id
string
required

The ID of the Patient.

Body

resourceType
string
required

The resource needs to be “Bundle”

type
string
required

The type needs to be “collection”

entry
array
required

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."
            }
          ]
        }
      }
    }
  ]
}