Posts

Showing posts from September, 2021

Generate Google, Outlook Calendar events links

We had a requirement to save calendar events with out downloading of ICS file and save events into the customer's email client calendar directly. This requirement seems hard, but the email clients had calendar API and can have links targeted to call the right API to make this happen. The below APP provides links and can be included in an email to the customer to save events into the calendar.   https://www.labnol.org/apps/calendar.html

Initialize postman variables using Pre-request script

Image
 Often times we need to set postman variables before call API and API requests may use other API responses. Postman offers a pre-request script section that can be used to initialize postman variables. In the below request, I require to send a mfa-token as part of the header to consume API, but mfa-token is not a static one to hardcode in postman global variables. I had get this for each request to get updated mfa-token from other API. This can be achieved through pre-request script to set dynamic values. Set mfa-token variable through pre-request script by consuming another API response -  Text out of Image - const   reqObject   =  {   url:  'http://internalUrl/authentication/mfa-token' ,   method:  'GET' ,   header: { 'channel' : 'customer' } }; pm .sendRequest( reqObject , ( err ,  res )  =>  {      token   =   res .json()      console . log ( `fetched token ${ token . tokenValue }` )      pm . environment . set ( "mfa-token" ,  token . t