Receiving 400 Bad Request with empty body in response

2,088 views
Skip to first unread message

Jaswanth K

unread,
Jun 9, 2017, 8:53:45 AM6/9/17
to Cerner FHIR Developers
Hi Team,

I'm facing an issue while posting to DocumentReference.
I'm receiving 400 Bad Request with empty body in response
  • Issue Summary:  receiving 400 Bad Request with empty body in response when posting to DocumentReference
  • X-Request-Id : 94be1ffa12d9c9472e73da8dafe059eb
RequestObj:
method: "POST",
headers: {
           "Content-Type": "application/json+fhir",
           "Authorization": "Bearer " + this.cernerAccessTkn
         }
body:
{
resourceType: 'DocumentReference',
subject: {
reference: 'Patient/PATIENTID'
},
type: {
coding: [
{
system: 'http://loinc.org',
code: "34840-9"
}
]
},
indexed: (new Date()).toISOString(),
status: 'current',
description: "Episode Note",
docStatus: {
   coding: [
     {
       code: "preliminary"
     }
   ]
 },
context: {
   encounter: {
     reference: "Encounter/ENCOUNTERID"
   },
   period: {
     end: (new Date()).toISOString()
   }
},
content: [
   {
     attachment: {
       contentType: "application/xhtml+xml;charset=utf-8",
       data: '<html><head><title>Test CCDA</title></head><body>Hi</body></html>'
     }
   }
 ]
}

Max Philips (Cerner)

unread,
Jun 12, 2017, 10:47:03 AM6/12/17
to Cerner FHIR Developers
Hi Jaswanth,

I took a look at the logs on the 9th and I see that the request hit our check for an empty request body so we returned the 400.  You should have gotten "body:empty" as the response body.

It looks like something may be going wrong when you are generating the body for your request?  I'd double check that the request body is getting set when you create a request.

Thanks,
Max (Cerner)

Jaswanth K

unread,
Jun 13, 2017, 2:30:51 AM6/13/17
to Cerner FHIR Developers
Hi Max,

Can you please point out the error from the request object I sent in my above post ?

Jenni Syed (Cerner)

unread,
Jun 13, 2017, 11:13:25 AM6/13/17
to cerner-fhir...@googlegroups.com
Hi Jaswanth,

The json you posted above didn't make it to the server. You may want to bump up logging on your code or go into debug mode to ensure that the body of the request is getting populated.

Note: The content.attachment.data element has to be base64 encoded as well. See: http://fhir.cerner.com/millennium/dstu2/infrastructure/document-reference/#body-fields 

Also, I'm assuming the patient and encounter ids are actually populated, but removed from the example.

~ Jenni
Reply all
Reply to author
Forward
0 new messages