Solution: Create a Transaction - Advanced REST
Learn FHIR for FREE! Enroll Now!

Exercise Solution: Create a Transaction and POST it

  1. Open Postman, Create a new POST request with this URL - https://fhir-bootcamp.medblocks.com/fhir/Patient

Create a FHIR Patient Resource  Step 1

  1. In the Body Tab, Make sure you select raw and JSON, and add the following Transaction payload. You are encouranged to make changes and play around with request payload and see how the server reacts to it.
          {
              "resourceType": "Bundle",
              "type":"transaction",
              "entry":[
                  {
                      "resource":{
                          "resourceType": "Patient",
                          "name":[{
                              "given": ["Johnathan Wick"],
                              "family": "Doe"
                          }],
                          "identifier":[{
                              "system":"Doggy",
                              "value": "dont-kill-my-dog"
                          }]
                      },
                      "request": {
                          "method": "PUT",
                          "url":"Patient?identifier=dont-kill-my-dog" 
                      },
                      "fullUrl": "urn:uuid:f9b53a03-cdea-4d61-8ec3-99fffd5cc6ab"

                  },
                  {
                      "resource":{
                          "resourceType": "Observation",
                          
                          "status": "final",
                          "code": {
                              "text": "Heart Rate"
                          },
                          "valueQuantity": {
                              "value": 72,
                              "unit": "beats/minute"
                          },
                          "subject": {
                              "reference": "Patient/urn:uuid:f9b53a03-cdea-4d61-8ec3-99fffd5cc6ab"
                          }
                      },
                      "request": {
                          "method": "POST"
                      }
                  },
                  {
                      "request":{
                          "method":"GET",
                          "url":"Patient?identifier=dont-kill-my-dog"
                      }
                  }
              ]

          }   

Create a Transaction Exercise Step 2

  1. In the given Payload the Patient Johnathan Wick with Identifier dont-kill-my-dog will be created if he does not exist along with the Observation referenced to him. If he already exists in the database, only the Observation will be created referenced to him.
Build Your First Real Fhir App in 15 Days Copy

Build your first real FHIR app in 15 days

500+ builders have done it. Live kick-off, structured modules, Demo Day. $27.

Join the challenge

Comments (0)

No comments yet. Be the first to comment!