Skip to content
This repository was archived by the owner on Feb 7, 2025. It is now read-only.

Add hurl scripts for Epic/UCSD requests #1178

Merged
merged 6 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions scripts/hurl/epic/hrl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
client=
audience=https://epicproxy-np.et0502.epichosted.com/FhirProxy/oauth2/token
secret=/path/to/ucsd-epic-private-key.pem
root=$CDCTI_HOME/examples/CA/
fpath="$1"
shift

hurl \
--variable fpath=$fpath \
--file-root $root \
--variable jwt=$(jwt encode --exp='+5min' --jti $(uuidgen) --alg RS256 -k $client -i $client -s $client -a $audience --no-iat -S @$secret) \
results.hurl \
$@
10 changes: 10 additions & 0 deletions scripts/hurl/epic/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Epic/UCSD Hurl Script

## Before running the script

- Add the `client` id to `.hrl`
- Update the `secret` variable path

## Usage

`./hrl <HL7_FILE_NAME>`
18 changes: 18 additions & 0 deletions scripts/hurl/epic/results.hurl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# curl -H 'Content-Type: application/x-www-form-urlencoded' --data 'client_assertion=$(jwt encode --exp=+5min --jti $(uuidgen) --alg RS256 -k $client -i $client -s $client -a https://epicproxy-np.et0502.epichosted.com/FhirProxy/oauth2/token --no-iat -S @/path/to/ucsd-epic-private-key.pem)' --data 'client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer' --data 'grant_type=client_credentials' 'https://epicproxy-np.et0502.epichosted.com/FhirProxy/oauth2/token'
POST https://epicproxy-np.et0502.epichosted.com/FhirProxy/oauth2/token
Content-Type: application/x-www-form-urlencoded
[FormParams]
client_assertion: {{jwt}}
client_assertion_type: urn:ietf:params:oauth:client-assertion-type:jwt-bearer
grant_type: client_credentials

HTTP 200

[Captures]
token: jsonpath "$['access_token']"

# curl -H 'Content-Type: application/hl7-v2' -H 'Authorization: Bearer $token' --data-binary '@/path/to/oru.hl7' 'https://epicproxy-np.et0502.epichosted.com/CDPH_NBGS_TST/api/epic/2015/EDI/HTTP/HL7v2/910377'
POST https://epicproxy-np.et0502.epichosted.com/CDPH_NBGS_TST/api/epic/2015/EDI/HTTP/HL7v2/910377
Content-Type: application/hl7-v2
Authorization: Bearer {{token}}
file,{{fpath}};
10 changes: 4 additions & 6 deletions scripts/hurl/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@

- [hurl](https://hurl.dev/)

## ReportStream
## Available Hurl Scripts

The hurl script to send requests to ReportStream's endpoints is in [rs/](./rs/)

## CDC Intermediary

The hurl script to send requests to the CDC Intermediary's endpoints is in [ti/](./ti/)
- [ReportStream](./rs/): scripts to send requests to ReportStream's endpoints
- [CDC Intermediary](./ti/): scripts to send requests to the CDC Intermediary's endpoints
- [Epic/UCSD](./epic/): scripts to send requests to Epic endpoints for UCSD