The update uses HTTP PUT call to the URL base URL/resource type/id where id is the ID of an existing resource on the FHIR server that we want to update. The call should have a content-type which should indicate the file type of the payload. Common content-type are fhir+xml and fhir+json

For the example, we will be updating the resource of the Patient with ID 15152 that was created in the create example. We will update the birthdate and add an address.

The following shows how to perform the read operation using CURL:

Request

Method:

PUT

Address:

<http://172.104.170.172:8080/fhir/Patient/15152>

Headers:

Content-type: application/fhir+json

Request (JSON):

{
  "resourceType": "Patient",
  "id": "15152",
  "identifier": [ { "system": "Philhealth ID", "value": "12345" } ],
  "name": [ {
      "family": "dela Cruz",
      "given": [ "Jose", "Juan" ]
  } ],
  "gender": "male",
  "birthDate": "2020-05-12",
  "address": [ {
      "line": [ "123 Masipagdaw Street" ],
      "city": "Quezon City",
      "postalCode": "1110"
  } ]
}

Response

<aside> 💡 This should be the expected return value when the PUT call is made

</aside>

Output:

* TCP_NODELAY set
* Connected to 172.104.170.172 (172.104.170.172) port 8080 (#0)
> PUT /sila-fhirserver/fhir/Patient/15152 HTTP/1.1
> Host: 172.104.170.172:8080
> User-Agent: curl/7.64.1
> Accept: */*
> Content-Type: application/fhir+json
> Content-Length: 358
> 
* upload completely sent off: 358 out of 358 bytes
< HTTP/1.1 200 OK
< Date: Tue, 12 May 2020 07:29:12 GMT
< X-Powered-By: HAPI FHIR 3.7.0 REST Server (FHIR Server; FHIR 3.0.1/DSTU3)
< ETag: W/"2"
< Content-Location: <http://172.104.170.172:8080/sila-fhirserver/fhir/Patient/15152/_history/2>
< Last-Modified: Tue, 12 May 2020 07:29:12 GMT
< Content-Type: application/fhir+json;charset=utf-8
< Transfer-Encoding: chunked
< Server: Jetty(9.4.8.v20180619)
< 
{
  "resourceType": "Patient",
  "id": "15152",
  "meta": {
    "versionId": "2",
    "lastUpdated": "2020-05-12T07:29:12.146+00:00"
  },
  "text": {
    "status": "generated",
    "div": "<div xmlns=\\"<http://www.w3.org/1999/xhtml\\>"><div class=\\"hapiHeaderText\\">Jose Juan <b>DELA CRUZ </b></div><table class=\\"hapiPropertyTable\\"><tbody><tr><td>Identifier</td><td>12345</td></tr><tr><td>Address</td><td><span>123 Masipagdaw Street </span><br/><span>Quezon City </span></td></tr><tr><td>Date of birth</td><td><span>12 May 2020</span></td></tr></tbody></table></div>"
  },
  "identifier": [
    {
      "system": "Philhealth ID",
      "value": "12345"
    }
  ],
  "name": [
    {
      "family": "dela Cruz",
      "given": [
        "Jose",
        "Juan"
      ]
    }
  ],
  "gender": "male",
  "birthDate": "2020-05-12",
  "address": [
    {
      "line": [
        "123 Masipagdaw Street"
      ],
      "city": "Quezon City",
      "postalCode": "1110"
    }
  ]
* Connection #0 to host 172.104.170.172 left intact
}* Closing connection 0

Command using CURL: