Skip to content

Instantly share code, notes, and snippets.

@drewverlee
Created May 21, 2020 22:48
Show Gist options
  • Save drewverlee/7b4597d66eda737064bc62e645c4fa37 to your computer and use it in GitHub Desktop.
Save drewverlee/7b4597d66eda737064bc62e645c4fa37 to your computer and use it in GitHub Desktop.
#!/bin/bash
# makes an API call to breezeehr requesting patient data.
#dev
HOST="https://auth-dev.breezeehr.com"
SERVER=https://dromon:443/fhir
PATIENT_FHIR_UUID=55776ed1-2072-4d0c-b19f-a2d725aadf15
#prod
#HOST="https://auth.breezeehr.com"
#SERVER=https://fhir.breezeehr.com:443/fhir/
KEYCLOAK_URL="$HOST/auth/realms/patient-portal/protocol/openid-connect/token"
ACCESS_TOKEN=$(curl \
-s \
-d username=test-with-patient-read \
-d password=$KEYCLOAK_USER_PASSWORD \
-d client_id=patient-portal \
-d client_secret=$KEYCLOAK_CLIENT_SECRET \
-d grant_type=password \
$KEYCLOAK_URL \
| jq '.access_token')
echo $ACCESS_TOKEN
BREEZE_API_URL="$SERVER/Patient/$PATIENT_FHIR_UUID"
echo $BREEZE_API_URL
#NOTE insecure only for k8s env/not prod
curl \
--insecure \
--header "Authorization: Bearer $ACCESS_TOKEN" \
--header "Origin: https://portal.breezeehr.com" \
$BREEZE_API_URL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment