Question
· Apr 16, 2021

Posting a FHIR Bundle to Resource Repository

I am attempting to POST a Bundle containing a resource to an ISC-based Resource Repository. Documentation says "batch" interaction is fully supported - so I assume this is possible.

I post to the FHIR base URL, but I get the following back: " The requested URL /customfhir/r4 was not found on this server."

The bundle I use to post to create a patient resource is very simple (see below). I am using a request.method of POST because I want the Resource Repo to create a new fhir resource id.

I'm using Postman to generate the request. Other than this, I am able to successfully create, search, and read resources from the Resource Repo.

Has anyone tried this, and/or know if this is supported?

Here is the json request payload:

{
"resourceType": "Bundle",
"type": "transaction",
"entry": [
{
"request": {
"method": "POST",
"url": "Patient"
},
"resource": {
"resourceType": "Patient",
"id": "deb73381811",
"text": {
"status": "generated",
"div": "

Some narrative

"
},
"active": true,
"name": [
{
"use": "official",
"family": "Wade",
"given": [
"Dwyane",
"James"
]
}
],
"gender": "male",
"birthDate": "1974-12-25"
}
]
}

Product version: IRIS 2020.4
$ZV: IRIS for UNIX (Ubuntu Server LTS for x86-64 Containers) 2020.4 (Build 524U) Thu Oct 22 2020 13:05:03 EDT
Discussion (6)1
Log in or sign up to continue

It could also be the URL of the Patient Resource. In the REST Dispatcher XDATA Routing Map Block check the URL syntax:

Normally for FHIR REST Dispatchers you will see the routings will look like this:

<Route Url="/Patient" Method="POST" Call="PatientHandler"/>

<Route Url="/Patient/:id" Method="PUT" Call="PatientHandler"/>

In the IRIS for Health, HS.FHIRServer.resthandler the XDATA Block looks like this:

XData UrlMap
{
<Routes> <Route Url="/(.*)"   Method="GET"  Call="processRequest"/>
<Route Url="/(.*)"   Method="POST"  Call="processRequest"/>
<Route Url="/(.*)"   Method="PUT"  Call="processRequest"/>
<Route Url="/(.*)"   Method="DELETE"  Call="processRequest"/>
<Route Url="/(.*)"   Method="PATCH"  Call="processRequest"/>
<Route Url="/(.*)"   Method="HEAD"  Call="processRequest"/>
</Routes>
}

The Process Request will see that it is a Bundle and ultimately calls the class  HS.FHIRServer.DefaultBundleProcessor. The Bundle processor will analyze the entries in the Bundle, it looks at the Entries in the Bundle to check if there are any dependencies for Entries where the request Method is POST.  There is comment in the code that says:

// Transaction Processing:
// 1. Map 'fullUrl' -> entry# for each POST entry
// 2. Visit all references, capture:
// References that are "search urls"
// References the target one of the 'POST' entry fullUrl values
// 3. Resolve the search urls to resource references
// 4. Resolve references for each POST result
// 5. execute other operations and return result.
 

Further on it goes the following code:

if isTransaction {
if (reqObj.method  = "POST") {
// Grab the UUID if the fullUrl is specified
Set referenceKey = ..ExtractUUID(entryObj.fullUrl)
 

It uses this for the response where it returns the 'Location' and the response Bundle will specify the entry.response.fullURL

In your example you have specified the 'url' as "Patient" 

Despite all of the rest of the code I searched through I could not find any code that checked this for a leading "/"

Ultimately each Post is then dispatched to the FHIRService which will perform the POST (Interaction="Insert") and send back the Response Status that will potentially be converted into an Operation Outcome.

It's just a hunch and I suspect that adding the "/" after R4 might have the same effect but try putting a "/" into the url i.e. "url" : "/Patient"

or you could use the property 'fullUrl' instead of 'url' and see if that makes a difference

Yours

Nigel