Journl Streamed
Talk to an expertWebsite
  • Introduction
  • Getting Started
    • Sandbox Access
    • On-Premise
    • Cloud
  • Overview
    • Why Journl Streamed?
    • Licensing & Support
    • Features
    • Solution Architecture and Usage
  • API
    • FHIR API
      • Accessing FHIR Data
      • CRUD
        • Create
        • Read
        • Update
          • Versioned Update
        • Patch
        • Delete
          • Versioned Delete
    • Batch Upsert
  • Services
    • Security & Access Control
    • FHIR Modeling, Profiles, and Standards
    • Careplan Creation
    • Analysis on Demand
      • Standard Process
      • Types of Analysis
    • Custom Resources
    • Monitoring & Maintenance
  • Storage
    • Database
      • Database schema
    • Backup and Restore
    • Indexes
  • Integrations
    • Data Ingestion and Decoupling
    • Subscriptions and Event Notifications
    • BI & Analytical tools
      • Power BI
      • Tableau
      • Jupyter Notebook
Powered by GitBook
On this page
  1. API

Batch Upsert

Description of how to insert or update a collection of resources using our FHIR API.

PreviousVersioned DeleteNextSecurity & Access Control

Last updated 11 months ago

PUT {base}/

The batch upsert operation allows you to update or create multiple resources in a single request. This is useful for efficiently managing large sets of data with minimal API calls. The upsert logic works as following:

  • Create: If a resource with the specified id does not exist, it will be created based on the resourceType described in the body.

  • Update: If a resource with the specified id already exists, it will be updated with the new data provided in the request.

Below is an example of how to use a PUT request to insert or update a resource. A complete list of resources can be found by visiting the resource specifications .

Request PUT {base}/

Headers

Name
Value

Content-Type

application/json

Authorization

Bearer <token>

Body

[
  {
    "name": [{ "given": ["Bob"] }],
    "active": true,
    "resourceType": "Patient",
    "id": "30405060"
  },
  {
    "name": [{ "given": ["Charles"] }],
    "active": false,
    "resourceType": "Patient",
    "id": "40506070"
  },
  {
    "name": [{ "given": ["Christy"] }],
    "active": false,
    "resourceType": "Patient",
    "id": "50607080"
  }
]

Response

[
  {
    "name": [
      {
        "given": ["Bob"]
      }
    ],
    "active": true,
    "id": "30405060",
    "resourceType": "Patient",
    "meta": {
      "lastUpdated": "2024-07-17T06:56:48.506516Z",
      "createdAt": "2024-07-17T06:56:48.506516Z",
      "versionId": "540603"
    }
  },
  {
    "name": [
      {
        "given": ["Charles"]
      }
    ],
    "active": false,
    "id": "40506070",
    "resourceType": "Patient",
    "meta": {
      "lastUpdated": "2024-07-17T06:56:48.519054Z",
      "createdAt": "2024-07-17T06:56:48.519054Z",
      "versionId": "540605"
    }
  },
  {
    "name": [
      {
        "given": ["Christy"]
      }
    ],
    "active": false,
    "id": "50607080",
    "resourceType": "Patient",
    "meta": {
      "lastUpdated": "2024-07-17T06:56:48.519054Z",
      "createdAt": "2024-07-17T06:56:48.519054Z",
      "versionId": "540613"
    }
  }
]
{
  "success": "Created"
}
{
  "error": "Unauthorized"
}
{
  "error": "Unprocessable"
}
here