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.
Batch operations
To perform multiple create, update, or delete operations in a single request, see the Batch documentation.