Connecting to the FHIR API

Prior to connecting to any API, your administrator should setup an Application identity and a Device identity (if not using two-way TLS).

Note: You should complete the Obtaining A Session example prior to using this tutorial.

Getting Conformance Statement

SanteDB iCDR servers can operate in a multitude of roles, as such, some FHIR resources your application uses may have been disabled by the administrator. It is a good practice to obtain the FHIR conformance statement prior to executing operations against the FHIR server. This is done by:

OPTIONS http://mpi-test.local:8080/fhir HTTP/1.1
User-Agent: Fiddler
Host: mpi-test.local:8080

The response of this will be a FHIR CapabilityStatement in XML:

HTTP/1.1 200 OK
Content-Length: 14950
Content-Type: application/fhir+xml
Content-Location: http://mpi-test.local:8080/fhirmetadata
Last-Modified: Mon, 11 Jan 2021 12:22:08 GMT
Server: Microsoft-HTTPAPI/2.0
X-PoweredBy: SanteDB v2.0.60.25971 (Montreal)
X-GeneratedOn: 2021-01-11T12:22:09.2795003-05:00
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: OPTIONS,POST,PUT,PATCH,DELETE,GET
Access-Control-Allow-Headers: Content-Type,Accept-Encoding,Content-Encoding
Date: Mon, 11 Jan 2021 17:22:09 GMT

<?xml version="1.0"?>
<CapabilityStatement xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://hl7.org/fhir">
  <text>
    <status value="generated" />

You can verify that the appropriate operations and appropriate resources are supported by the particular iCDR server deployment.

Requesting JSON Responses

You can request a JSON payload by appending the Accept: application/fhir+json to your request.

Which results in a JSON return:

Searching Data

You can locate data on the FHIR service by executing the appropriate GET operation against the requested resource, for example, to find a patient who presents an identifier of 799229340878 you could execute the following query:

Which will return the structured data for that patient in a FHIR Bundle:

Submitting Data

To submit data, you should create an HTTP POST (to create a new resource) or PUT (to update an existing resource) to the appropriate URI defined by the FHIR standard. For example, to create a new patient John Test

This will create a new patient and return the created data:

MDM Master

If you're running the iCDR in MDM mode, the returned resource will be the generated LOCAL record for this patient. The iCDR will generate a MASTER record which expressed in the refer link:

The MASTER can be retrieved by following this link. You may wish to do this to:

  • Retrieve generated data (such as a national health identifier)

  • Obtain data from other records the iCDR has matched (other candidate locals)

Last updated

Was this helpful?