Russell Bateman
June 2020
Here's my experience later after learning a few more things.
russ@gondolin /home2/FHIR/runtime $ ./fhir-server/wlp/bin/server start fhir-server Starting server fhir-server. Server fhir-server started with process ID 14422. russ@gondolin /home2/FHIR/runtime $ netstat -a | grep 14422 russ@gondolin /home2/FHIR/runtime $ netstat -tulpn | grep 14422 (Not all processes could be identified, non-owned process info will not be shown, you would have to be root to see it all.) tcp6 0 0 127.0.0.1:47919 :::* LISTEN 14422/java tcp6 0 0 :::9443 :::* LISTEN 14422/java tcp6 0 0 :::36775 :::* LISTEN 14422/java russ@gondolin /home2/FHIR/runtime $ pwdx 14422 14422: /media/home2/FHIR/runtime/fhir-server/wlp/usr/servers/fhir-server russ@gondolin /home2/FHIR/runtime $ telnet localhost 9443 Trying 127.0.0.1... Escape character is '^]'. ^CConnection closed by foreign host. russ@gondolin /home2/FHIR/runtime $ curl -k \ > -H 'Content-Type: application/json' \ > -u 'fhiruser:change-password' 'https://localhost:9443/fhir-server/api/v4/Patient' -d ' > { > "resourceType" : "Patient", > "active" : true, > "name" : [ { > "family" : "Munster", > "given" : [ "Herman" ] > } ], > "gender" : "male" > } > ' Whereupon, I went here in a browser: https://localhost:9443/fhir-server/api/v4/Patient Advanced Proceed to localhost (unsafe) fhiruser/change-password Sign in
<Bundle xmlns="http://hl7.org/fhir">
<id value="e83cc5d4-f0df-42e1-920c-2916fc9d4645"/>
<type value="searchset"/>
<total value="2"/>
<link>
<relation value="self"/>
<url value="https://localhost:9443/fhir-server/api/v4/Patient?_count=10&_page=1"/>
</link>
<entry>
<fullUrl value="https://localhost:9443/fhir-server/api/v4/Patient/21163177-49a1-44bd-b93f-d60a995f4ac6"/>
<resource>
<Patient>
<id value="21163177-49a1-44bd-b93f-d60a995f4ac6"/>
<meta>
<versionId value="1"/>
<lastUpdated value="2020-06-17T15:45:20.589Z"/>
</meta>
<active value="true"/>
<name>
<family value="Ortiz"/>
<given value="David"/>
</name>
<gender value="male"/>
</Patient>
</resource>
</entry>
<entry>
<fullUrl value="https://localhost:9443/fhir-server/api/v4/Patient/5dfe7ef4-eeac-4c53-a5df-4b3a2e2adf22"/>
<resource>
<Patient>
<id value="5dfe7ef4-eeac-4c53-a5df-4b3a2e2adf22"/>
<meta>
<versionId value="1"/>
<lastUpdated value="2020-06-26T03:48:43.478Z"/>
</meta>
<active value="true"/>
<name>
<family value="Munster"/>
<given value="Herman"/>
</name>
<gender value="male"/>
</Patient>
</resource>
</entry>
</Bundle>
This proves that my IMB fhir-server is up and running.
</> RESTED is a browser utility similar to Postman. Let's remember that, at this point, we have authenticated to the server.
GET https://localhost:9443/fhir-server/api/v4/Patient
Accept application/json
200
{
"resourceType": "Bundle",
"id": "227351d4-730b-42dd-b9b9-07b38b33e044",
"type": "searchset",
"total": 22,
"link": [
{
"relation": "self",
"url": "https://localhost:9443/fhir-server/api/v4/Patient?_count=10&_page=1"
},
{
"relation": "next",
"url": "https://localhost:9443/fhir-server/api/v4/Patient?_count=10&_page=2"
}
],
"entry": [
{
"fullUrl": "https://localhost:9443/fhir-server/api/v4/Patient/1c60c89d-9dca-4449-ae68-45823631be50",
"resource": {
"resourceType": "Patient",
"id": "1c60c89d-9dca-4449-ae68-45823631be50",
"meta": {
"versionId": "1",
"lastUpdated": "2020-06-25T22:12:28.89Z"
},
"active": true,
"name": [
{
"family": "Munster",
"given": [
"Herman"
]
}
],
"gender": "male"
}
},
...
]
}
We did this last week over and over again and so the response today is already filled by Herman Munsters with different ids.
Let's create a new patient...
POST https://localhost:9443/fhir-server/api/v4/Patient
Accept application/json
Content-Type application/json
Custom Request body
{
"resourceType" : "Patient",
"active" : true,
"name" : [ {
"family" : "Munster",
"given" : [ "Lily", "Dracula" ]
} ],
"gender" : "male"
}
201
Oddly, we never get this new patient. Changing what we'll accept back in the HTTP header, let's ask for XML:
GET https://localhost:9443/fhir-server/api/v4/Patient
Accept application/xml
200
<Bundle xmlns="http://hl7.org/fhir">
<id value="27b0345b-efff-4cdc-8371-5e040927beb4"/>
<type value="searchset"/>
<total value="22"/>
<link>
<relation value="self"/>
<url value="https://localhost:9443/fhir-server/api/v4/Patient?_count=10&_page=1"/>
</link>
<link>
<relation value="next"/>
<url value="https://localhost:9443/fhir-server/api/v4/Patient?_count=10&_page=2"/>
</link>
<entry>
<fullUrl value="https://localhost:9443/fhir-server/api/v4/Patient/1c60c89d-9dca-4449-ae68-45823631be50"/>
<resource>
<Patient>
<id value="1c60c89d-9dca-4449-ae68-45823631be50"/>
<meta>
<versionId value="1"/>
<lastUpdated value="2020-06-25T22:12:28.89Z"/>
</meta>
<active value="true"/>
<name>
<family value="Munster"/>
<given value="Herman"/>
</name>
<gender value="male"/>
</Patient>
</resource>
</entry>
...
</Bundle>
Oddly, we never get this new patient. Changing what we'll accept back in the HTTP header, let's ask for XML:
GET https://localhost:9443/fhir-server/api/v4/Patient?_count=100
Accept application/xml
200
<Bundle xmlns="http://hl7.org/fhir">
<id value="3e652b1e-ce40-43f2-b88d-6ebb6da884b6"/>
<type value="searchset"/>
<total value="5"/>
<link>
<relation value="self"/>
<url value="https://localhost:9443/fhir-server/api/v4/Patient?_count=100&_page=1"/>
</link>
<entry>
<fullUrl value="https://localhost:9443/fhir-server/api/v4/Patient/21163177-49a1-44bd-b93f-d60a995f4ac6"/>
<resource>
<Patient>
<id value="21163177-49a1-44bd-b93f-d60a995f4ac6"/>
<meta>
<versionId value="1"/>
<lastUpdated value="2020-06-17T15:45:20.589Z"/>
</meta>
<active value="true"/>
<name>
<family value="Ortiz"/>
<given value="David"/>
</name>
<gender value="male"/>
</Patient>
</resource>
</entry>
<entry>
<fullUrl value="https://localhost:9443/fhir-server/api/v4/Patient/5dfe7ef4-eeac-4c53-a5df-4b3a2e2adf22"/>
<resource>
<Patient>
<id value="5dfe7ef4-eeac-4c53-a5df-4b3a2e2adf22"/>
<meta>
<versionId value="1"/>
<lastUpdated value="2020-06-26T03:48:43.478Z"/>
</meta>
<active value="true"/>
<name>
<family value="Munster"/>
<given value="Herman"/>
</name>
<gender value="male"/>
</Patient>
</resource>
</entry>
.
.
.
<entry>
<fullUrl value="https://localhost:9443/fhir-server/api/v4/Patient/3c9b1619-e019-4d91-ad46-5b0b398b7bca"/>
<resource>
<Patient>
<id value="3c9b1619-e019-4d91-ad46-5b0b398b7bca"/>
<meta>
<versionId value="1"/>
<lastUpdated value="2020-06-26T15:25:54.115Z"/>
</meta>
<active value="true"/>
<name>
<family value="Munster"/>
<given value="Lily"/>
<given value="Dracula"/>
</name>
<gender value="female"/>
</Patient>
</resource>
</entry>
<entry>
<fullUrl value="https://localhost:9443/fhir-server/api/v4/Patient/01e7a037-176c-4347-9448-79d660215450"/>
<resource>
<Patient>
<id value="01e7a037-176c-4347-9448-79d660215450"/>
<meta>
<versionId value="1"/>
<lastUpdated value="2020-06-26T15:29:04.128Z"/>
</meta>
<active value="true"/>
<name>
<family value="Munster"/>
<given value="Marilyn"/>
</name>
<gender value="female"/>
</Patient>
</resource>
</entry>
</Bundle>
Let's look at patient Marilyn Munster alone. The RESTful API says to do this: GET [base]/[type]/[id].
GET https://localhost:9443/fhir-server/api/v4/Patient/01e7a037-176c-4347-9448-79d660215450
Accept application/xml
200
<Patient xmlns="http://hl7.org/fhir">
<id value="01e7a037-176c-4347-9448-79d660215450"/>
<meta>
<versionId value="1"/>
<lastUpdated value="2020-06-26T15:29:04.128Z"/>
</meta>
<active value="true"/>
<name>
<family value="Munster"/>
<given value="Marilyn"/>
</name>
<gender value="female"/>
</Patient>