<aside> 💡 In this page we will learn how to read a resource in a FHIR server.
</aside>
The create uses HTTP GET call to the URL base URL/resource type/id where id is the ID of an existing resource on the FHIR server. The read operation fetches the most recent version of the resource being called.
For the example, we will be reading the resource of the Patient with ID 15152 that was created in the create example and was updated in the update example.
The following shows how to perform the read operation using CURL:
Method:
GET
Address:
<http://172.104.170.172:8080/fhir/Patient/15152>
<aside> 💡 This should be the expected return value when the GET call is made
</aside>
Output:
* TCP_NODELAY set
* Connected to 172.104.170.172 (172.104.170.172) port 8080 (#1)
> GET /sila-fhirserver/fhir/Patient/15152 HTTP/1.1
> Host: 172.104.170.172:8080
> User-Agent: curl/7.64.1
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Tue, 12 May 2020 07:36:52 GMT
< X-Powered-By: HAPI FHIR 3.7.0 REST Server (FHIR Server; FHIR 3.0.1/DSTU3)
< ETag: W/"2"
< Content-Location: <http://172.104.170.172:8080/sila-fhirserver/fhir/Patient/15152/_history/2>
< Last-Modified: Tue, 12 May 2020 07:29:12 GMT
< Content-Type: application/fhir+json;charset=utf-8
< Transfer-Encoding: chunked
< Server: Jetty(9.4.8.v20180619)
<
{
"resourceType": "Patient",
"id": "15152",
"meta": {
"versionId": "2",
"lastUpdated": "2020-05-12T07:29:12.146+00:00"
},
"text": {
"status": "generated",
"div": "<div xmlns=\\"<http://www.w3.org/1999/xhtml\\>"><div class=\\"hapiHeaderText\\">Jose Juan <b>DELA CRUZ </b></div><table class=\\"hapiPropertyTable\\"><tbody><tr><td>Identifier</td><td>12345</td></tr><tr><td>Address</td><td><span>123 Masipagdaw Street </span><br/><span>Quezon City </span></td></tr><tr><td>Date of birth</td><td><span>12 May 2020</span></td></tr></tbody></table></div>"
},
"identifier": [
{
"system": "Philhealth ID",
"value": "12345"
}
],
"name": [
{
"family": "dela Cruz",
"given": [
"Jose",
"Juan"
]
}
],
"gender": "male",
"birthDate": "2020-05-12",
"address": [
{
"line": [
"123 Masipagdaw Street"
],
"city": "Quezon City",
"postalCode": "1110"
}
]
* Connection #1 to host 172.104.170.172 left intact
}* Closing connection 1
Command using CURL:
curl -v GET [<http://172.104.170.172:8080/fhir/Patient/15>](<http://172.104.170.172:8080/sila-fhirserver/fhir/Patient/15152>)52