Downloading Diagnostic report Presented Form is not working

138 views
Skip to first unread message

srees...@gmail.com

unread,
Feb 27, 2018, 4:40:28 AM2/27/18
to Cerner FHIR Developers

PresentedForm in diagnostic Report entry contains URL for content type: “application/pdf. “. 

Does Cerner allow downloading of this pdf file?

I tried to download the file from following URL.  https://fhir-ehr.sandboxcerner.com/dstu2/0b8a0111-e8e6-4c26-a91c-5069cbc6b1ca/Binary/XR-5927259.


I Used following C# code. But not working.


var fileRequest = (HttpWebRequest)WebRequest.Create(https://fhir-ehr.sandboxcerner.com/dstu2/0b8a0111-e8e6-4c26-a91c-5069cbc6b1ca/Binary/XR-5927259);

fileRequest.Method = "GET";

fileRequest.Headers.Add("Authorization", "Bearer " + accessToken);

fileRequest.Accept = "application/json";

fileRequest.ContentType = "application/pdf";

HttpWebResponse fileResponse = (System.Net.HttpWebResponse)fileRequest.GetResponse();


Any help would be appreciated.

Michele Mottini

unread,
Feb 27, 2018, 7:33:02 AM2/27/18
to Cerner FHIR Developers
What error are you getting?

The 'ContentType' header is not needed - you are not sending anything, and the 'Accept' header should be 'application/pdf'

  - Michele
  CareEvolution Inc


srees...@gmail.com

unread,
Feb 28, 2018, 9:05:19 AM2/28/18
to Cerner FHIR Developers
Error got is 

The remote server returned an error: (403) Forbidden.

I tried changing accept type to  'application/pdf'.

new code used is

var fileRequest = (HttpWebRequest)WebRequest.Create(https://fhir-ehr.sandboxcerner.com/dstu2/0b8a0111-e8e6-4c26-a91c-5069cbc6b1ca/Binary/XR-5927259);

fileRequest.Method = "GET";

fileRequest.Headers.Add("Authorization""Bearer " + accessToken);

fileRequest.Accept = "application/pdf";

HttpWebResponse fileResponse = (System.Net.HttpWebResponse)fileRequest.GetResponse();

Michele Mottini

unread,
Feb 28, 2018, 11:29:35 AM2/28/18
to Cerner FHIR Developers
Maybe your app does not have the user/Binary.Read or patient/Binary.read scope?

  - Michele
  CareEvolution Inc


Jenni Syed (Cerner)

unread,
Feb 28, 2018, 12:12:17 PM2/28/18
to Cerner FHIR Developers
Michele is correct, the 403 is because there is no system/Binary.read scope associated with the token passed in.

I'm seeing a 404 after getting past that (and on the open endpoint), and we are investigating that.

~ Jenni 

Avery Allen (Cerner)

unread,
Feb 28, 2018, 2:26:36 PM2/28/18
to cerner-fhir...@googlegroups.com
It looks like the 404 that Jenni mentioned is caused because the document contains unsupported content.  We are currently investigating ways to better indicate the cause of missing content from the Binary endpoint.  In the meantime, you can read more about the constraints on the Binary resource here: 

http://fhir.cerner.com/millennium/dstu2/infrastructure/binary/

Let me know if there's anything else we can do to help.

- Avery (Cerner)

srees...@gmail.com

unread,
Mar 1, 2018, 3:05:50 AM3/1/18
to Cerner FHIR Developers
Hi,
    Even after adding system/Binary.read scope while fetching access token, I am still getting the error. We are using system account. Result from fiddler tool is given below. It is saying insufficient scope

Authorization: Bearer eyJraWQiOiIyMDE4LTAyLTI4VDIwOjExOjI0LjkzMi5lYyIsInR5cCI6IkpXVCIsImFsZyI6IkVTMjU2In0.eyJpc3MiOiJodHRwczpcL1wvYXV0aG9yaXphdGlvbi5zYW5kYm94Y2VybmVyLmNvbVwvIiwiZXhwIjoxNTE5ODkxNjgyLCJpYXQiOjE1MTk4OTEwODIsImp0aSI6IjBlZDgwZDZhLWZmZmMtNDkyYS1hYTg3LWJmZmU2ZWQzOGQ5OCIsInVybjpjZXJuZXI6YXV0aG9yaXphdGlvbjpjbGFpbXM6dmVyc2lvbjoxIjp7InZlciI6IjEuMCIsInByb2ZpbGVzIjp7InNtYXJ0LXYxIjp7ImF6cyI6InN5c3RlbVwvQmluYXJ5LnJlYWQgc3lzdGVtXC9DYXJlUGxhbi5yZWFkIHN5c3RlbVwvQ29uZGl0aW9uLnJlYWQgc3lzdGVtXC9Qcm9jZWR1cmUucmVhZCBzeXN0ZW1cL0dvYWwucmVhZCBzeXN0ZW1cL0VuY291bnRlci5yZWFkIHN5c3RlbVwvQ29udHJhY3QucmVhZCBzeXN0ZW1cL1BlcnNvbi5yZWFkIHN5c3RlbVwvUGF0aWVudC5yZWFkIHN5c3RlbVwvUHJhY3RpdGlvbmVyLnJlYWQgc3lzdGVtXC9SZWxhdGVkUGVyc29uLnJlYWQgc3lzdGVtXC9EaWFnbm9zdGljUmVwb3J0LnJlYWQgc3lzdGVtXC9BbGxlcmd5SW50b2xlcmFuY2UucmVhZCBzeXN0ZW1cL0RldmljZS5yZWFkIHN5c3RlbVwvT2JzZXJ2YXRpb24ucmVhZCBzeXN0ZW1cL01lZGljYXRpb25PcmRlci5yZWFkIHN5c3RlbVwvSW1tdW5pemF0aW9uLnJlYWQgc3lzdGVtXC9NZWRpY2F0aW9uQWRtaW5pc3RyYXRpb24ucmVhZCBzeXN0ZW1cL01lZGljYXRpb25TdGF0ZW1lbnQucmVhZCBzeXN0ZW1cL0FwcG9pbnRtZW50LnJlYWQgc3lzdGVtXC9TY2hlZHVsZS5yZWFkIHN5c3RlbVwvU2xvdC5yZWFkIn19LCJjbGllbnQiOnsibmFtZSI6IlBhdGllbnRNb25pdG9yQ2VybmVyIiwiaWQiOiI4NzEwNTAzMy03ZDk1LTQ2MmMtODRiMi02NmQ5ZTJkZjU5NDcifSwidGVuYW50IjoiMGI4YTAxMTEtZThlNi00YzI2LWE5MWMtNTA2OWNiYzZiMWNhIn19.3WvcWSxytBHOF6fFKaRsQx8Ik43sVfHk8Cg6BYrKG_fU1_A91YkbcnnnjQ1YPblJLbR8LaYhB4nsxxk-zXqUVg
Accept: application/pdf


HTTP/1.1 403 Forbidden
Date: Thu, 01 Mar 2018 07:58:07 GMT
Cache-Control: no-cache
Vary: Origin,User-Agent,Accept-Encoding
Strict-Transport-Security: max-age=631152000
Server-Response-Time: 19.19735
X-XSS-Protection: 1; mode=block
WWW-Authenticate: Bearer realm="fhir-ehr.sandboxcerner.com", error="insufficient_scope"
Pragma: no-cache
X-Request-Id: 6fe52e9ab98e001008fe65d6d37e199c
X-Frame-Options: SAMEORIGIN
X-Content-Type-Options: nosniff
Expires: Mon, 01 Jan 1990 00:00:00 GMT
Status: 403 Forbidden
Content-Length: 0
Content-Type: text/html

Avery Allen (Cerner)

unread,
Mar 1, 2018, 9:08:54 AM3/1/18
to Cerner FHIR Developers
You'll also need to add the DocumentReference.read scope to read Binary resources with the PDF Accept header.    We do have plans to extend the allowed scopes for PDF reads to also include DiagnosticReport.read, but until then you'll need to update your app's scopes to include DocumentReference.read.

- Avery (Cerner)

Cijin

unread,
Mar 2, 2018, 5:33:57 AM3/2/18
to Cerner FHIR Developers
Now am getting 404 error, so you are saying with out installing Clinical Reporting XR tools none of the pdf would be visible? is there any working sample url ? 

srees...@gmail.com

unread,
Mar 2, 2018, 8:21:36 AM3/2/18
to Cerner FHIR Developers
Hi,
    I have added DocumentReference.read scope and now I am getting 404 error. 

Jenni Syed (Cerner)

unread,
Mar 2, 2018, 10:46:17 AM3/2/18
to Cerner FHIR Developers
Hi,

Is the 404 you see for this same document in our public sandbox? Or for a different document link?

See the note in our documentation on the constraints with regards to the content of the PDF: http://fhir.cerner.com/millennium/dstu2/infrastructure/binary/

As Avery mentioned, we're trying to find a way to better indicate that this constraint was the reason for the error. Unfortunately, the URLs that may be embedded sometimes are not something we can currently expose to all users via the PDF.

~ Jenni

Avery Allen (Cerner)

unread,
Mar 2, 2018, 12:11:20 PM3/2/18
to Cerner FHIR Developers
Cijin,


If you are looking for a specific type of DiagnosticReport, let us know and we can work to get the appropriate data staged.

- Avery (Cerner) 

Cijin

unread,
Mar 5, 2018, 4:39:43 AM3/5/18
to Cerner FHIR Developers
Hello Jenni,

this is for my experimentation purpose only now, just wondering do we have any patients diagnostic report that i can download and see.

Thanks
Cijin

Jenni Syed (Cerner)

unread,
Mar 5, 2018, 1:09:59 PM3/5/18
to Cerner FHIR Developers
Hi Cijin,

The patient that Avery posted above should have documents that will work. Just change the url from the open endpoint to the secure (-open to -ehr) if you are wanting to test the authentication part.

~ Jenni
Reply all
Reply to author
Forward
0 new messages