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 based on the search criteria specified in the query parameters, updates the entire contents of that resource.
Implements the FHIR standard conditional update interaction (DSTU2, STU3, R4, R5).
Search terms are provided as query parameters following the same pattern as the search method.
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.
This method requires thehealthcare.fhirStores.searchResources and healthcare.fhirResources.update permissions on the parent FHIR store.
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 method conditionally updates a FHIR resource based on search criteria provided as query parameters, following FHIR standard conditional update interactions.\u003c/p\u003e\n"],["\u003cp\u003eIf the search finds one matching resource, it will update the entire content of the resource, but if more than one match is found, the request returns a \u003ccode\u003e412 Precondition Failed\u003c/code\u003e error.\u003c/p\u003e\n"],["\u003cp\u003eIf no matches are found, a new resource will be created with either a client-specified ID if present and \u003ccode\u003eenableUpdateCreate\u003c/code\u003e is set, or with a server-assigned ID otherwise.\u003c/p\u003e\n"],["\u003cp\u003eThe request body must be a JSON-encoded FHIR resource with the \u003ccode\u003eContent-Type: application/fhir+json\u003c/code\u003e header, and successful updates will return the updated resource, while errors will return a JSON-encoded \u003ccode\u003eOperationOutcome\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThis operation requires the \u003ccode\u003ehealthcare.fhirStores.searchResources\u003c/code\u003e and \u003ccode\u003ehealthcare.fhirResources.update\u003c/code\u003e permissions, and it utilizes a PUT HTTP request to a specific URL with parameters for the FHIR store and resource type.\u003c/p\u003e\n"]]],[],null,["# Method: fhir.conditionalUpdate\n\n**Full name**: projects.locations.datasets.fhirStores.fhir.conditionalUpdate\n\nIf a resource is found based on the search criteria specified in the query parameters, updates the entire contents of that resource.\n\nImplements the FHIR standard conditional update interaction ([DSTU2](https://hl7.org/fhir/DSTU2/http.html#2.1.0.10.2), [STU3](https://hl7.org/fhir/STU3/http.html#cond-update), [R4](https://hl7.org/fhir/R4/http.html#cond-update), [R5](https://hl7.org/fhir/R5/http.html#cond-update)).\n\nSearch terms are provided as query parameters following the same pattern as the [search](/healthcare-api/docs/reference/rest/v1beta1/projects.locations.datasets.fhirStores.fhir/search#google.cloud.healthcare.v1beta1.fhir.rest.FhirService.SearchResources) method.\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/v1beta1/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/v1beta1/projects.locations.datasets.fhirStores.fhir/create#google.cloud.healthcare.v1beta1.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\nThis method requires the`healthcare.fhirStores.searchResources` and `healthcare.fhirResources.update` permissions on the parent FHIR store.\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/v1beta1/{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)."]]