Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

FHIR - Feel the Fire - 1


Published on

Feel FHIR by connecting FHIR test servers
Read full article at

Published in: Technology
  • Login to see the comments

FHIR - Feel the Fire - 1

  1. 1. FHIR – Feel the Fire - Part 1 Jayant Singh 1
  2. 2. Feel the FireFHIR provides very good specification on experience on any thing helpsunderstand it better.Connect FHIR test servers and explore FHIR -healthcare resources in RESTful environment. 2
  3. 3. Connect Test ServersI will discuss two approaches to connect testserverFiddlerWrite your own client (in C#)I will connect Grahames test server available at 3
  4. 4. Connect using FiddlerFiddler is simple tool which we will use tocompose requests to RESTful FHIR test serversDownload and install Fiddler from 4
  5. 5. Conformance Resource - RequestFirst step - request a conformance resource to know how anapplication or implementation supports FHIR.OPTIONS 5
  6. 6. Conformance Resource - ResponseRead the conformance carefully to understand supported FHIRresources 6
  7. 7. Patient Resource Feed - RequestGET this request we have specified “Accept” Http header to specifycontent type for this request as xml 7
  8. 8. Patient Resource Feed - Responsefeed with collection of all the patient resources. Each patientresource will be inside “entry” element.Go through each element in this xml and understand it bycomparing with definition available in specification 8
  9. 9. Patient Resource - RequestGET this request we have specified “Accept” Http header to specifycontent type for this request as json 9
  10. 10. Patient Resource - ResponsePatient ResourceGo through each element in this json and understand it bycomparing with definition available in specification 10
  11. 11. Bad RequestTry to query a resource which is not availableGET will return HTTP 404 Not Found status code 11
  12. 12. Write a Client in C#Writing your own client to query resources fromtest server will help you understand the FHIR &RESTful environment.Sample code provided here is written in C# anduses a library RestSharp to make RESTfulrequest/response. 12
  13. 13. Sample Code//create a RestClientvar client = new RestClient();//Assign base url of RESTFul Serverclient.BaseUrl = txtUri.Text.Trim();//HTTP method(GET/POST etc) to use for this requestMethod method = (Method)Enum.Parse((typeof(Method)), cmbHttpOptions.Text);//Create RestRequestvar request = new RestRequest(method);//Add header "Accept" to request xml or json data formatif (cmbContentType.Text.Equals("xml")) request.AddHeader("Accept", "application/xml");else request.AddHeader("Accept", "application/json");//resource to query like patient, patient/@1, document etc.request.Resource = txtResource.Text.Trim();//Execute the request and get responseIRestResponse response = client.Execute(request);//display the raw response headertxtResult.Text = "************Response Header***********n";for (int i = 0; i < response.Headers.Count; i++) txtResult.Text += response.Headers[i].Name + ": " + response.Headers[i].Value + "n";txtResult.Text += "StatusCode: " + response.StatusCode + "n";//display the raw response contenttxtResult.Text += "nn************Raw Content**********n"; 13txtResult.Text += response.Content;
  14. 14. Using this clientRequest Patient Resource with xml response 14
  15. 15. Using this clientRequest Document Resource with json response 15
  16. 16. ImportantTry more resource URIs on your own to exploreother resources lists all the supported resources and theirprofilesNote that these servers are testing servers. Theymay be sporadically unavailable 16
  17. 17. Thank You Jayant Singh 17