Skip to main content

Installing and Configuring a FHIR Server

The Management Portal provides a Server Configuration page that allows you to install a new FHIR® server and then configure it. Alternatively, you can install and configure a server programmatically.

The FHIR server must be installed in a Foundation namespace; multiple FHIR servers can be installed in the same Foundation namespace.


Before installing a FHIR server, you must consider whether you want to customize it now or in the future. In many cases, a FHIR server using the Resource Repository cannot be customized unless you subclass the InteractionsStrategy before creating the endpoint. For example, modifying how bundles are processed or post-processing search results requires you to subclass the Resource Repository. For information about preparing for these customizations before installing the FHIR server, see Pre-Installation Subclassing.

To install a new FHIR server from the Management Portal:

  1. Open the Management Portal and switch to the Foundation namespace where you want the FHIR server installed. If you do not have a Foundation namespace, go to Health, and select Installer Wizard from the top menu bar. The Configure Foundation button allows you to create a new Foundation namespace. Be sure to activate the namespace after creating it.

  2. Navigate to Health > MyNamespace > FHIR Configuration. If you do not see the FHIR Configuration menu, make sure you are using a Foundation namespace.

  3. Select the Server Configuration card.

  4. In the Endpoints pane, click Add Endpoint to create a new FHIR Endpoint.

  5. Select a core FHIR package. Each package corresponds to a version of the FHIR standard which the endpoint will support. So, for example, to configure a FHIR endpoint that supports FHIR R4, select the hl7.fhir.r4.core@4.0.1 package.

  6. Review the endpoint URL that has been autogenerated according to your choice of the core FHIR package. You can change the endpoint’s URL, but ensure that it begins with a slash (/).

  7. If you want the endpoint to support additional packages, select them from the Additional Packages drop-down list. For more information about packages, see Profiles and FHIR Adaptations.

  8. Select the InteractionsStrategy for the endpoint. The default interactions strategy is the Resource Repository (HS.FHIRServer.Storage.Json.InteractionsStrategy), which stores FHIR data as JSON in dynamic objects. If you created a custom InteractionsStrategy, select it from the list.

  9. By default, data for each endpoint in a namespace is stored in two separate databases. If you do not want to maintain separate databases, clear the Use separate databases for FHIR resource storage field; in this case, all FHIR data is stored in the namespace’s common database files. If you use separate databases. you can accept the default locations or specify your own. The Resource History database contains previous versions of a resource; because these are not accessed as frequently, you could put this database on a slower, less expensive disk.

  10. Select Add.

If you prefer to use a command-line interface to install a FHIR server, see Command Line Options.

Configuring a FHIR Server

Once you have installed a FHIR server, you can configure its settings using the Server Configuration page of the Management Portal. These configuration settings can also be modified programmatically by setting the properties of the server’s ConfigData object.

To configure the FHIR server:

  1. Navigate to Health > MyNamespace > FHIR Configuration. Make sure you are in the FHIR server’s namespace.

  2. Select the Server Configuration card.

  3. Choose the endpoint of the FHIR server that you are configuring.

  4. When the page expands, scroll down and select the Edit button.

  5. Configure the settings, using the following descriptions as a guide.

Setting Description
Enabled Specify whether the endpoint is enabled. A disabled endpoint rejects requests from FHIR clients.
Default Search Page Size Search result page size to use when a search does not contain a _count parameter.
Max Search Page Size Maximum search result page size to prevent an excessive user-specified page size.
Max Search Results Maximum number of resources that can be selected by a search before the server responds to the query with an error. This number only includes resources selected by the actual search; it does not include resources included via an _include search parameter. This value does not affect the size of pages returned by a search. Overly broad searches that select large numbers of resources take a lot of system resources to fulfill, and are probably more broad than the client actually needs.
Max Conditional Delete Results Maximum allowable number of resources to delete via conditional delete. If the conditional delete search finds more than this number of resources, then the conditional delete as a whole is rejected with an HTTP 412 Precondition Failed error.
FHIR Session Timeout Maximum number of seconds between requests to the service before any session data is considered stale.
Default Prefer Handling Specifies what happens by default when a search request contains an unknown parameter. Specify lenient to ignore the unknown parameter and return a bundle in which the OperationOutcome resource identifies the issue. Specify strict to reject the search request and return an error. A FHIR search request that includes the prefer headerOpens in a new tab overrides this default.
OAuth Client Name Specifies the application name that the FHIR server, as an OAuth resource server, uses to contact the OAuth 2.0 authorization server when needed. For more information about OAuth 2.0 support, see OAuth 2.0 Authorization.
Required Resource If you specify an InterSystems security resource, FHIR clients must have privileges to the resource to perform interactions on the server. For more information, see Adding Authorization Requirements.
Service Config Name To route FHIR requests through an interoperability production before reaching the FHIR server, enter the package and name of the business service that will receive the requests. Unless the business service has a custom name, this entry is HS.FHIRServer.Interop.Service. For more details, see Interoperability Productions.
Allow Unauthenticated Access Allows all FHIR requests to reach the server, ignoring authentication and authorization strategies.
New Service Instance Instantiates a new Service object for every FHIR request.
Include Tracebacks The FHIR server responds to a FHIR request by sending a stack trace in an OperationOutcome resource.
SMART on FHIR Capabilities A comma-delimited list of the endpoint’s SMART on FHIR capabilities. This list does not control the functionality of the endpoint; rather, it specifies the capabilities that are returned in the JSON document when a client appends /.well-known/smart-configuration to the endpoint’s URL. For more details about SMART on FHIR capabilities retrieved with Well-Known URIs, see FHIR Authorization Endpoint and Capabilities Discovery using a Well-Known Uniform Resource Identifiers (URIs)Opens in a new tab.

If you prefer to use a command-line interface to configure a FHIR server, see Command Line Options.

Deleting a FHIR Endpoint

By default, using the Management Portal to delete an FHIR server endpoint also deletes the FHIR data associated with the endpoint. However, if you want to delete an endpoint but retain all of its FHIR data, you can use the command line interface to decommission the endpoint rather than delete it. For more information about using the command line interface to decommission an endpoint, see Command Line Options.

To delete an endpoint:

  1. Navigate to Health > MyNamespace > FHIR Configuration. Make sure you are in the FHIR server’s namespace.

  2. Select the Server Configuration card.

  3. Choose the endpoint that you are deleting.

  4. Select the Trash Can icon.

Installing Programmatically

For applications that need to install a FHIR server programmatically rather than using the Management Portal, the server must be installed first, then configured.

The FHIR server must run in a foundation namespace, therefore creating a foundation namespace is a prerequisite to installing the FHIR server. Once you have a foundation namespace, the following methods of HS.FHIRServer.InstallerOpens in a new tab must be called in order:

HS.FHIRServer.Installer method Description
InstallNamespace()Opens in a new tab Prepares an existing foundation namespace for the FHIR server; it does not create a new foundation namespace. If called without an argument, the installer assumes the active namespace is a foundation namespace and prepares it for the FHIR server.
InstallInstance()Opens in a new tab Installs an instance of a FHIR Service into the current namespace. This method requires the following arguments:
  • Unique URL of the FHIR endpoint. Be sure the URL begins with a slash (/).

  • Classname of the FHIR server’s InteractionsStrategy.

  • List of FHIR packages, for example, the package for an Implementation Guide like US Core. For details, see pPackageList parameter.

There are also optional parameters that can be passed toInstallInstance(). For complete details on these optional parameters, see InstallInstance()Opens in a new tab

pPackageList Parameter

The pPackageList parameter of the InstallInstance()Opens in a new tab method accepts a list of FHIR packages that have been loaded into the system. Often, a package corresponds to a specific Implementation Guide, but can also be the core metadata for a version of FHIR. By passing a list of packages to InstallInstance, you can configure an endpoint to support one or more packages. For more about packages, see Profiles and FHIR Adaptations

To obtain a list of the packages that can be passed into the pPackageList parameter, use the HS.FHIRMeta.Storage.Package.GetAllPackages()Opens in a new tab method. For example, the following code displays the identifiers of the available packages

set packages = ##class(HS.FHIRMeta.Storage.Package).GetAllPackages()
for i=1:1:packages.Count()
  { write packages.GetAt(i).id,! }

The result might look like:


You could then pass in some of these package identifiers as arguments to the pPackageList parameter using $lb. For example:

Do ##class(HS.FHIRServer.Installer).InstallInstance(myURL,

For details about the APIs used to create FHIR packages, see Package APIs.

Programmatic Install Example

The following ObjectScript code example installs a FHIR server that supports two packages and uses the default storage strategy (Resource Repository).

Set appKey = "/myfhirserver/fhir/r4"
Set strategyClass = "HS.FHIRServer.Storage.Json.InteractionsStrategy"
Set metadataPackages = $lb("hl7.fhir.r4.core@4.0.1","")

//Install a Foundation namespace and change to it
Do ##class(HS.HC.Util.Installer).InstallFoundation("FHIRNamespace")
Set $namespace = "FHIRNamespace"

// Install elements that are required for a FHIR-enabled namespace
Do ##class(HS.FHIRServer.Installer).InstallNamespace()

// Install an instance of a FHIR Service into the current namespace
Do ##class(HS.FHIRServer.Installer).InstallInstance(appKey, strategyClass, metadataPackages)

Configuring Programmatically

Once you have installed a FHIR server, it can be configured programmatically using the HS.FHIRServer.Installer.UpdateInstance()Opens in a new tab method. This method accepts several arguments that configure the server, including one that accepts the server’s HS.FHIRServer.API.ConfigData object, which contains most of the server’s configuration options. For a list of these configuration options, see the class referenceOpens in a new tab. In addition to the options defined with the ConfigData object, a few of the server’s settings (Service Config Name, OAuth Client Name, and Enabled) are specified using a dedicated parameter of the UpdateInstance() method.

The following code configures an existing FHIR server using the UpdateInstance() method.

Set appKey = "/fhirendpoint/r4"

//Get and modify FHIR server's configuration object
Set strategy = ##class(HS.FHIRServer.API.InteractionsStrategy).GetStrategyForEndpoint(appKey)
Set configData = strategy.GetServiceConfigData()
Set configData.DefaultPreferHandling = "strict"
Set configData.DebugMode = 1
//stringify configData before updating FHIR Server
Set jsonConfigData = configData.AsJSONString()

// Define additional settings
Set enabled = 1
Set serviceConfigName = "HS.InteropPackage.myBusinessService"
Set oAuthClient = "OAuthClientName"

// Update FHIR Server
Do ##class(HS.FHIRServer.Installer).UpdateInstance(appKey, jsonConfigData, enabled, serviceConfigName, oAuthClient) 

Command Line Options

Developers who prefer a command line interface to the Management Portal can use Console Setup in the InterSystems Terminal to perform many of the same actions that are available in the user interface. To run the Console Setup, open the InterSystems Terminal and run:

do ##class(HS.FHIRServer.ConsoleSetup).Setup()

The following sections describe each option that is available in the Console Setup.

Create FHIRServer Endpoint

Installs a new FHIR server endpoint. You are presented with the following prompts:

  • Choose the Storage StrategyJson is the Resource Repository.

  • Choose the FHIR version for this endpoint — Select the version of the core FHIR specification that your endpoint supports.

  • Enter any package numbers — Packages that have been imported are listed as possibilities. The endpoint can support multiple packages; to specify more than one package, separate the numbers by commas. You can add additional packages later, but you might need to run additional steps if you wait. Use the Upload a FHIR Metadata Package option to add a package to the list.

  • Do you want to create the default repository endpoint — Press Enter if you want to accept the default URL of the endpoint. If you want your endpoint to have a different URL, specify N, and enter the URL (be sure the URL begins with a slash).

  • Enter the OAuth Client Name for this Endpoint — If you are using OAuth 2.0 to secure the endpoint, enter the Client Name of the FHIR server. For more information, see OAuth 2.0 Authorization.

  • Do you want to create separate database files for your FHIR data? — If you specify yes, FHIR data for the endpoint is stored separately from the FHIR data of other endpoints in the same namespace. If you specify no, all FHIR data is stored in the namespace’s database files, even if you have multiple endpoints. If you are creating separate database files, you can accept the default locations or specify alternate locations. The Versions Database contains previous versions of a resource; because these are not accessed as frequently, you could put the Versions Database on a slower, less expensive disk.

Add a profile package to an endpoint

Adds a FHIR package to an existing endpoint so it can support the package’s profiles, search parameters, and other conformance resources. The FHIR package (an NPM-like package) that contains the conformance resources must be uploaded before you can use this option. You can use the Upload a FHIR Metadata Package option to import the FHIR package. Some common packages, for example the US Core Implementation Guide, are already available.

If the package contains new search parameters, you must run the Index new SearchParameters for an Endpoint option when you are done.

Display a FHIRServer Endpoint Configuration

Displays the current configuration options of the FHIR server. To modify these configuration options, use the Configure a FHIRServer Endpoint option.

Configure a FHIRServer Endpoint

Allows you to configure the FHIR server endpoint by providing values for each configuration option. For a description of each configuration item, see Configuring a FHIR Server.

Decommission a FHIRServer Endpoint

Deletes a FHIR server endpoint, but retains the FHIR data that has been collected by the endpoint. The SQL tables containing the FHIR data are retained. If you want to delete the endpoint and all of the FHIR data, use the Delete a FHIRServer Endpoint option.

Delete a FHIRServer Endpoint

Deletes a FHIR server endpoint and deletes the endpoint’s FHIR data. If you want to delete the endpoint, but retain the FHIR data that has been collected by the endpoint, use the Decommission a FHIRServer Endpoint option.

Update the CapabilityStatement Resource

Updates the Capability Statement of the FHIR server. For more details, see Modifying the Capability Statement.

Index new SearchParameters for an Endpoint

When you add new search parameters to an existing endpoint using a published or custom package, FHIR clients can use the new parameter to retrieve resources added to the repository after you applied the package. However, resources that existed before you added the new search parameter will not be returned until you re-index the endpoint. If an endpoint has collected a large volume of FHIR data, this option can take a long time to run as it re-processes all existing resources.

Upload a FHIR metadata package

Used to import a FHIR package of JSON files that define conformance resources. You must use this option before the package can be applied to an endpoint. For information about preparing a custom FHIR package for uploading, see Creating a Custom Package.

Delete a FHIR metadata package

Deletes a package from the list of available packages that can be applied to an endpoint. This does not delete the FHIR package’s JSON files from your local system. You cannot delete packages that have been applied to an endpoint.

FeedbackOpens in a new tab