CRUD operations
To perform the
Create
interaction, use the HTTP method POST
and provide an FHIR Resource of the named type in the request body. The ID of the resource can either be passed by the client or generated by the server if it's absent in the request. If the interaction is successful, the Kodjin FHIR Server will return a 201 Created
HTTP status code and a Location header that contains the new Logical ID and Version ID of the created resource.For the
Update
interaction, use the HTTP method PUT
to create a new version for an existing resource.The request body is a Resource of the named type with an ID element that has an identical value to the [ID] in the URL. Without a matching ID element, the server will respond with an HTTP 400 error code.
If successful, the Kodjin FHIR Server returns a
200 OK
HTTP status code, an ETag header with the version ID, and a Last-Modified header. Kodjin also allows clients to use PUT to create a new resource, returning a 201 Created
status code and a Location header.A
PATCH
interaction can be used as an alternative, instead of updating the entire resource. This is helpful when the client wants to reduce bandwidth usage or has limited access to the resource.The patch interaction is performed by an HTTP method
PATCH
. The body of the interaction should be a JSON document with a content type of application/json-patch+json
, as shown in the example below.If the interaction is successful, the response will be the same as an Update.
The
DELETE
interaction is used to remove an existing resource from the server. Simply use the HTTP method DELETE
without providing a body.Once a resource is deleted, it cannot be found through search interactions. If you attempt to read the resource again without specifying a version, you will receive a 404 Not found
HTTP status code. If the deletion is successful or if the resource does not exist, the server will respond with a 204 No Content
status code and no response payload.
The Kodjin FHIR Server keeps track of version history. When a resource is deleted, it creates a special history entry with no content, indicating that it has been marked as deleted.
The read interaction, performed through the HTTP method
GET
, grants access to the contents of a resource. The response body provides the current state of the resource, while the headers include an ETag header with the version ID of the resource and a Last-Modified header.