Conditional Update

The FHIR Conditional Update mechanism allows a resource to be transmitted to the server for updating, but instead of supplying an ID to update, the client supplies a search URL similar to the URL used for the Conditional Create example.

For more information, see Conditional Create.

Before performing the update, the server first performs the search. If no resources match the search, a new resource is created. If a resource already matches the search, it is updated using the contents in Bundle.entry.resource. In this case, the method/verb will be PUT and the search URL is specified in Bundle.request.url.

For example:

{
   "resourceType": "Bundle",
   "type": "transaction",
   "entry": [ {
   "fullUrl": "urn:uuid:95dbbf93-5829-46ba-9021-2545a1da3aa5",  > Placeholder ID for Patient
      "resource": {
         "resourceType": "Patient",
         "identifier": [ {
            "system": "http://acme.org/mrns",
            "value": "013872"
         } ],
         "name": [ {
            "family": "Simpson",
            "given": [ "Homer" ]
         } ]
      },
      "request": {
         "method": "PUT",
         "url": "Patient?identifier=http://acme.org/mrns|013872"   > Search URL for Conditional Update
	      }
   }, {
      "fullUrl": "urn:uuid:124ff3c8-f251-4bd9-8c44-cc6568180eae",
      "resource": {
         "resourceType": "Observation",
         "identifier": [ {
            "system": "http://acme.org/obs",
            "value": "46252"
         } ],
         "status": "final",
         "code": {
            "coding": [ {
               "system": "http://loinc",
               "code": "29463-7",
               "display": "Body Weight"
            } ]
         },
         "subject": {
          "reference": "urn:uuid:95dbbf93-5829-46ba-9021-2545a1da3aa5"    > Reference to Patient Placeholder ID
	         },
         "effectiveDateTime": "2022-02-23",
         "valueQuantity": {
            "value": 67.1,
            "unit": "kg",
            "system": "http://unitsofmeasure.org",
            "code": "kg"
         }
      },
      "request": {
         "method": "PUT",
         "url": "Observation?identifier=http://acme.org/obs|46252"   > Search URL for Conditional Update
	      }
   } ]
}