Stay organized with collections
Save and categorize content based on your preferences.
Full name: projects.locations.datasets.fhirStores.fhir.conditionalPatch
If a resource is found based on the search criteria specified in the query parameters, updates part of that resource by applying the operations specified in a JSON Patch document.
Implements the FHIR standard conditional patch interaction (STU3, R4, R5).
DSTU2 doesn't define a conditional patch method, but the server supports it in the same way it supports STU3.
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.
The request body must contain a JSON Patch document, and the request headers must contain Content-Type: application/json-patch+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 permission on the parent FHIR store and the healthcare.fhirResources.patch permission on the requested FHIR store resource.
[[["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, \u003ccode\u003econditionalPatch\u003c/code\u003e, updates part of a FHIR resource if it is found based on provided search criteria, using a JSON Patch document to specify changes.\u003c/p\u003e\n"],["\u003cp\u003eIt implements the FHIR standard conditional patch interaction for STU3 and R4, and supports a similar functionality for DSTU2, even though it isn't defined in its standard.\u003c/p\u003e\n"],["\u003cp\u003eSearch criteria are specified through query parameters, and if multiple matches are found, the request returns a \u003ccode\u003e412 Precondition Failed\u003c/code\u003e error.\u003c/p\u003e\n"],["\u003cp\u003eSuccessful updates return the updated resource with a server-assigned version ID, while errors are detailed in a JSON-encoded \u003ccode\u003eOperationOutcome\u003c/code\u003e resource or a generic GCP error if the request is invalid.\u003c/p\u003e\n"],["\u003cp\u003eExecuting this method requires the \u003ccode\u003ehealthcare.fhirStores.searchResources\u003c/code\u003e permission on the parent FHIR store and the \u003ccode\u003ehealthcare.fhirResources.patch\u003c/code\u003e permission on the requested FHIR resource.\u003c/p\u003e\n"]]],[],null,["# Method: fhir.conditionalPatch\n\n**Full name**: projects.locations.datasets.fhirStores.fhir.conditionalPatch\n\nIf a resource is found based on the search criteria specified in the query parameters, updates part of that resource by applying the operations specified in a [JSON Patch](http://jsonpatch.com/) document.\n\nImplements the FHIR standard conditional patch interaction ([STU3](https://hl7.org/fhir/STU3/http.html#patch), [R4](https://hl7.org/fhir/R4/http.html#patch), [R5](https://hl7.org/fhir/R5/http.html#patch)).\n\nDSTU2 doesn't define a conditional patch method, but the server supports it in the same way it supports STU3.\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.\n\nThe request body must contain a JSON Patch document, and the request headers must contain `Content-Type: application/json-patch+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` permission on the parent FHIR store and the `healthcare.fhirResources.patch` permission on the requested FHIR store resource.\n\nFor samples that show how to call `conditionalPatch`, see [Conditionally patching a FHIR resource](https://cloud.google.com/healthcare/docs/how-tos/fhir-resources#conditionally_patching_a_fhir_resource).\n\n### HTTP request\n\n`PATCH 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)."]]