Batch adding resources in FHIR bundles

Multiple resources can be added to Ontoserver using the FHIR mechanism of packaging resources in a Bundle.

Bundles are POSTed to https://<authoring Ontoserver URL>:<port>/fhir with the Bundle in the body of the request. 

A client credentials token is necessary to obtain to authenticate with Ontoserver.

Client id “bundle-input” has been set up in the base authorization server configuration for this purpose but this may have been removed in your installation.

A tool free tool like Postman can be used to obtain tokens and issue requests, or they can be issued on the command line like in these example:

Request Token

curl –location –request POST ‘<!– AUTHENTICATION URL –><!–PORT–>/auth/realms/nhs-digital-terminology/protocol/openid-connect/token’ \
–header ‘Content-Type: application/x-www-form-urlencoded’ \
–data-urlencode ‘grant_type=client_credentials’ \
–data-urlencode ‘client_id=bundle-input’ \
–data-urlencode ‘client_secret=<!– CLIENT SECRET –>’

Add Batched Resources

curl –location –request POST ‘https://<!– AUTHORING ONTOSERVER URL –>:<!– PORT –>/fhir’ \
–header ‘Content-Type: application/fhir+xml’ \
–header ‘Accept: application/fhir+json’ \
–header ‘Authorization: Bearer <!–TOKEN –>’ \
–data-raw ‘<?xml version=”1.0″ encoding=”UTF-8″?>
<Bundle xmlns=”http://hl7.org/fhir” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation=”http://hl7.org/fhir/fhir-single.xsd“>
    <type value=”collection”/>  
    <entry>
        <resource>
            <!– … –>
        </resource>
    </entry>    
</Bundle>

It is only possible to do this on the Authoring version of Ontoserver, and not on the Staging or Production versions of Ontoserver.