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

Unable to view Lucidchart Shapes

When you open the Lucidchart document, it will not show all the shapes. You have to edit the document to view all the added and supported sh...