Skip to main content

$fhirConnectionNames

$fhirConnectionNames() -> array<string>
Compact type signature<:a<s>>
Browse categories

Availability

Community v3.1.0+
Enterprise v3.1.0+

Documentation

$fhirConnectionNames() returns the configured named FHIR connection names loaded at server startup from Named FHIR Connections.

  • Returns only connection names.
  • Does not return base URLs, credentials, authentication settings, timeouts, or FHIR versions.
  • Preserves the configured load order from the server configuration.
  • Returns [] when no named connections are configured.
  • Does not include the default server from FHIR_SERVER_BASE, because that server is not a named alternate connection.

Signature

$fhirConnectionNames() -> array<string>

Return value

An array of strings, one per configured named FHIR connection.

Examples

No named connections configured

If the server starts without any named connections, the function returns an empty array:

$fhirConnectionNames()
[]

Return the configured names

Suppose Named FHIR Connections contains:

fhir:
- name: staging
baseUrl: "https://fhir-staging.example.com/R4"
authType: BASIC
username: ${STAGING_USER}
password: ${STAGING_PASSWORD}

- name: production
baseUrl: "https://fhir-prod.example.com/R4"
authType: BASIC
username: ${PROD_USER}
password: ${PROD_PASSWORD}

Then this expression:

$fhirConnectionNames()

returns:

["staging", "production"]

Iterate through named connections dynamically

Use the returned names to switch servers dynamically in order:

$fhirConnectionNames().(
$useFhirServer($);
$search("Patient", {"_count": 5})
)

This returns an array of search results in the same order as the configured connection names.

Notes

  • Named connections are loaded once at server startup. Changing connections.yml or the inline base64 payload requires a server restart before $fhirConnectionNames() reflects the change.
  • $fhirConnectionNames() only lists names. Use $useFhirServer() to activate one of those names for subsequent FHIR client operations in the current block.

See also