# How can I POST FHIR bundle resource in OpenMRS ?

**URL:** <https://talk.openmrs.org/t/how-can-i-post-fhir-bundle-resource-in-openmrs/5719>\
**Category:** Ask OpenMRS\
**Created:** [April 9, 2016, 8:39am UTC](https://talk.openmrs.org/t/how-can-i-post-fhir-bundle-resource-in-openmrs/5719 "2016-04-09T08:39:23Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![aniruddh](https://talk.openmrs.org/letter_avatar/aniruddh/32/5_5575768a8748004e209b776fc1b2916d.png) [@aniruddh](https://talk.openmrs.org/u/aniruddh)\
**Post date:** [April 9, 2016, 8:39am UTC](https://talk.openmrs.org/t/how-can-i-post-fhir-bundle-resource-in-openmrs/5719/1 "2016-04-09T08:39:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![harsha89](https://talk.openmrs.org/user_avatar/talk.openmrs.org/harsha89/32/8073_2.png) [@harsha89](https://talk.openmrs.org/u/harsha89)\
**Post date:** [April 9, 2016, 10:42am UTC](https://talk.openmrs.org/t/how-can-i-post-fhir-bundle-resource-in-openmrs/5719/2 "2016-04-09T10:42:18Z")

</div>

Will this be helpful [https://wiki.openmrs.org/display/projects/Encounter+Resource](https://wiki.openmrs.org/display/projects/Encounter+Resource) 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

---

<div class="post-metadata">

**Author:** ![aniruddh](https://talk.openmrs.org/letter_avatar/aniruddh/32/5_5575768a8748004e209b776fc1b2916d.png) [@aniruddh](https://talk.openmrs.org/u/aniruddh)\
**Post date:** [April 9, 2016, 10:57am UTC](https://talk.openmrs.org/t/how-can-i-post-fhir-bundle-resource-in-openmrs/5719/3 "2016-04-09T10:57:51Z")

</div>

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

> [@FHIR Encounter, Visit, & Observation resources](https://talk.openmrs.org/t/fhir-encounter-visit-observation-resources/1781):
>
> Hi All, As part of FHIR module implementation, below display how sample Visit, Encounter and Observation modeled through FHIR Resources. Visit { "resourceType":"Encounter", "id":"29f0bd73-9047-4bca-ad46-8fbc0a271cb1", "status":"finished", "class":"inpatient", "patient":{ "reference":"Patient/dd6f7565-1691-11df-97a5-7038c432aabf", "display":"Lazaros Amutebe(Identifier:1196TS-2)" }, "period":{ "start":"2015-04-05T09:41:14", "end":"2015…

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](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.

---

<div class="post-metadata">

**Author:** ![harsha89](https://talk.openmrs.org/user_avatar/talk.openmrs.org/harsha89/32/8073_2.png) [@harsha89](https://talk.openmrs.org/u/harsha89)\
**Post date:** [April 9, 2016, 11:09am UTC](https://talk.openmrs.org/t/how-can-i-post-fhir-bundle-resource-in-openmrs/5719/4 "2016-04-09T11:09:43Z")

</div>

You should be post bundle. You should post a resource 🙂

---

<div class="post-metadata">

**Author:** ![aniruddh](https://talk.openmrs.org/letter_avatar/aniruddh/32/5_5575768a8748004e209b776fc1b2916d.png) [@aniruddh](https://talk.openmrs.org/u/aniruddh)\
**Post date:** [April 9, 2016, 11:15am UTC](https://talk.openmrs.org/t/how-can-i-post-fhir-bundle-resource-in-openmrs/5719/5 "2016-04-09T11:15:00Z")

</div>

1. 

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

1. 

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 🙂

---

<div class="post-metadata">

**Author:** ![harsha89](https://talk.openmrs.org/user_avatar/talk.openmrs.org/harsha89/32/8073_2.png) [@harsha89](https://talk.openmrs.org/u/harsha89)\
**Post date:** [April 9, 2016, 4:47pm UTC](https://talk.openmrs.org/t/how-can-i-post-fhir-bundle-resource-in-openmrs/5719/6 "2016-04-09T16:47:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![aniruddh](https://talk.openmrs.org/letter_avatar/aniruddh/32/5_5575768a8748004e209b776fc1b2916d.png) [@aniruddh](https://talk.openmrs.org/u/aniruddh)\
**Post date:** [April 10, 2016, 3:24pm UTC](https://talk.openmrs.org/t/how-can-i-post-fhir-bundle-resource-in-openmrs/5719/7 "2016-04-10T15:24:15Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![harsha89](https://talk.openmrs.org/user_avatar/talk.openmrs.org/harsha89/32/8073_2.png) [@harsha89](https://talk.openmrs.org/u/harsha89)\
**Post date:** [April 10, 2016, 3:25pm UTC](https://talk.openmrs.org/t/how-can-i-post-fhir-bundle-resource-in-openmrs/5719/8 "2016-04-10T15:25:43Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![aniruddh](https://talk.openmrs.org/letter_avatar/aniruddh/32/5_5575768a8748004e209b776fc1b2916d.png) [@aniruddh](https://talk.openmrs.org/u/aniruddh)\
**Post date:** [April 11, 2016, 5:30am UTC](https://talk.openmrs.org/t/how-can-i-post-fhir-bundle-resource-in-openmrs/5719/9 "2016-04-11T05:30:55Z")

</div>

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 🙂

---

<div class="post-metadata">

**Author:** ![harsha89](https://talk.openmrs.org/user_avatar/talk.openmrs.org/harsha89/32/8073_2.png) [@harsha89](https://talk.openmrs.org/u/harsha89)\
**Post date:** [April 11, 2016, 5:43am UTC](https://talk.openmrs.org/t/how-can-i-post-fhir-bundle-resource-in-openmrs/5719/10 "2016-04-11T05:43:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![aniruddh](https://talk.openmrs.org/letter_avatar/aniruddh/32/5_5575768a8748004e209b776fc1b2916d.png) [@aniruddh](https://talk.openmrs.org/u/aniruddh)\
**Post date:** [April 11, 2016, 5:48am UTC](https://talk.openmrs.org/t/how-can-i-post-fhir-bundle-resource-in-openmrs/5719/11 "2016-04-11T05:48:24Z")

</div>

I did it through FHIR REST end-point. 🙂  
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 ??

---

<div class="post-metadata">

**Author:** ![aniruddh](https://talk.openmrs.org/letter_avatar/aniruddh/32/5_5575768a8748004e209b776fc1b2916d.png) [@aniruddh](https://talk.openmrs.org/u/aniruddh)\
**Post date:** [April 11, 2016, 5:50am UTC](https://talk.openmrs.org/t/how-can-i-post-fhir-bundle-resource-in-openmrs/5719/12 "2016-04-11T05:50:26Z")

</div>

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