How can I POST FHIR bundle resource in OpenMRS ?

@sashrika @harsha89
Can somebody reply with a REST end-point for POSTing a FHIR bundle? Thanks…

1 Like

Will this be helpful Also do you manage to perform a GET on any existing module? We need to check whether your module has loaded successfully. hope you are posting to localhost:8080/openmrs/ws/fhir urls

Hi @harsha89, Thanks for the reply. Yes, I’m posting to localhost:8080/openmrs/ws/fhir/ urls. I’m able to perform all the GETs **but unable to POST an Encounter **(getting 500 error “Failed to call access method”). I referred the same wiki page as suggested by you above and also

still no success!! Also for POSTing a bundle, like in HAPI FHIR we have rest end-point as http://localhost:8080/hapi-fhir-jpaserver-example/baseDstu2?_format=json, does OpenMRS supports anything similar to POST a bundle?? Sorry, didn’t really get what should I look out for on the above wiki page for this particular issue.

You should be post bundle. You should post a resource :slight_smile:

Thanks, so it’s not wise to POST a bundle rather POST a single resource ? [Any specific reason? sorry new to FHIR]

Also, could you please help me with the error which I’m facing while POSTing an encounter resource? [500 error “Failed to call access method”]. That will be a great help to me, thanks a lot :slight_smile:

Normally you are updating a resource not a bundle. Do you see any backend error logs?

Hi @harsha89, I’m unfortunately getting just a 500 error while POSTing an Encounter resource. I’ll probably pull the latest code and see whether this error gets resolved otherwise I’ll be bugging you to help me on this.

Also, I saw somewhere on a FHIR forum that it’s perfectly normal to POST a bundle resource (clubbing practitioner, patient and observation resources) hence thought it might be better to do so rather than POSTing these resources separately. Do you see a valid point to counter this point ?

Cool let me know how it with latest code. If it didn’t work I’ll test it out. :slight_smile:

Hi @harsha89, I’m finally able to resolve the Encounter resource POST error, it was related to visit typeId attribute. The system had only “outpatient” and “hospitalization” visit types. So adding an Encounter requires a visit Type attribute in Json not documented anywhere and the id of the visit has to match to the existing visit types’ ids. I wonder how can I add a new visit without using the UI, which I see is a problem for users.

Anyways, thanks a lot for your help :slight_smile:

That’s cool. Through FHIR you can do it? Or you can do it via OpenMRS administration UI? :slight_smile:

I did it through FHIR REST end-point. :slight_smile:
But do you see this Visit TypeId thing a problem while trying to use FHIR api ? I guess someone using 3rd app (using FHIR) on top of OpenMRS might not be able to resolve this… Any thoughts ??

It seems something similar to location error while POSTing patient resource.