Stay organized with collections
Save and categorize content based on your preferences.
Full name: projects.locations.datasets.fhirStores.import
Imports resources to the FHIR store by loading data from the specified sources. This method is optimized to load large quantities of data using import semantics that ignore some FHIR store configuration options and are not suitable for all use cases. It is primarily intended to load data into an empty FHIR store that is not being used by other clients. In cases where this method is not appropriate, consider using ExecuteBundle to load data.
Every resource in the input must contain a client-supplied ID. Each resource is stored using the supplied ID regardless of the enableUpdateCreate setting on the FHIR store. It is strongly advised not to include or encode any sensitive data such as patient identifiers in client-specified resource IDs. Those IDs are part of the FHIR resource path recorded in Cloud Audit Logs and Cloud Pub/Sub notifications. Those IDs can also be contained in reference fields within other resources.
The import process does not enforce referential integrity, regardless of the disableReferentialIntegrity setting on the FHIR store. This allows the import of resources with arbitrary interdependencies without considering grouping or ordering, but if the input data contains invalid references or if some resources fail to be imported, the FHIR store might be left in a state that violates referential integrity.
The import process does not trigger Pub/Sub notification or BigQuery streaming update, regardless of how those are configured on the FHIR store.
If a resource with the specified ID already exists, the most recent version of the resource is overwritten without creating a new historical version, regardless of the disableResourceVersioning setting on the FHIR store. If transient failures occur during the import, it's possible that successfully imported resources will be overwritten more than once.
The import operation is idempotent unless the input data contains multiple valid resources with the same ID but different contents. In that case, after the import completes, the store contains exactly one resource with that ID but there is no ordering guarantee on which version of the contents it will have. The operation result counters do not count duplicate IDs as an error and count one success for each resource in the input, which might result in a success count larger than the number of resources in the FHIR store. This often occurs when importing data organized in bundles produced by Patient-everything where each bundle contains its own copy of a resource such as Practitioner that might be referred to by many patients.
If some resources fail to import, for example due to parsing errors, successfully imported resources are not rolled back.
The location and format of the input data is specified by the parameters in ImportResourcesRequest. Note that if no format is specified, this method assumes the BUNDLE format. When using the BUNDLE format this method ignores the Bundle.type field, except that history bundles are rejected, and does not apply any of the bundle processing semantics for batch or transaction bundles. Unlike in ExecuteBundle, transaction bundles are not executed as a single transaction and bundle-internal references are not rewritten. The bundle is treated as a collection of resources to be written as provided in Bundle.entry.resource, ignoring Bundle.entry.request. As an example, this allows the import of searchset bundles produced by a FHIR search or Patient-everything operation.
This method returns an Operation that can be used to track the status of the import by calling operations.get.
Required. The name of the FHIR store to import FHIR resources to, in the format of projects/{projectId}/locations/{locationId}/datasets/{datasetId}/fhirStores/{fhirStoreId}.
Authorization requires the following IAM permission on the specified resource name:
healthcare.fhirStores.import
Request body
The request body contains data with the following structure:
JSON representation
{"contentStructure": enum(ContentStructure),// Union field source can be only one of the following:"gcsSource": {object(GcsSource)}// End of list of possible types for union field source.}
The content structure in the source location. If not specified, the server treats the input source files as BUNDLE.
Union field source. Specifies the import source and configuration.
To enable the Cloud Healthcare API to read from resources in your project such as Cloud Storage buckets, you must give the consumer Cloud Healthcare API service account the proper permissions. The service account is: service-{PROJECT_NUMBER}@gcp-sa-healthcare.iam.gserviceaccount.com. The PROJECT_NUMBER identifies the project that contains the destination FHIR store. To get the project number, go to the Cloud Console Dashboard. source can be only one of the following:
If the content structure is not specified, the default value BUNDLE is used.
BUNDLE
The source file contains one or more lines of newline-delimited JSON (ndjson). Each line is a bundle that contains one or more resources.
RESOURCE
The source file contains one or more lines of newline-delimited JSON (ndjson). Each line is a single resource.
BUNDLE_PRETTY
The entire file is one JSON bundle. The JSON can span multiple lines.
RESOURCE_PRETTY
The entire file is one JSON resource. The JSON can span multiple lines.
GcsSource
Specifies the configuration for importing data from Cloud Storage.
JSON representation
{"uri": string}
Fields
uri
string
Points to a Cloud Storage URI containing file(s) to import.
The URI must be in the following format: gs://{bucket_id}/{objectId}. The URI can include wildcards in objectId and thus identify multiple files. Supported wildcards:
* to match 0 or more non-separator characters
** to match 0 or more characters (including separators). Must be used at the end of a path and with no other wildcards in the path. Can also be used with a file extension (such as .ndjson), which imports all files with the extension in the specified directory and its sub-directories. For example, gs://my-bucket/my-directory/**.ndjson imports all files with .ndjson extensions in my-directory/ and its sub-directories.
? to match 1 character
Files matching the wildcard are expected to contain content only, no metadata.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-06-27 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eprojects.locations.datasets.fhirStores.import\u003c/code\u003e method is designed for loading large datasets into a FHIR store, primarily an empty one, and uses import semantics that may not be suitable for all use cases.\u003c/p\u003e\n"],["\u003cp\u003eThis method requires each resource to have a client-supplied ID, which will be used for storage and will be recorded in audit logs and Pub/Sub notifications, and overwrites any existing resource with the same ID without creating a new historical version, regardless of versioning settings.\u003c/p\u003e\n"],["\u003cp\u003eReferential integrity is not enforced during the import process, allowing resources with arbitrary interdependencies to be imported, but this can leave the FHIR store in a state that violates referential integrity if the input is flawed.\u003c/p\u003e\n"],["\u003cp\u003eThe import process does not trigger Pub/Sub notifications or BigQuery streaming updates, regardless of the FHIR store's configuration, and doesn't process batch or transaction bundles like the \u003ccode\u003eExecuteBundle\u003c/code\u003e method does.\u003c/p\u003e\n"],["\u003cp\u003eInput data location and format are specified in \u003ccode\u003eImportResourcesRequest\u003c/code\u003e, and if no format is specified, the method assumes the \u003ccode\u003eBUNDLE\u003c/code\u003e format; the import operation can be tracked using \u003ccode\u003eoperations.get\u003c/code\u003e, and returns detailed results in the \u003ccode\u003eresponse\u003c/code\u003e field of type \u003ccode\u003eImportResourcesResponse\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,["# Method: fhirStores.import\n\n**Full name**: projects.locations.datasets.fhirStores.import\n\nImports resources to the FHIR store by loading data from the specified sources. This method is optimized to load large quantities of data using import semantics that ignore some FHIR store configuration options and are not suitable for all use cases. It is primarily intended to load data into an empty FHIR store that is not being used by other clients. In cases where this method is not appropriate, consider using [ExecuteBundle](/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.fhirStores.fhir/executeBundle#google.cloud.healthcare.v1.fhir.rest.FhirService.ExecuteBundle) to load data.\n\nEvery resource in the input must contain a client-supplied ID. Each resource is stored using the supplied ID regardless of the [enableUpdateCreate](/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.fhirStores#FhirStore.FIELDS.enable_update_create) setting on the FHIR store. It is strongly advised not to include or encode any sensitive data such as patient identifiers in client-specified resource IDs. Those IDs are part of the FHIR resource path recorded in Cloud Audit Logs and Cloud Pub/Sub notifications. Those IDs can also be contained in reference fields within other resources.\n\nThe import process does not enforce referential integrity, regardless of the [disableReferentialIntegrity](/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.fhirStores#FhirStore.FIELDS.disable_referential_integrity) setting on the FHIR store. This allows the import of resources with arbitrary interdependencies without considering grouping or ordering, but if the input data contains invalid references or if some resources fail to be imported, the FHIR store might be left in a state that violates referential integrity.\n\nThe import process does not trigger Pub/Sub notification or BigQuery streaming update, regardless of how those are configured on the FHIR store.\n\nIf a resource with the specified ID already exists, the most recent version of the resource is overwritten without creating a new historical version, regardless of the [disableResourceVersioning](/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.fhirStores#FhirStore.FIELDS.disable_resource_versioning) setting on the FHIR store. If transient failures occur during the import, it's possible that successfully imported resources will be overwritten more than once.\n\nThe import operation is idempotent unless the input data contains multiple valid resources with the same ID but different contents. In that case, after the import completes, the store contains exactly one resource with that ID but there is no ordering guarantee on which version of the contents it will have. The operation result counters do not count duplicate IDs as an error and count one success for each resource in the input, which might result in a success count larger than the number of resources in the FHIR store. This often occurs when importing data organized in bundles produced by [Patient-everything](/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.fhirStores.fhir/Patient-everything#google.cloud.healthcare.v1.fhir.rest.FhirService.GetPatientEverything) where each bundle contains its own copy of a resource such as Practitioner that might be referred to by many patients.\n\nIf some resources fail to import, for example due to parsing errors, successfully imported resources are not rolled back.\n\nThe location and format of the input data is specified by the parameters in `ImportResourcesRequest`. Note that if no format is specified, this method assumes the `BUNDLE` format. When using the `BUNDLE` format this method ignores the `Bundle.type` field, except that `history` bundles are rejected, and does not apply any of the bundle processing semantics for batch or transaction bundles. Unlike in [ExecuteBundle](/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.fhirStores.fhir/executeBundle#google.cloud.healthcare.v1.fhir.rest.FhirService.ExecuteBundle), transaction bundles are not executed as a single transaction and bundle-internal references are not rewritten. The bundle is treated as a collection of resources to be written as provided in `Bundle.entry.resource`, ignoring `Bundle.entry.request`. As an example, this allows the import of `searchset` bundles produced by a [FHIR search](/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.fhirStores.fhir/search#google.cloud.healthcare.v1.fhir.rest.FhirService.SearchResources) or [Patient-everything](/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.fhirStores.fhir/Patient-everything#google.cloud.healthcare.v1.fhir.rest.FhirService.GetPatientEverything) operation.\n\nThis method returns an [Operation](/healthcare-api/docs/reference/rest/Shared.Types/ListOperationsResponse#Operation) that can be used to track the status of the import by calling `operations.get`.\n\nImmediate fatal errors appear in the [error](/healthcare-api/docs/reference/rest/Shared.Types/ListOperationsResponse#Operation.FIELDS.error) field, errors are also logged to Cloud Logging (see [Viewing error logs in Cloud Logging](https://cloud.google.com/healthcare/docs/how-tos/logging)). Otherwise, when the operation finishes, a detailed response of type [ImportResourcesResponse](/healthcare-api/docs/reference/rest/Shared.Types/ImportResourcesResponse) is returned in the [response](/healthcare-api/docs/reference/rest/Shared.Types/ListOperationsResponse#Operation.FIELDS.response) field. The [metadata](/healthcare-api/docs/reference/rest/Shared.Types/ListOperationsResponse#Operation.FIELDS.metadata) field type for this operation is [OperationMetadata](/healthcare-api/docs/reference/rest/v1/OperationMetadata).\n\n### HTTP request\n\n`POST https://healthcare.googleapis.com/v1/{name=projects/*/locations/*/datasets/*/fhirStores/*}:import`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n### Request body\n\nThe request body contains data with the following structure:\n\n### Response body\n\nIf successful, the response body contains an instance of [Operation](/healthcare-api/docs/reference/rest/Shared.Types/ListOperationsResponse#Operation).\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/cloud-healthcare`\n- `https://www.googleapis.com/auth/cloud-platform`\n\nFor more information, see the [Authentication Overview](/docs/authentication#authorization-gcp).\n\nContentStructure\n----------------\n\nThe content structure of the input source files.\n\nGcsSource\n---------\n\nSpecifies the configuration for importing data from Cloud Storage."]]