- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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 − https://www.amazon.com/ 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 − https://www.amazon.in/your-account
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.
- Related Articles
- How to Share Session ID across Different Requests in Postman?
- How to set cookie value with AJAX request in JavaScript?
- Creating Variables using Pre Request Script using Postman?
- How to see request logs in Postman console?
- How to use Global Variable in Postman Request?
- How to create a PUT request in Postman?
- How to create a DELETE request in Postman?
- How to create a POST request in Postman?
- How to set Multiple Tests for a Request in Postman with JavaScript Method?
- Running the collection using Newman through share link in Postman
- What is Pre-Request Script in Postman?
- How can I get Webdriver Session ID in Selenium?
- How to set a cookie and get a cookie with JavaScript?
- How to read a cookie using JavaScript?
- How to get username using ID from another table in MySQL database?
