Quick Reference
This page contains quick reference cURL examples for manual shell interaction or simple bash scripting. All examples include explicit request verbs for endpoint disambiguation. For more language examples, visit the static reference prototype, powered by Scalar. Be aware that the Scalar render is currently just a static prototype and cannot access localhost
through the hosted client.
For a fully interactive API reference session with the Swagger UI you need to install the service and spin up a server. See the Quickstart Guide for details.
Get A JWT
This example illustrates a basic service call to obtain a JWT.
curl -s --request POST \--url http://127.0.0.1:3000/v1/login \--header "Content-Type: application/json" \--data '{"username": "admin", "password": "apidocpass"}' | jq .
{ "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhZG1pbiIsImlhdCI6MTc0MzY0Mzk5NywiZXhwIjoxNzQzNjQ3NTk3fQ.L0-qbMhCU6WbUFc0qpE5575I-zJ8w5K4pTTBGid685A"}
This example does the same thing as the first example, but also creates a shell variable for use in auth headers in subsequent API calls. The example uses tee
to split the response, sending the raw JSON response to stderr
for visual debugging with jq
formatting, and extracts/stores the token
fields from successfull calls a variable called TOKEN
. Be aware that json_pp
does not allow you to parse or further pipe output, so you will need to set shell variables from the API responses some other way.
TOKEN=$(curl -s --request POST \ --url http://127.0.0.1:3000/v1/login \ --header "Content-Type: application/json" \ --data '{"username": "admin", "password": "apidocpass"}' \ | tee >(jq . >&2) | jq -r '.token')
{ "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhZG1pbiIsImlhdCI6MTc0MzY0Mzk5NywiZXhwIjoxNzQzNjQ3NTk3fQ.L0-qbMhCU6WbUFc0qpE5575I-zJ8w5K4pTTBGid685A"}
Create A Patient Record
This example illustrates creating a patient record. Some fields are left blank for illustrative purposes.
curl -s --request POST \--url http://127.0.0.1:3000/v1/patient \--header "Content-Type: application/json" \--header "Authorization: Bearer $TOKEN" \--data '{ "name": { "first": "Bobson", "surname": "Dugnutt" }, "address": { "address_lines": ["311 Lightning St", "ste 1300"], "sublocality": "", "locality": "", "administrative_area": "", "postal_code": "97217", "country_region": "USA" }, "birth_date": { "day": 8, "month": 10, "year": 1969 }}' | jq .
Get A Patient Record
This example illustrates retrieving a specific patient record by patient_id
.
curl -s --request GET \--url http://127.0.0.1:3000/v1/patient/a6115489-91b0-4ae7-a453-14a5fe2f6f51 \--header "Content-Type: application/json" \--header "Authorization: Bearer $TOKEN" | jq .
{ "data" : { "address" : { "address_lines" : [ "123 Thunder St", "ste 1300" ], "administrative_area" : "", "country_region" : "USA", "locality" : "", "postal_code" : "", "sublocality" : "" }, "birthdate" : { "day" : 12, "month" : 8, "year" : 1987 }, "created_at" : "2025-04-06T22:54:21.810263+00:00", "name" : { "first" : "Dingus", "middle" : "A.", "surname" : "Dangus" }, "patient_id" : "a6115489-91b0-4ae7-a453-14a5fe2f6f51" }}
List Patient Records
This example returns all records where the patient record’s first_name
is Dingus. If you supply no query the service returns all records.
curl -s --request GET \--url http://127.0.0.1:3000/v1/patient?first_name="Dingus" \--header "Content-Type: application/json" \--header "Authorization: Bearer $TOKEN" | jq .
{ "patients": [ { "patient_id": "c8b54270-f2c7-4894-b21b-a00bc0b402ed", "created_at": "2025-04-02T03:52:18.190649+00:00", "name": { "first": "Dingus", "middle": "A.", "surname": "Dangus" }, "address": { "address_lines": [ "123 Thunder St", "ste 1300" ], "sublocality": "", "locality": "", "administrative_area": "", "postal_code": "", "country_region": "USA" }, "birthdate": { "day": 12, "month": 8, "year": 1987 } } ]}
Updates A Patient Record
This example updates a specified patient record to change the US state and postal code in the patient’s address. You can clear out a field by issuing an empty string for the field. You can update all fields but name.first, name.last, and birthdate.
curl -s --request PATCH \--url http://127.0.0.1:3000/v1/patient/e4cce44f-c0e1-4186-ae60-176d2f3294f1 \--header "Content-Type: application/json" \--header "Authorization: Bearer $TOKEN" \--data '{ "name": { "first": "Brian" }, "address": { "administrative_area": "AK", "postal_code": "97216" }}' | jq .
{ "data": { "patient_id": "e4cce44f-c0e1-4186-ae60-176d2f3294f1", "created_at": "2025-04-25 00:02:51.961667 UTC", "name": { "first": "Bobson", "middle": "", "surname": "Dugnutt" }, "address": { "address_lines": [ "311 Lightning St", "ste 1300" ], "sublocality": "", "locality": "", "administrative_area": "OR", "postal_code": "97217", "country_region": "USA" }, "birthdate": { "day": 8, "month": 10, "year": 1968 } }}
Delete A Patient Record
This example deletes a specified patient record. The service returns the deleted patient record.
curl -s --request DELETE \--url http://127.0.0.1:3000/v1/patient/5a32e01a-41b3-45d0-ac8b-9345b5f835c7 \--header "Content-Type: application/json" \--header "Authorization: Bearer $TOKEN" | jq .
{ "data": { "patient_id": "5a32e01a-41b3-45d0-ac8b-9345b5f835c7", "created_at": "2025-04-25T00:03:04.069967+00:00", "name": { "first": "Bobson", "middle": "", "surname": "Dugnutt" }, "address": { "address_lines": [ "311 Lightning St", "ste 1300" ], "sublocality": "", "locality": "", "administrative_area": "", "postal_code": "97217", "country_region": "USA" }, "birthdate": { "day": 8, "month": 10, "year": 1967 } }}