Create, read, update, and delete
Pathling implements the create, read, update, and delete operations from the FHIR REST API, for managing individual resources within the server.
There are a number of configuration values that affect the encoding of resources, see the Encoding section of the configuration documentation for details.
Create operation
The create operation allows you to create a new resource. The server always generates a new UUID for the resource, ignoring any client-provided ID.
POST /fhir/Patient
Content-Type: application/fhir+json
{
"resourceType": "Patient",
"name": [
{
"family": "Smith",
"given": ["John"]
}
],
"gender": "male",
"birthDate": "1970-01-01"
}
The response will include:
- HTTP status
201 Created - A
Locationheader with the URL of the newly created resource - The created resource with the server-generated ID
{
"resourceType": "Patient",
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"name": [
{
"family": "Smith",
"given": ["John"]
}
],
"gender": "male",
"birthDate": "1970-01-01"
}
Read operation
The read operation retrieves a single resource by its ID.
GET /fhir/Patient/example-patient-1
The response will be:
- HTTP status
200 OKwith the resource - HTTP status
404 Not Foundif the resource does not exist
{
"resourceType": "Patient",
"id": "example-patient-1",
"name": [
{
"family": "Smith",
"given": ["John"]
}
],
"gender": "male",
"birthDate": "1970-01-01"
}
Update operation
The update operation allows you to create or update a resource with a specific ID. If the resource exists, it will be updated; if not, it will be created with the specified ID.
PUT /fhir/Patient/example-patient-1
Content-Type: application/fhir+json
{
"resourceType": "Patient",
"id": "example-patient-1",
"name": [
{
"family": "Smith",
"given": ["John"]
}
],
"gender": "male",
"birthDate": "1970-01-01"
}
Delete operation
The delete operation allows you to remove a resource from the server.
DELETE /fhir/Patient/example-patient-1
The response will be:
- HTTP status
204 No Contentif the resource was successfully deleted - HTTP status
404 Not Foundif the resource does not exist
Note that delete operations are not idempotent in Pathling - attempting to
delete a resource that has already been deleted will return a 404 error.
ViewDefinition resources
The server stores ViewDefinition resources as defined by SQL on FHIR ViewDefinition 3.0.0-ballot. Every root element of the resource is retained, so a ViewDefinition reads back as it was written.
Complex elements are stored using the FHIR R4 datatypes. Sub-elements that are defined only in later releases of FHIR are therefore not retained:
useContext.valueCanonicalrelatedArtifact.classifierrelatedArtifact.resourceReferencerelatedArtifact.publicationStatusrelatedArtifact.publicationDaterelatedArtifact.document.heightrelatedArtifact.document.widthrelatedArtifact.document.framesrelatedArtifact.document.durationrelatedArtifact.document.pagesconstant.valueInteger64
Codes that exist only in later releases, such as a relatedArtifact.type of
part-of, are rejected with a 400 error rather than dropped.
A warehouse that holds a ViewDefinition table written by an earlier version of
Pathling needs
pathling.storage.schemaAutoMerge enabled when
upgrading, so that the table gains the columns for the additional elements.
Batch operations
To perform multiple create, update, or delete operations in a single request, see the Batch documentation.