HAPI-0287: This is the base URL of FHIR server... on Transaction Bundle Request

425 views
Skip to first unread message

Timothée Baguet

unread,
Feb 22, 2024, 7:52:43 AM2/22/24
to HAPI FHIR
Hi,

I'm using HAPI FHIR 5.7.2 with R4 context.
I've setup a simple Fhir Restful Server with a ResourceProvider for AuditEvents

I'm trying to send a transaction Bundle to this server to create multiple AuditEvents

To do so i've set up a simple IGenericClient

String auditServerRootUri = new StringBuilder()

.append("https://")

.append(serverProperties.getHost())

.append(":")

.append(serverProperties.getPort())

.append("/fhir")

.toString();


client = ctx.newRestfulGenericClient(auditServerRootUri); Then i create a transaction bundle with an AuditEvent and i sent it to the server 

public void testFhir(AuditEvent event) {

Bundle bundle = new Bundle();

bundle.setType(Bundle.BundleType.TRANSACTION);


bundle.addEntry()

.setResource(event)

.getRequest()

.setUrl("AuditEvent")

.setMethod(Bundle.HTTPVerb.POST);


client.transaction().withBundle(bundle).execute();

}


But the response i get from the server is a FHIR error : 
HAPI-0287: This is the base URL of FHIR server. Unable to handle this request, as it does not contain a resource type or operation name. And this is weird because if i understood correctly, Bundles are supposed to be send to the server base URI so it shouldn't be an issue +  the request does in fact contains a resource type : "resourceType":"Bundle" I've ran out of ideas so if anyone has any idea i'm all ears tanks ! 

James Agnew

unread,
Feb 22, 2024, 9:12:55 AM2/22/24
to Timothée Baguet, HAPI FHIR
You need to define a provider to actually handle the FHIR transaction operation- Just having a resource provider to deal with AuditEvent resources doesn't do it, since HAPI's plain server doesn't/can't know anything about how transaction semantics work on your server.

There's an example here: https://hapifhir.io/hapi-fhir/docs/server_plain/rest_operations.html#system_transaction - Note that you need to put this in a plain provider (ie not a provider implementing IResourceProvider) since it's a system level interaction.

Cheers,
James

--
You received this message because you are subscribed to the Google Groups "HAPI FHIR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hapi-fhir+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hapi-fhir/0455a459-d9ca-4b7b-82be-5273d5667616n%40googlegroups.com.

Timothée Baguet

unread,
Feb 22, 2024, 9:47:48 AM2/22/24
to HAPI FHIR

Thanks a lot James it worked perfectly !
Reply all
Reply to author
Forward
0 new messages