Making Requests
Fire Arrow Server exposes both a GraphQL API and a standard FHIR REST API. This guide shows you how to interact with each, starting with the simplest requests and building up to common patterns.
All examples below assume the server is running at http://localhost:8080 and that you have a valid Bearer token. If you haven't enabled authentication yet, you can omit the Authorization header for unauthenticated access.
The $me Operation
The $me endpoint returns the FHIR resource linked to the currently authenticated user. It's the quickest way to verify that your token is working and that identity resolution is configured correctly:
curl http://localhost:8080/fhir/\$me \
-H "Authorization: Bearer <your-token>"
The response will be a Patient, Practitioner, or other resource type depending on how the user's identity was resolved.
GraphQL
Fire Arrow Server's GraphQL API is available at POST /fhir/$graphql. GraphQL is ideal for mobile and web clients that need to fetch exactly the data they want in a single round trip.
Query Example
Fetch a list of patients with their names:
curl -X POST http://localhost:8080/fhir/\$graphql \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <your-token>" \
-d '{"query": "{ PatientList { id name { family given } } }"}'
Response:
{
"data": {
"PatientList": [
{
"id": "123",
"name": [{ "family": "Smith", "given": ["Jane"] }]
}
]
}
}
Read a Single Resource
curl -X POST http://localhost:8080/fhir/\$graphql \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <your-token>" \
-d '{"query": "{ Patient(id: \"123\") { id name { family given } birthDate } }"}'
Nested References
One of GraphQL's strengths is resolving references in a single query. Fetch observations with their linked patient:
curl -X POST http://localhost:8080/fhir/\$graphql \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <your-token>" \
-d '{"query": "{ ObservationList { id code { text } subject { resource { ... on Patient { name { family given } } } } } }"}'
FHIR REST API
The FHIR REST API follows the HL7 FHIR RESTful API specification. Use it for standard CRUD operations, or when your tooling expects a FHIR-compliant interface.
Search Patients
curl http://localhost:8080/fhir/Patient \
-H "Authorization: Bearer <your-token>"
Add search parameters to narrow results:
curl "http://localhost:8080/fhir/Patient?family=Smith&birthdate=1990-01-01" \
-H "Authorization: Bearer <your-token>"
Read a Single Patient
curl http://localhost:8080/fhir/Patient/123 \
-H "Authorization: Bearer <your-token>"
Create a Patient
curl -X POST http://localhost:8080/fhir/Patient \
-H "Content-Type: application/fhir+json" \
-H "Authorization: Bearer <your-token>" \
-d '{
"resourceType": "Patient",
"name": [{ "family": "Smith", "given": ["Jane"] }],
"birthDate": "1990-01-01",
"gender": "female"
}'
A successful create returns 201 Created with a Location header pointing to the new resource.
Update a Patient
curl -X PUT http://localhost:8080/fhir/Patient/123 \
-H "Content-Type: application/fhir+json" \
-H "Authorization: Bearer <your-token>" \
-d '{
"resourceType": "Patient",
"id": "123",
"name": [{ "family": "Smith", "given": ["Jane", "Marie"] }],
"birthDate": "1990-01-01",
"gender": "female"
}'
Built-In Tools
GraphQL Explorer
If the admin web UI is enabled, you can explore the GraphQL API interactively at:
http://localhost:8080/admin/graphql
The explorer provides schema documentation, auto-complete, and query history -- great for prototyping queries before integrating them into your application.
Swagger UI
The Swagger UI lets you browse every FHIR REST endpoint, inspect request/response schemas, and execute requests directly from the browser:
http://localhost:8080/fhir/swagger-ui/index.html
Generating Client Code
Fire Arrow Server exposes both a GraphQL schema and an OpenAPI specification, so you can generate type-safe client code for your application's language of choice.
From the GraphQL Schema
Use any GraphQL code generator (e.g., GraphQL Code Generator for TypeScript, Apollo Codegen for Swift/Kotlin). Point your generator at the introspection endpoint:
POST http://localhost:8080/fhir/$graphql
From the OpenAPI Spec
The OpenAPI specification is available at the Swagger UI URL. Use tools like openapi-generator to generate REST clients in dozens of languages:
openapi-generator generate \
-i http://localhost:8080/fhir/api-docs \
-g typescript-axios \
-o ./generated-client
Next Steps
You now know how to talk to Fire Arrow Server over both GraphQL and FHIR REST. From here, explore:
- Authentication -- configuring identity providers and API tokens
- Authorization -- fine-tuning access control rules
- Configuration -- the full reference for
application.yaml