1) CURL - Command line utility that lets you make HTTP requests
2) Advanced REST Client - A Google chrome extension that lets you make HTTP requests with a nice UI.
I am going to start with the Advanced REST Client since it is easier to work with. Lets being by creating a sample Patient resource in JSON:
{
"resourceType" : "Patient",
"text" : {
"status" : "generated",
"div" : ""
},
"identifier": [{
"use" : "usual",
"label" : "MRN",
"system" : "urn:oid:0.1.2.3.4.5.6.7",
"value" : "654321"
}],
"name" : [{
"use" : "official",
"family" : ["Donald"],
"given" : ["Duck"]
}],
"gender": {
"coding" : [{
"system" : "v3/AdministrativeGender",
"code" : "M",
"display" : "Male"
}]
},
"maritalStatus" : {
"coding" : [{
"system" : "v3/MaritalStatus",
"code" : "M",
"display" : "Married"
}]
},
"birthDate": "1944-11-17",
"deceasedBoolean" : false,
"active": "true"
}
Now using Advanced REST Client, lets POST this to the publicly accessible spark server. Start up Advanced REST Client and enter the following URL:
http://spark.furore.com/fhir/Patient?_format=application%2fjson%2bfhir
Click the "POST" radio button and paste the above JSON into the "Payload" section. Change the content type to "application/json"in the combo box and then press the "Send" button. If all goes well, you should see the URL to the newly created resource in the Location response header:
You can verify that the newly created patient is in fact accessible by making a GET request for the resources URI:
Well that was amazingly easy! One thing I should mention here is that I left the text.div property empty. I believe that HTML is supposed to go there that produces a human understandable representation of this resource. I didn't bother with that for now as this is just a spike and I don't really need this functionality.
Now that we know how to create a Patient resource, we need to look at how we can search for existing ones that we can use instead of always creating a new one.
No comments:
Post a Comment