HAPI FHIR Server

update-type: Update a new AllergyIntolerance instance

Update AllergyIntolerance Record

The Update AllergyIntolerance method allows you to modify an existing allergy or intolerance record for a patient. This is useful for updating allergy status, severity, reaction details, or verification status as new clinical information becomes available.

Endpoint

PUT /fhir/R4/AllergyIntolerance/{id}

Required Headers

Authorization: Bearer {access_token}
Accept: application/fhir+json
Content-Type: application/fhir+json

Path Parameters

Parameter Type Required Description
id string Yes The unique identifier of the allergy record to update.

Request Body Parameters

Parameter Type Required Description
clinicalStatus CodeableConcept No Indicates whether the allergy is active, inactive, or resolved.
verificationStatus CodeableConcept No Whether the allergy is confirmed or refuted.
type string No Defines if the reaction is an allergy or intolerance.
category array No Category of the allergen (e.g., medication, food, environment).
code CodeableConcept No The substance that triggers the reaction.
patient Reference No Reference to the patient associated with the allergy.
reaction array No Details about symptoms and severity.
recordedDate dateTime No The date the allergy was recorded.
recorder Reference No Who documented the allergy.

Example Request (Java)

import java.net.HttpURLConnection;
import java.net.URL;
import java.io.OutputStream;

public class AllergyIntoleranceUpdate {
    public static void main(String[] args) throws Exception {
        String apiUrl = "https://api.healthgorilla.com/fhir/R4/AllergyIntolerance/98765";
        URL url = new URL(apiUrl);
        HttpURLConnection conn = (HttpURLConnection) url.openConnection();
        conn.setRequestMethod("PUT");
        conn.setRequestProperty("Authorization", "Bearer your_access_token");
        conn.setRequestProperty("Content-Type", "application/fhir+json");
        conn.setDoOutput(true);

        String jsonInputString = "{\\\"resourceType\\\": \\\"AllergyIntolerance\\\", \\\"id\\\": \\\"98765\\\", \\\"clinicalStatus\\\": {\\\"coding\\\": [{\\\"system\\\": \\\"http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical\\\", \\\"code\\\": \\\"inactive\\\"}]}, \\\"code\\\": {\\\"coding\\\": [{\\\"system\\\": \\\"http://www.nlm.nih.gov/research/umls/rxnorm\\\", \\\"code\\\": \\\"2670\\\", \\\"display\\\": \\\"Penicillin\\\"}]}, \\\"patient\\\": {\\\"reference\\\": \\\"Patient/67890\\\"}}";

        try (OutputStream os = conn.getOutputStream()) {
            byte[] input = jsonInputString.getBytes("utf-8");
            os.write(input, 0, input.length);
        }

        int responseCode = conn.getResponseCode();
        System.out.println("Response Code: " + responseCode);
    }
}

Example Response

{
  "resourceType": "AllergyIntolerance",
  "id": "98765",
  "clinicalStatus": {
    "coding": [{
      "system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical",
      "code": "inactive",
      "display": "Inactive"
    }]
  },
  "code": {
    "coding": [{
      "system": "http://www.nlm.nih.gov/research/umls/rxnorm",
      "code": "2670",
      "display": "Penicillin"
    }]
  },
  "patient": {
    "reference": "Patient/67890"
  },
  "recordedDate": "2024-02-18T12:00:00Z"
}

Additional Resources

put
http://localhost:8080/fhir/R4/AllergyIntolerance/{id}

Path Parameters

idstringrequired

The resource ID

>= 1

Example:123

Body

FHIR-JSON-RESOURCE

FHIR-JSON-RESOURCEobject

A FHIR resource

Response

200

Success

FHIR-JSON-RESOURCE

FHIR-JSON-RESOURCEobject

A FHIR resource

put/AllergyIntolerance/{id}

Body

{
  "resourceType": "AllergyIntolerance"
}
{ "resourceType": "AllergyIntolerance" }
 
curl --request PUT \
  --url http://localhost:8080/fhir/R4/AllergyIntolerance/123 \
  --header 'Accept: application/fhir+json, application/fhir+xml' \
  --header 'Authorization: Bearer ' \
  --header 'Content-Type: application/fhir+json' \
  --data '{
  "resourceType": "AllergyIntolerance"
}'
200
{}