0

I am trying to update one resource but the request body is bundle. I have tried to update by sending following combinations of URL:

resource_type/resource_identifier and bundle/bundle_identifier and bundle/resource_type/resource_identifier.

but none is working. I am getting error Cannot update bundle. Server is hapi server.

Is it possible to update the bundle or i will have to extract the particular resource from bundle and then update it.

  • That depends on the [bundle type](http://hl7.org/fhir/bundle-definitions.html#Bundle.type), of which there are several. What type is it? – Vadim Peretokin May 04 '20 at 12:48
  • Are you trying to perform a transaction - using a Bundle to update a resource hosted at a regular resource endpoint (e.g. Encounter or Patient) or are you wanting to replace a Bundle currently stored at a Bundle endpoint? – Lloyd McKenzie May 04 '20 at 16:50
  • @VadimPeretokin it is of txn type. – Bindu Sharma May 06 '20 at 05:59
  • @LloydMcKenzie yes i want to update a bundle. My bundle consists of following resources: Patient,AllergyIntolrence, Encounter etc. So i have update some information in AllergyIntolrence and want to update it on fhir end point. – Bindu Sharma May 06 '20 at 06:01

1 Answers1

1

Updating a Bundle wouldn't impact data on the AllergyIntolerance, Patient or Encounter endpoints, it would just change what would show up if you queried the Bundle from the Bundle endpoint. If you want to submit a Bundle that isn't stored as a Bundle but instead causes data at the other endpoints to be changed, then you need to POST a Bundle of type 'transaction' to the root endpoint (i.e. http://someServer.org/fhir rather than http://someServer.org/fhir/Bundle). The transaction Bundle would have the 'request' element present and would define what RESTful operation to perform on each resource (e.g. create/POST, update/PUT, etc.) You can see an example of a transaction request here: https://build.fhir.org/bundle-transaction.html. (Click on the syntax you prefer.)

If you want to store a Bundle and update individual resources, then you'll have to POST twice - once to the root endpoint and once to the Bundle endpoint.

Lloyd McKenzie
  • 6,345
  • 1
  • 13
  • 10
  • The base URL for your server - the part of the URL to which you would append "/Patient" vs. "/Encounter", "/Bundle", etc. if you were querying one of those resources. – Lloyd McKenzie May 07 '20 at 17:29