Session in POSTMAN

A session is nothing but a temporary layer that holds variable values that are useful for the currently working instance and are local to your individual scope. In POSTMAN you have the facility of changing the value of the session variable and your work can be shared among your teammates without the need for sharing the values of the session variables.

POSTMAN allows you to share the session locally and even when you share the collection with the teammates, the sessions are not shared. When teamwork is carried out, then there are different tokens that have to be generated by the concerned company.

Now, these tokens are generated by the company after the Oath 2.0 Authorization by accepting the client-id or any personal-id. Therefore, this session contains confidential values that should not be shared with the team members even.

The different reasons for which sessions are useful are below :

  • The values of the session variables can be changed directly without any concern, as POSTMAN by default will never share the data to any server or will not sync the current value of the sessions to the server.
  • The current and initial values can be changed separately. But the change in the values may change the variable definition and may create a problem. It is, therefore, advisable that any changes required should be made to the current value and not in the initial value.
  • While using sessions, one may engage himself in collaborative teamwork with his/her own values, IDs, passwords, access/secure tokens. etc. Any other private credentials are safe to be used in such works, within the workspace.
  • There are different tools offered by sessions to developers, with a secure and interface. Also, different information and features are provided which the developers may require to proceed further while using sessions.

Postman Tutorial

Using Session in POSTMAN

A session is a local instance to a user in a workspace where the user can modify variables and it is made sure in POSTMAN, that data the user works with will not be synced with the server.

A session in POSTMAN holds the global variables, environment variables, and global variables. When CURD(Create Update Read Delete) operations are involved, the session is really easier to handle.

Assigning the current value to the variable:

This can be done in the two following ways:

  • Editing Collection Variables.
  • Editing Environment Variables and global variables.
Editing Collection Variables:

To assign a current value, click the three-dot (...) option which is beside the collection name. And then select Edit.

After clicking the Edit option, you will see a window for editing your collection. There are various options such as Descriptions, Authorizations, Pre-request Scripts, Tests, Variables, etc.

Select the option Variables. Inside that, you will get different values like:

Now, here you will be set your new variable name, the initial value, and the current value. For example, the variable name is Token1 and the value in the current section can be a token value like: 7ff5bbawy783rt9eiurv94.

As shown in the above image, the current value is used in the local only. Also in POSTMAN, you will be able to change or replace the initial value with the current value. It should be noted that the current values are never synchronized with the POSTMAN's server. Also, the shared data like the initial value remains intact until and unless you use the Persist option to explicitly sync with the POSTMAN's server or any other server.

The current values are not synced with the server and do not affect the other collaborations while working in a team under the same workspace.

Let us create five different variables : Token1, Token2, Token3, Token4, and Token5. We shall initialize five different values into these tokens just for the sake of explanation.

As shown in the above image, we have declared five variables: Token1, Token2, Token3, Token4, and Token5. Now the variables, are assigned with an initial value and a current value. Now, as you can see in the above image, in the top right corner, there is an option called Persist All.

The Persist All button will work only when the values are selected. As in our cases, in the above image, Persist All will work as none of the variables are selected.

Postman Interview Questions

0 results
Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions