After having a patient go through the Flexpa Link flow, we can view their currently prescribed medications by making an HTTP request to the Flexpa API.
onSuccess callback will contain a
public_token that can be exchanged for an
access_token. This guide assumes you have an
access_token ready for use.
The resource we are going to need in this example is a MedicationRequest.
MedicationRequest.status can have many different values, including:
We can use
MedicationRequest.status to find medications currently prescribed to a
Patient, by looking for
How to search for patient medications
To search a patient's medications, we need an
access_token before we can begin. This can be obtained via the POST /link/exchange call.
access_token, we can query the Flexpa API to search for MedicationRequest's belonging to the logged in patient.
We use the wildcard parameter
$PATIENT_ID which Flexpa will convert to the actual patient ID before sending the request to the right FHIR API.
curl "https://api.flexpa.com/fhir/MedicationRequest?patient=$PATIENT_ID" \
-H "Authorization: $ACCESS_TOKEN"