
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What Are Snippets in Postman
Snippets are small scripts used in Postman which are used to verify an API. These are pre-developed scripts that can be utilized directly. Thus it helps to save a good amount of time.
Snippets can be used in the Pre-request Script and Tests tabs in Postman. Navigate to the Tests tab and the SNIPPETS section should be available to the extreme right of the screen. Click on any snippet to use it in a script.
On clicking the link Get a variable, the below script gets populated in the Tests tab which can be used in our own script −
pm.variables.get("variable_key");
Navigate to the Pre-Request Script tab and the SNIPPETS section should be available to the extreme right of the screen. Click on any snippet to use it in a script.
On clicking the link Get an environment variable, the below script gets populated in the Pre-request Script tab which can be used in our own script −
pm.environment.get("variable_key");