Create Patient:- HTTP 400 Error for Patient Resource

72 views
Skip to first unread message

kaishav trehan

unread,
Jun 12, 2019, 1:51:12 PM6/12/19
to Cerner FHIR Developers
Hi,
  1. I am trying to create new patient on Secure Sandbox URL. I have the OAuth2 token to perform the write operation(my app on Developer portal has user/Patient.write). The payload to create patient was taken from URL(https://fhir.cerner.com/millennium/dstu2/individuals/patient/#example-2
  2.  I am giving the payload used for making the request. ({ "resourceType": "Patient", "identifier": [ { "assigner": { "reference": "Organization/619848" } } ], "active": true, "name": [ { "use": "official", "family": [ "Villanouva" ], "given": [ "Person", "Name" ], "period": { "start": "2010-05-17T14:54:31.000Z" } }, { "use": "usual", "given": [ "Janie" ], "period": { "start": "2012-05-22T15:45:50.000Z" } } ], "telecom": [ { "system": "phone", "value": "8168229121", "use": "home", "period": { "start": "2012-05-17T15:33:18.000Z" } } ], "gender": "male", "birthDate": "1990-09-15", "address": [ { "use": "home", "line": [ "121212 Metcalf Drive", "Apartment 403" ], "city": "Kansas City", "district": "Jackson", "state": "KS", "postalCode": "64199", "country": "United States of America", "period": { "start": "2012-05-17T15:33:18.000Z" } } ], "maritalStatus": { "coding": [ { "system": "http://hl7.org/fhir/v3/NullFlavor", "code": "UNK", "display": "Unknown" } ], "text": "Unknown" }, "communication": [ { "language": { "coding": [ { "system": "urn:ietf:bcp:47", "code": "eng", "display": "English" } ], "text": "English" }, "preferred": true } ], "careProvider": [ { "reference": "Practitioner/4594010" }, { "reference": "Practitioner/4646007" } ] })
  3. Check attachment from Postman console.

  • X-Request-Id: 379eb1b62b522144b70fe45a92d3ef77
The error is not very intuitive any help is appreciated.



Thanks
Kaishav 
Patient_Post_Error.PNG

Max Philips (Cerner)

unread,
Jun 12, 2019, 6:23:17 PM6/12/19
to Cerner FHIR Developers
Hi Kaishav,

In the example payload on fhir.cerner.com, the communication[0].language.coding[0].code is "en", and it looks like you are using "eng" in your POST body.

According to the FHIR specification, Patient.communication.language needs to be an ISO-639-1 alpha 2 code: http://hl7.org/fhir/dstu2/patient-definitions.html#Patient.communication.language

The 400 response code indicates that something about the request was invalid per the FHIR specification. A 422 will indicate something was invalid about the request per Cerner's implementation.

Thanks,
Max (Cerner)

Max Philips (Cerner)

unread,
Jun 12, 2019, 6:32:20 PM6/12/19
to Cerner FHIR Developers
Ah! Did you grab the communication body from our Body Fields table? Looks like we do have an incorrect code published there.

We will get that addressed. Thanks for bringing this to our attention.

Thanks,
Max (Cerner)

kaishav trehan

unread,
Jun 12, 2019, 10:52:29 PM6/12/19
to cerner-fhir...@googlegroups.com
Hi Max,

Thank you for looking into this, Yes i did take the request payload from fhir.cerner.com documentation.
I also did look into the post (https://groups.google.com/forum/#!msg/cerner-fhir-developers/ld6Abga46RI/-DJZbb6DAwAJ) and tried both the options 'en' and 'eng' on Patient,communication[0].language.coding[0].code. I am still getting 400 Http Error.

I am posting the curl commands with both payload below:-
  1. with 'en' -> curl -X POST https://fhir-ehr.sandboxcerner.com/dstu2/0b8a0111-e8e6-4c26-a91c-5069cbc6b1ca/Patient -H "Accept: application/json+fhir" -H "Content-Type: application/json+fhir" -H "Authorization: Bearer eyJra...<redacted>" -d '{"resourceType": "Patient","identifier": [{"assigner": {"reference": "Organization/619848"}}],"active": true,"name": [{"use": "official","family": ["Wolf"],"given": ["Person","Name"],"period": { "start": "2010-05-17T14:54:31.000Z" } }, { "use": "usual", "given": [ "Bigby" ], "period": { "start": "2012-05-22T15:45:50.000Z" } } ], "telecom": [{ "system": "phone", "value": "8168229121", "use": "home", "period": { "start": "2012-05-17T15:33:18.000Z" } }], "gender": "male", "birthDate": "1990-09-15", "address": [{ "use": "home", "line": [ "121212 Metcalf Drive", "Apartment 403" ], "city": "Kansas City", "district": "Jackson", "state": "KS", "postalCode": "64199", "country": "United States of America", "period": { "start": "2012-05-17T15:33:18.000Z" } }], "maritalStatus": { "coding": [{ "system": "http://hl7.org/fhir/v3/NullFlavor", "code": "UNK", "display": "Unknown" }], "text": "Unknown" }, "communication": [{ "language": { "coding": [{ "system": "urn:ietf:bcp:47", "code": "en", "display": "English" }], "text": "English" }, "preferred": true }], "careProvider": [{ "reference": "Practitioner/4594010" }, { "reference": "Practitioner/4646007" } ] }'
  2. with 'eng' -> curl -X POST https://fhir-ehr.sandboxcerner.com/dstu2/0b8a0111-e8e6-4c26-a91c-5069cbc6b1ca/Patient -H "Accept: application/json+fhir" -H "Content-Type: application/json+fhir" -H "Authorization: Bearer eyJra...<redacted>" -d '{"resourceType": "Patient","identifier": [{"assigner": {"reference": "Organization/619848"}}],"active": true,"name": [{"use": "official","family": ["Wolf"],"given": ["Person","Name"],"period": { "start": "2010-05-17T14:54:31.000Z" } }, { "use": "usual", "given": [ "Bigby" ], "period": { "start": "2012-05-22T15:45:50.000Z" } } ], "telecom": [{ "system": "phone", "value": "8168229121", "use": "home", "period": { "start": "2012-05-17T15:33:18.000Z" } }], "gender": "male", "birthDate": "1990-09-15", "address": [{ "use": "home", "line": [ "121212 Metcalf Drive", "Apartment 403" ], "city": "Kansas City", "district": "Jackson", "state": "KS", "postalCode": "64199", "country": "United States of America", "period": { "start": "2012-05-17T15:33:18.000Z" } }], "maritalStatus": { "coding": [{ "system": "http://hl7.org/fhir/v3/NullFlavor", "code": "UNK", "display": "Unknown" }], "text": "Unknown" }, "communication": [{ "language": { "coding": [{ "system": "urn:ietf:bcp:47", "code": "eng", "display": "English" }], "text": "English" }, "preferred": true }], "careProvider": [{ "reference": "Practitioner/4594010" }, { "reference": "Practitioner/4646007" } ] }'

Also I could not find any links on how to create a patient on fhir api, like what are the required fields in the payload. Maybe I was not looking at correct place.

Thanks
Kaishav

Benjamin Eichhorn (Cerner)

unread,
Jun 14, 2019, 9:54:44 AM6/14/19
to Cerner FHIR Developers
Hi,

As a reminder do not post Authorization tokens as this is a public group. 

In regards to your question on what is or is not required in the payload. Our fhir.cerner.com documentation lists out under each field whether or not is required. This is in the Body Fields section. 

Thanks,
Ben (Cerner)
Reply all
Reply to author
Forward
0 new messages