On this page:

5.13Updating Data


This section contains information about methods for updating data in the CDR.

5.13.1Patching Data


Often it is desirable to make a small change to a resource without needing to re-upload the entire content. For example, a resource status field might be changed by an app with no other changes needed.

This type of scenario is a good candidate for the FHIR patch operation.

Patch Using JSONPatch

The following example shows a JSONPatch being used to update an Observation status:

PATCH Observation/123
Content-Type: application/json-patch+json

   "op": "replace", 
   "path": "/status", 
   "value": "in-progress" 

Patch Using JSONPatch (Tranasction)

A JSONPatch may also be submitted as a part of a FHIR transaction using a Binary resource as the payload in order to hold the contents.

  "resourceType": "Bundle",
  "type": "transaction",
  "entry": [
      "fullUrl": "Patient/1",
      "resource": {
        "resourceType": "Binary",
        "contentType": "application/json-patch+json",
        "data": "WyB7ICJvcCI6InJlcGxhY2UiLCAicGF0aCI6Ii9hY3RpdmUiLCAidmFsdWUiOmZhbHNlIH0gXQ=="
      "request": {
        "method": "PATCH",
        "url": "Patient/1"

5.13.2Tag Retention


According to the FHIR rules on updating resources, by default when a resource is updated, any tags and security labels will be carried forward even if they are not explicitly listed in the new version.

For example, suppose a resource is created by a client, and in that resource a tag "foo" is listed in Resource.meta.tag. Then, an update is performed by a client but this update does not contain a value in Resource.meta.

According to the FHIR rules, in this case the tag will be copied to the new version of the resource even though it was not explicitly requested.

In many cases this is desired behavior, since this is consistent with how tags are expected to be used.

If a client wishes to override this behavior, they may do so using the X-Meta-Snapshot-Mode header. This header indicates that Tags and/or Security Labels and/or Profile Declarations should be treated as snapshots, meaning that any values not already present should be removed.

The value is a comma-separated list containing the metadata components that should be treated in snapshot mode:

  • TAG - Resource tags
  • PROFILE - Resource profile declarations
  • SECURITY_LABEL - Security labels

An example is shown below:


If this header is not present, PROFILE will be treated as being in snapshot mode but TAG and SECURITY_LABEL will not.