So having shown how to retrieve a resource from FHIR, the next step is to be able to store resources in a FHIR system (i.e. create new data).
Using the same REST based FHIR server then “create” functions are undertaken with the “POST” HTTP verb (spec).
For the purposes of this tutorial I have created an example Patient resource that we can use, it can be found here : https://gist.github.com/benbunCoder/8363926
So using Postman again, the steps are:
- Set the URL to be http://spark.furore.com/fhir/Patient/ as it is a Patient resource we are going to store
- Set the HTTP verb to “POST”
- Select the option for posting “raw” data
- Set the “mime” type to be “text/xml”
- Place the XML into the text area below where the URL is entered.
The screen should look something along the lines of
Press the “Send” button to create the resource on the system.
We need to examine the headers to see the outcome of this action, these are shown below
The first thing to note is the STATUS code of “201 Created”, this means that the operation has been successful and the resource has been created on the server. Looking at the headers we can see a line
Location → http://spark.furore.com/fhir/Patient/3166/_history/1563
This tells us the logical id for the newly created resource, in this case the logical is is 3166. The ‘_history/1563′ component of the URL is included to show the version identifier of the resource.