Skip to content

REST surface (/api, /fhir)

Alongside the CQF operations, Mercury exposes a broader REST surface under /api (Mercury-native operations) and /fhir (standards-facing routes). This page covers the parts included in the free Community Edition.

Liveness and readiness checks for probes, healthchecks, and load balancers.

Terminal window
curl -fsS http://127.0.0.1:8080/api/health
curl -fsS http://127.0.0.1:8080/api/ready

Example health response:

{
"status": "UP",
"version": "<your version>",
"edition": "community",
"packs": ["core"]
}

The exact version value reflects the build you are running.

Fetch the machine-readable API description to generate clients or explore endpoints.

Terminal window
curl http://127.0.0.1:8080/api/openapi

Run an evaluation through the Mercury-native operation path (an alternative to the CQF $evaluate operation).

Terminal window
POST /api/execute
Content-Type: application/json

Request:

Terminal window
curl -X POST http://127.0.0.1:8080/api/execute \
-H "Content-Type: application/json" \
-d '{
"cql": "library Tiny version '\''1.0.0'\''\ncontext Patient\ndefine Answer: true\n",
"expression": "Answer",
"subject": "Patient/example"
}'

Response:

{
"resourceType": "Parameters",
"parameter": [
{
"name": "execute",
"part": [
{ "name": "Answer", "valueBoolean": true }
]
}
]
}

The OpenAPI spec served by your running instance remains the source of truth for your build.

Translate CQL to ELM without executing it — useful for validating that a library compiles.

Terminal window
POST /api/translate
Content-Type: application/cql

Run queries over the loaded resource corpus.

Terminal window
POST /api/query
Content-Type: application/json

Manage libraries and value sets through the /api surface (in addition to the FHIR Library CRUD under /cqf). Value sets supply the codes your measures test against.

Terminal window
# Shapes are defined in the OpenAPI spec for your build
GET /api/libraries
GET /api/valuesets

The /fhir base path hosts standards-oriented endpoints, including the capability statement:

Terminal window
curl http://127.0.0.1:8080/fhir/metadata