postman pre-request script?

67 views
Skip to first unread message
Assigned to aaron....@oracle.com by me

Carl Silva

unread,
Apr 15, 2021, 6:21:41 PM4/15/21
to Cerner FHIR Developers
Does anyone have an example of a postman pre-request script for the sandbox?

Carl

Aaron McGinn (Cerner)

unread,
Apr 16, 2021, 1:06:36 PM4/16/21
to Cerner FHIR Developers
Can you clarify what you mean by "pre-request script"?

-Aaron (Cerner)

Carl Silva

unread,
Apr 16, 2021, 1:47:27 PM4/16/21
to Cerner FHIR Developers
yes, i should have been more specific.  in POSTMAN there is a section called pre-request script per below.

if I could find an example, it would be awesome and i will re-post it here if i figure it out.

the idea is that it checks to see if a token exists.  if not, it creates one.  it can also check to see if it has timed out and a new one needs to be created.

this is a huge time saver when running POSTMAN to just quickly check various APIs.

any ideas?



Untitled.png

Aaron McGinn (Cerner)

unread,
Apr 16, 2021, 2:05:58 PM4/16/21
to Cerner FHIR Developers
I personally do not, but I'm sure someone in the community has something similar.

-Aaron (Cerner)

Jenni Syed (Cerner)

unread,
Apr 16, 2021, 2:38:38 PM4/16/21
to Cerner FHIR Developers
Carl,

Keep in mind that there are limits to what you can reliably automate here, and there are several requests that you may want to follow in the postman community. EG: https://community.postman.com/t/how-can-i-auto-refresh-oauth-2-0-token-once-the-token-expires/20062

The "easiest" flow to automate would be the b2b/system access workflow since there is no user interaction necessary there (make sure to follow any guidance from postman on protecting your application secrets/storing application secrets). The 3 legged OAuth 2 workflows typically require redirects and user interaction, which would benefit a lot by the issue above being resolved (or postman supporting the OAuth 2 refresh token workflows).

Regards,
Jenni

Carl Silva

unread,
Apr 16, 2021, 2:41:33 PM4/16/21
to Cerner FHIR Developers
very cool, checking it out!
Reply all
Reply to author
Forward
0 new messages