Thursday, May 26, 2022

How to set Environment Variables in Postman?

Setting Environment Variable in Postman avoid manually setting the variable values for subsequent API Calls.
 
1. pm.environment.set() can be used to set Environment Variable in Postman. Code should be used under Tests tab.
 
Sample Code:
let jsonData = JSON.parse( responseBody );
pm.environment.set(“loginId”, jsonData.login);
pm.environment.set(“URL”, jsonData.url);
pm.environment.set(“nodeId”, jsonData.node_id);

2. Once the request is sent. We can check the variable values in the Environment.

No comments:

Post a Comment

Reset Logitech Circle View Camera

Remove the doorbell. Hold down the power button. Plug it into USB power. Make sure the hold the power button when you plugin. Continue hol...