HAPI FHIR Server

search-type: Search a new AllergyIntolerance instance

Search AllergyIntolerance Record

The Search AllergyIntolerance method allows you to retrieve allergy records for a patient using various search parameters. This is useful for reviewing known allergies before prescribing medications, updating patient records, or integrating allergy data into clinical decision support systems.

Endpoint

GET /fhir/R4/AllergyIntolerance

Required Headers

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

Query Parameters

Parameter Type Required Description
patient string Yes The ID of the patient whose allergies you want to retrieve.
clinicalStatus string No Filters results based on the allergy’s clinical status (e.g., active, inactive).
verificationStatus string No Filters based on whether the allergy is confirmed or refuted.
category string No Filters by allergy category (e.g., medication, food, environment).
recordedDate date No Filters allergies recorded on or after a given date.

Example Request (Java)

import java.net.HttpURLConnection;
import java.net.URL;
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class AllergyIntoleranceSearch {
    public static void main(String[] args) throws Exception {
        String apiUrl = "https://api.healthgorilla.com/fhir/R4/AllergyIntolerance?patient=67890&clinicalStatus=active";
        URL url = new URL(apiUrl);
        HttpURLConnection conn = (HttpURLConnection) url.openConnection();
        conn.setRequestMethod("GET");
        conn.setRequestProperty("Authorization", "Bearer your_access_token");
        conn.setRequestProperty("Accept", "application/fhir+json");

        BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
        String inputLine;
        StringBuffer response = new StringBuffer();
        while ((inputLine = in.readLine()) != null) {
            response.append(inputLine);
        }
        in.close();

        System.out.println(response.toString());
    }
}

Example Response

{
  "resourceType": "Bundle",
  "type": "searchset",
  "entry": [
    {
      "resource": {
        "resourceType": "AllergyIntolerance",
        "id": "12345",
        "clinicalStatus": {
          "coding": [{
            "system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical",
            "code": "active",
            "display": "Active"
          }]
        },
        "category": ["medication"],
        "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

get
http://localhost:8080/fhir/R4/AllergyIntolerance

Query Parameters

Response

200

Success

FHIR-JSON-RESOURCE

FHIR-JSON-RESOURCEobject

A FHIR resource

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