How to use Sessions in Postman?



We can use sessions in Postman. To create a session the follow the below steps −

Step1 − Click on the eye icon appearing to the right upper corner of the Postman application. Then click on Edit in the Globals section.

Step2 − Enter u in the VARIABLE field. Set the INITIAL VALUE(to be synced with Team Workspace) as test123 and CURRENT VALUE(local to our Postman instance unless the changes are persisted) as Test.

Step3 − Click on the eye icon again, the Global variable u gets displayed. Now, click on the CURRENT VALUE field and update its value to Test123.

With this set up, let us consider members A and B working in a team. A creates a Collection in the team workspace which requires individual team members to input the value of the variable u.

A sets the INITIAL VALUE of u and then shares the Collection with the team along with edit permission. Now, B can set his own value for the variable u in the CURRENT VALUE field to use the API, without overwriting the INITIAL VALUE of u set by A.

While updating/adding a variable, if we click on Reset All, all the values in the CURRENT FIELD should be replaced with the values in the INITIAL FIELD within our Postman instance.

While updating/adding a variable, if we click on Persist All, all the values in the INITIAL FIELD should be replaced with the values in the CURRENT FIELD across the complete workspace for that particular Environment.


Advertisements