Reading a FHIR request and response
The Health Data Exchange Map (FHIR): Reading a FHIR request and response.
Now read a real FHIR exchange
You now know addresses, verbs, status codes and secure channels. This lesson puts them together. We read one FHIR request, and the response, line by line.
Ask for one Patient
Here is a real FHIR style request to a local server with made up data. The first line says what to do and where: get, the path Patient slash one two three. The server is the base. Patient is the resource type. One two three is the logical id. This is the pattern verb, base, type, id that you met in the FHIR lessons. The accept line asks for the FHIR J S O N format.
- GET /Patient/123 HTTP/1.1
- Host: localhost
- Accept: application/fhir+json
Four things to check
Now read the response in four steps. First, the status line: two hundred, O K, so the read worked. Second, the content type: application slash fhir plus json, the formal MIME type FHIR gives for J S O N resources. Third, the resource type in the body: Patient, which is the kind of record you asked for. And fourth, the id in the body: the FHIR page says a returned resource shall have an id equal to the one you asked for.
- Check 1 · The status line · 200 OK: the read worked. · check
- Check 2 · The content type · application/fhir+json. · tag
- Check 3 · The resource type · Patient: the kind you asked for. · box
- Check 4 · The id · Equals the id in the request. · key
A record that does not exist
Now ask for a patient that does not exist: id nine nine nine. The response status is four hundred and four, Not Found. The FHIR page says a get for an unknown resource returns Not Found. The body here is an operation outcome, a FHIR resource that describes a problem. It has an issue, with a severity of error, a code of not found, and a short diagnostic text. The page says a server may return an operation outcome with a four hundred or five hundred response, but is not required to.
- GET /Patient/999 HTTP/1.1
- Host: localhost
- Accept: application/fhir+json
Found and not found
Compare the two answers. When the record exists: two hundred, the Patient resource, and the id you asked for. When it does not: four hundred and four, and, in this example, an operation outcome describing the problem. The first digit of the status tells you which kind of answer you have, before you read a word of the body.
Check yourself
Pause and think. A FHIR server returns four hundred and four for a read. What does that mean? The answer: the server found no resource with that id.
- The server found no resource with that id
- The request was successful
- The server failed internally
- The client was not logged in
Keep these in mind
A read is get, base, type, id. Check the status, the content type, the resource type and the id. Four zero four means no resource with that id. And an operation outcome may describe a problem.
- A read is GET [base]/[type]/[id]
- Check the status, the content type, the resource type and the id
- 404 means no resource with that id
- An OperationOutcome may describe a problem
SNOMED CT®, LOINC®, ICD और अन्य terminologies अपने-अपने स्वामियों की संपत्ति हैं और लाइसेंस के अंतर्गत केवल शिक्षा के लिए दिखाई गई हैं। लाइसेंस और attributions