How to share Session ID Cookie with another request using Postman?

We can share session id cookies with another request. To achieve this, we shall first save the cookie session id obtained by executing a request. Then, this cookie session id shall be passed as a header to the following request.

Step1 − Enter an endpoint − in the address bar and execute a GET request.

Step2 − Once a Response is received, navigate to the Cookies tab and note the value of the session-id as highlighted in the below image.

Step3 − Store the value of the session-id and set it as a Global variable with the help of the script below under the Tests tab.

var c = pm.cookies.get('session-id') pm.globals.set('session ID', c)

Step4 − The value of the Global variable - session ID shall now be reflected on clicking the eye icon to the upper right corner of the Postman application.

Step5 − Enter an endpoint −

Step6 − Add the session ID global variable and its value as a key-value pair under the Headers tad. The key should be Cookie and the value should be in the format :{{session ID}}. If we hover on the {{session ID}}, it shall reflect the SCOPE as Global and the CURRENT value which is the same as the value recorded in Step4.