Stay organized with collections
Save and categorize content based on your preferences.
Full name: projects.locations.datasets.fhirStores.fhir.conditionalUpdate
If a resource is found with the identifier specified in the query parameters, updates the entire contents of that resource.
Implements the FHIR standard conditional update interaction, limited to searching by resource identifier.
Search term for identifier should be in the pattern identifier=system|value or identifier=value - similar to the search method on resources with a specific identifier.
If the search criteria identify more than one match, the request returns a 412 Precondition Failed error. If the search criteria identify zero matches, and the supplied resource body contains an id, and the FHIR store has enableUpdateCreate set, creates the resource with the client-specified ID. 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 Pub/Sub notifications. Those IDs can also be contained in reference fields within other resources. If the search criteria identify zero matches, and the supplied resource body does not contain an id, the resource is created with a server-assigned ID as per the create method.
The request body must contain a JSON-encoded FHIR resource, and the request headers must contain Content-Type: application/fhir+json.
On success, the response body contains a JSON-encoded representation of the updated resource, including the server-assigned version ID. Errors generated by the FHIR store contain a JSON-encoded OperationOutcome resource describing the reason for the error. If the request cannot be mapped to a valid API method on a FHIR store, a generic GCP error might be returned instead.
Required. The name of the FHIR store this resource belongs to.
Authorization requires the following IAM permission on the specified resource parent:
healthcare.fhirResources.update
type
string
Required. The FHIR resource type to update, such as Patient or Observation. For a complete list, see the FHIR Resource Index (DSTU2, STU3, R4, R5). Must match the resource type in the provided content.
Request body
The request body contains an instance of HttpBody.
Response body
If successful, the response is a generic HTTP response whose format is defined by the method.
[[["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-07-23 UTC."],[[["\u003cp\u003eThis function \u003ccode\u003econditionalUpdate\u003c/code\u003e updates a FHIR resource if it's found based on the identifier in the query parameters, following the FHIR standard conditional update interaction.\u003c/p\u003e\n"],["\u003cp\u003eThe search term for the identifier should use the format \u003ccode\u003eidentifier=system|value\u003c/code\u003e or \u003ccode\u003eidentifier=value\u003c/code\u003e, similar to the \u003ccode\u003esearch\u003c/code\u003e method, and a \u003ccode\u003e412 Precondition Failed\u003c/code\u003e error will occur if multiple matches are found.\u003c/p\u003e\n"],["\u003cp\u003eIf no matches are found, a new resource is created with either a client-specified ID (if provided and \u003ccode\u003eenableUpdateCreate\u003c/code\u003e is set) or a server-assigned ID.\u003c/p\u003e\n"],["\u003cp\u003eThe request must include a JSON-encoded FHIR resource in the body with the appropriate content type header, and the response will contain the updated resource or an \u003ccode\u003eOperationOutcome\u003c/code\u003e error description.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eparent\u003c/code\u003e and \u003ccode\u003etype\u003c/code\u003e path parameters are required, with \u003ccode\u003eparent\u003c/code\u003e being the name of the FHIR store and \u003ccode\u003etype\u003c/code\u003e being the FHIR resource type; proper IAM permissions are needed for authorization.\u003c/p\u003e\n"]]],[],null,["# Method: fhir.conditionalUpdate\n\n**Full name**: projects.locations.datasets.fhirStores.fhir.conditionalUpdate\n\nIf a resource is found with the identifier specified in the query parameters, updates the entire contents of that resource.\n\nImplements the FHIR standard conditional update interaction, limited to searching by resource identifier.\n\nSearch term for identifier should be in the pattern `identifier=system|value` or `identifier=value` - similar to the [`search`](/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.fhirStores.fhir/search#google.cloud.healthcare.v1.fhir.rest.FhirService.SearchResources) method on resources with a specific identifier.\n\nIf the search criteria identify more than one match, the request returns a `412 Precondition Failed` error. If the search criteria identify zero matches, and the supplied resource body contains an `id`, and the FHIR store has [enableUpdateCreate](/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.fhirStores#FhirStore.FIELDS.enable_update_create) set, creates the resource with the client-specified ID. 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 Pub/Sub notifications. Those IDs can also be contained in reference fields within other resources. If the search criteria identify zero matches, and the supplied resource body does not contain an `id`, the resource is created with a server-assigned ID as per the [create](/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.fhirStores.fhir/create#google.cloud.healthcare.v1.fhir.rest.FhirService.CreateResource) method.\n\nThe request body must contain a JSON-encoded FHIR resource, and the request headers must contain `Content-Type: application/fhir+json`.\n\nOn success, the response body contains a JSON-encoded representation of the updated resource, including the server-assigned version ID. Errors generated by the FHIR store contain a JSON-encoded `OperationOutcome` resource describing the reason for the error. If the request cannot be mapped to a valid API method on a FHIR store, a generic GCP error might be returned instead.\n\nFor samples that show how to call `conditionalUpdate`, see [Conditionally updating a FHIR resource](https://cloud.google.com/healthcare/docs/how-tos/fhir-resources#conditionally_updating_a_fhir_resource).\n\n### HTTP request\n\n`PUT https://healthcare.googleapis.com/v1/{parent=projects/*/locations/*/datasets/*/fhirStores/*}/fhir/{type}`\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 an instance of [HttpBody](/healthcare-api/docs/reference/rest/Shared.Types/HttpBody).\n\n### Response body\n\nIf successful, the response is a generic HTTP response whose format is defined by the method.\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)."]]