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 with the identifier 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, limited to searching by resource identifier.
DSTU2 doesn't define a conditional patch method, but the server supports it in the same way it supports STU3.
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.
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.
[[["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 service, \u003ccode\u003econditionalPatch\u003c/code\u003e, updates a FHIR resource by applying a JSON Patch document if a resource is found matching the specified identifier.\u003c/p\u003e\n"],["\u003cp\u003eIt implements the FHIR standard conditional patch interaction, supporting searches based on resource identifiers in the format \u003ccode\u003eidentifier=system|value\u003c/code\u003e or \u003ccode\u003eidentifier=value\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eA \u003ccode\u003e412 Precondition Failed\u003c/code\u003e error is returned if the search criteria match more than one resource.\u003c/p\u003e\n"],["\u003cp\u003eThe request must include a JSON Patch document in the body and specify \u003ccode\u003eContent-Type: application/json-patch+json\u003c/code\u003e in the headers.\u003c/p\u003e\n"],["\u003cp\u003eUpon successful update, the response will contain the updated resource in JSON format, inclusive of the server-assigned version ID, while errors are communicated via a JSON-encoded \u003ccode\u003eOperationOutcome\u003c/code\u003e 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 with the identifier 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, limited to searching by resource identifier.\n\nDSTU2 doesn't define a conditional patch method, but the server supports it in the same way it supports STU3.\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.\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\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/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)."]]