Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Posting Bundle of Resources using HAPI FHIR

I'm looking for help on how to post a bundle containing multiple resources to a HAPI Server. I'm running the [test server][1], and I've tried using both the Jetty server and running it as a docker container. I'm able to successfully start the server, go to the UI and post a patient directly. And I can also post a patient directly from within Postman:

POST /hapi-fhir-jpaserver/fhir/Patient HTTP/1.1
Host: localhost:8080
Content-Type: application/fhir+json
{
  "resourceType": "Patient",
  "name": [
    {
      "use": "official",
      "family": "Solo",
      "given": [
        "Han"
      ]
    }
  ]

This all works fine. However, when I try to post this:

{
  "resourceType": "Bundle",
  "type": "transaction",
  "entry": [
    {
      "resource": {
        "resourceType": "Patient",
        "name": [
          {
            "use": "official",
            "family": "Stark",
            "given": [
              "Anthony"
            ]
          }
        ]
      },
      "request": {
        "method": "PUT",
        "url": "Patient"
      }
    }
  ]
}

I receive an "OperationOutcome" error: "Unable to store a Bundle resource on this server with a Bundle.type value of: transaction"

I get this error both from the web UI and from postman. I can change the type of Bundle to something like "message", and I don't get the same error. However, when I search, while the whole Bundle has been posted, the patient inside hasn't. Does anyone know how to get the server to read the resources inside a Bundle separately from the Bundle itself?

  [1]: https://github.com/hapifhir/hapi-fhir-jpaserver-starter
like image 678
Grey Avatar asked Oct 25 '25 03:10

Grey


1 Answers

To execute a transaction or a batch, POST it to the server's 'root' endpoint, not the Bundle endpoint - so .../hapi-fhir-jpaserver/fhir, not .../hapi-fhir-jpaserver/fhir/Bundle

like image 110
Lloyd McKenzie Avatar answered Oct 27 '25 17:10

Lloyd McKenzie



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!