Update
This interaction allows modifying an existing resource. If a resource with id
(provided in the URL) doesn't exist, a new resource will be created.
After performing this interaction, the resource will be replaced with a new version of the resource provided in the body of the request.
Examples
Update a patient by a given id
Create a patient with a specified id
Update patient by name
Response codes
The following codes can be returned by the server:
200
OK
Resource successfully updated
201
Created
Resource successfully created
422
Unprocessable Entity
The proposed resource violated applicable FHIR profiles or server business rules
Conditional Update
No matches: The server performs a
create
interactionOne Match: The server performs the update against the matching resource
Multiple matches: The server returns a
412 Precondition Failed
error indicating the client's criteria were not selective enough
In contrast to FHIR, Aidbox conditional update allows the creation of a resource with a specific id
. In case of one match, conditional update
ignores the id coming in the request body. That means that id
can't be changed by any update
operation.
Example
Create a patient with the name Julie and specified id if no other patients with the same name exist:
Versioned Update
While you update, there is a risk of overriding the latest changes done by another operation. To escape this situation, you can use a versioned update by sending If-Match
header with versionId
of the resource you want to update. If the server has the same version of resources, the update will be successful. If versions do not match, you will get OperationOutcome with conflict code.
Example
Let's say we created a patient:
To fix the family for this patient without the risk of overriding someone else's changes, we can use a versioned update request:
If someone has already edited the same patient, his version id was changed, and we got OperationOutcome.
Isolation levels
If you wish to use a lower isolation level, use the x-max-isolation-level
header.
Allowed values are:
serializable
repeatable-read
read-commited
Example:
Last updated
Was this helpful?