features
HAPI FHIR
FHIR client
Maven
Patient creation
Java client
languages
Using HAPI Java client with Aidbox FHIR Server
This example demonstrates how to use the HAPI FHIR Java client library to create a patient resource in Aidbox.
Java
Maven
Docker and Docker Compose
2. Create a Client and an Access Policy
Navigate to REST Console in Aidbox UI and execute the following requests:
POST /fhir/Client
content-type: application/json
accept: application/json
{
"secret" : " secret" ,
"grant_types" : [
" basic"
],
"id" : " basic" ,
"resourceType" : " Client"
}
POST /fhir/AccessPolicy
content-type: application/json
accept: application/json
{
"link" : [
{
"reference" : " Client/basic"
}
],
"engine" : " allow" ,
"id" : " basic-policy" ,
"resourceType" : " AccessPolicy"
}
3. Build and Run the Java Application
mvn clean compile exec:java
What the Application Does
Connects to Aidbox running on http://localhost:8080
Uses basic authentication with the basic client credentials
Creates a sample patient with:
Name: John Doe
Birth date: January 15, 1990
Gender: Male
Retrieves the created patient to verify the operation