**Full name**: projects.locations.datasets.fhirStores.importHistory

Import resource historical versions from Cloud Storage source to destination fhir store. The exported resource, along with previous versions, will be exported in one or more FHIR history bundles.

This method returns an `https://docs.cloud.google.com/healthcare-api/docs/reference/rest/Shared.Types/ListOperationsResponse#Operation` that can be used to track the status of the import by calling `operations.get`.

Immediate fatal errors appear in the `https://docs.cloud.google.com/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` is returned in the `https://docs.cloud.google.com/healthcare-api/docs/reference/rest/Shared.Types/ListOperationsResponse#Operation.FIELDS.response` field. The `https://docs.cloud.google.com/healthcare-api/docs/reference/rest/Shared.Types/ListOperationsResponse#Operation.FIELDS.metadata` field type for this operation is `https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1beta1/OperationMetadata`.

### HTTP request

`POST https://healthcare.googleapis.com/v1beta1/{name=projects/*/locations/*/datasets/*/fhirStores/*}:importHistory`

The URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.

### Path parameters

| Parameters ||
|---|---|
| `name` | `string` 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](https://cloud.google.com/iam/docs/) permission on the specified resource `name`: - `healthcare.fhirStores.import` |

### Request body

The request body contains data with the following structure:

| JSON representation |
|---|
| ``` { "maxErrorCount": string, "contentStructure": enum(`https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1beta1/projects.locations.datasets.fhirStores/importHistory#ContentStructure`), // The following is a list of mutually exclusive fields. At most one of the // fields will be set in a response: "gcsSource": { object(`https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1beta1/GcsSource`) } // End of mutually exclusive fields. } ``` |

| Fields ||
|---|---|
| `maxErrorCount` | `string (https://developers.google.com/discovery/v1/type-format format)` The maximum number of errors before the server cancels the operation. If not specified or set to 0, defaults to 100. -1 means no maximum, the server tries to process all input. Since the server executes the operation in parallel, it might not stop the operation after exactly this number of errors occur. |
| `contentStructure` | ``enum(`https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1beta1/projects.locations.datasets.fhirStores/importHistory#ContentStructure`)`` The content structure in the source location. If not specified, the server treats the input source files as `https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1beta1/projects.locations.datasets.fhirStores/importHistory#ContentStructure.ENUM_VALUES.BUNDLE`. |
| 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 grant the Healthcare Service Agent account the required permissions. For steps to assign the permissions, see [Importing data from Cloud Storage](https://cloud.google.com/healthcare/docs/how-tos/permissions-healthcare-api-gcp-products#importing_data_from_cloud_storage). The following is a list of mutually exclusive fields. At most one of the fields will be set in a response: ||
| `gcsSource` | ``object(`https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1beta1/GcsSource`)`` Cloud Storage source data location and import configuration. The Cloud Healthcare Service Agent requires the `roles/storage.objectAdmin` Cloud IAM roles on the Cloud Storage location. The Healthcare Service Agent Each Cloud Storage object should be a text file that contains the format specified in `https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1beta1/projects.locations.datasets.fhirStores/importHistory#ContentStructure`. |
| End of mutually exclusive fields. ||

### Response body

If successful, the response body contains an instance of `https://docs.cloud.google.com/healthcare-api/docs/reference/rest/Shared.Types/ListOperationsResponse#Operation`.

### Authorization scopes

Requires one of the following OAuth scopes:

- `https://www.googleapis.com/auth/cloud-healthcare`
- `https://www.googleapis.com/auth/cloud-platform`

For more information, see the [Authentication Overview](https://docs.cloud.google.com/docs/authentication#authorization-gcp).

## ContentStructure

The content structure of the input source files.

| Enums ||
|---|---|
| `CONTENT_STRUCTURE_UNSPECIFIED` | 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. |