Update a FHIR Resource with Conditional Update

Update an existing resource using identification criteria and not by logical id using the conditional update request.

HTTP Request

You can use an HTTP PUT request to update an existing resource:

PUT [base]/[type]?identifier=[new identifier generated value]

Headers

If-Match - W/"<Resource version ID>"

For more information, see ETag and If-Match Headers.

Path Parameters

  • base: Service endpoint to interact with FHIR resources. For more information, see Service Endpoint.

  • type: The type of resource, for example, Patient or Encounter.

Request Body

  • Create a Patient:

  • Update the Patient family name with conditional update:

    PUT https://[base]/Patient?identifier=e96c6bf4-17d9-4f07-94bd-fc27220624d5

    Headers

    If-Match - W/"db6f2d17-c1f4-49d7-8122-061f30c99af4"

HTTP Status Response Codes

When a resource is updated, the FHIR server performs a search and returns how many matches of the resources are found:

HTTP Code

Scenario

Description

200

One Match

Updates the matching resource.

201

No Matches

Creates a new FHIR resource.

404

Missing Functional or Instance-Based Authorization or No Data Found

Authorization error. Returns 404 with no response body.

412

Multiple Matches

Request failed.

422

Unprocessable Entity

Validation error. Returns 422 with corresponding error message in response body.

The following HTTP status response codes are returned for the If-Match header request:

HTTP Code

Scenario

Description

400

Bad Request

The If-Match header is not found.

409

Conflict Interaction

Conflict If-Match header and the update request cannot be performed.

412

Multiple Matches

The resource version ID does not match.