# Method: fhirStores.rollback

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

Rolls back resources from the FHIR store to the specified time.

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 rollback 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 `https://docs.cloud.google.com/healthcare-api/docs/reference/rest/Shared.Types/RollbackFhirResourcesResponse` 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/v1/OperationMetadata`.

### HTTP request

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

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

### Path parameters

| Parameters ||
|---|---|
| `name` | `string` Required. The name of the FHIR store to rollback, 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.rollback` |

### Request body

The request body contains data with the following structure:

| JSON representation |
|---|
| ``` { "type": [ string ], "rollbackTime": string, "filteringFields": { object(`https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.fhirStores/rollback#RollbackFhirResourceFilteringFields`) }, "force": boolean, "changeType": enum(`https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.fhirStores/rollback#ChangeType`), "resultGcsBucket": string, "excludeRollbacks": boolean, "inputGcsObject": string } ``` |

| Fields ||
|---|---|
| `type[]` | `string` Optional. If specified, revert only resources of these types |
| `rollbackTime` | ``string(`https://protobuf.dev/reference/protobuf/google.protobuf#timestamp` format)`` Required. Time point to rollback to. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: `"2014-10-02T15:01:23Z"`, `"2014-10-02T15:01:23.045123456Z"` or `"2014-10-02T15:01:23+05:30"`. |
| `filteringFields` | ``object(`https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.fhirStores/rollback#RollbackFhirResourceFilteringFields`)`` Optional. Parameters for filtering resources |
| `force` | `boolean` Optional. When enabled, changes will be reverted without explicit confirmation |
| `changeType` | ``enum(`https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.fhirStores/rollback#ChangeType`)`` Optional. CREATE/UPDATE/DELETE/ALL for reverting all txns of a certain type. |
| `resultGcsBucket` | `string` Required. Bucket to deposit result |
| `excludeRollbacks` | `boolean` Optional. Specifies whether to exclude earlier rollbacks. |
| `inputGcsObject` | `string` Optional. Cloud Storage object containing list of {resourceType}/{resourceId} lines, identifying resources to be reverted |

### 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).

## RollbackFhirResourceFilteringFields

| JSON representation |
|---|
| ``` { "operationIds": [ string ], "metadataFilter": string } ``` |

| Fields ||
|---|---|
| `operationIds[]` | `string` Optional. A list of operation IDs to roll back. |
| `metadataFilter` | `string` Optional. A filter expression that matches data in the `Resource.meta` element. Supports all filters in [AIP-160](https://google.aip.dev/160) except the "has"(`:`) operator. Supports the following custom functions: - `tag("<system>") = "<code>"` for tag filtering. - `extension_value_ts("<uri>") = <timestamp>` for filtering extensions with a timestamp, where `<timestamp>` is a Unix timestamp. Supports the `>`, `<`, `<=`, `>=`, and `!=` comparison operators. |

## ChangeType

Type of transaction to execute during FHIR resource rollback

| Enums ||
|---|---|
| `CHANGE_TYPE_UNSPECIFIED` | When unspecified, revert all transactions |
| `ALL` | All transactions |
| `CREATE` | Revert only CREATE transactions |
| `UPDATE` | Revert only Update transactions |
| `DELETE` | Revert only Delete transactions |