Upload pdf using DocumentReference API

We would like to upload pdf document to EPIC EHR. We used document reference API (https://fhir.epic.com/interconnect-fhir-oauth/api/FHIR/STU3/DocumentReference). Its uploaded successfully but when we retrieve it as its response type is text/html, we got corrupted binary even after stripping out HTML.Do you have any such feature/API to upload pdf documents to Epic? Please let us know if any FHIR or other platform available.
Our client is going to use app orchad.

Thanks in advance.

Have you tried setting the Accept header to either FHIR JSON or XML? In general, you don’t want html back…

Hi @lloyd thanks for reply .
I am using ( https://fhir.epic.com/interconnect-fhir-oauth/api/FHIR/STU3/Binary/{ID} ) this api to retrieve the data and response type is always text/html we cannot change it .

Right. That’s the URL. You need to set an Accept header when you make the call. You should have an ability to do that in your software. If you don’t specify an Accept header, you’ll get to server default, which for some servers is non-computable HTML. So, in this case, you should set your Accept header to either “application/fhir+xml” or “application/fhir+json”.

I have tried this with accept header in postman with application/fhir+json but in content it return base64 which is of type text/html when I converted that base64 to text I received the same html which we are getting earlier from that base64 Here is the response for the same


and when I convert this content(base64) to text we are getting same html which we are getting before accept header.

You may need to reach out to open@epic.com