Introduction📪👮
Technically, API is an abbreviation for Application Programming Interface. Most large corporations have created APIs for their customers or for internal use at some point.
Postman is an Application Programming Interface (API) testing tool created in 2012 by software developer and entrepreneur Abhinav Asthana to simplify API development and testing.

In this blog, we will discuss the Cheatsheet of Postman Commands in detail. Let's start going!
Variables in Postman 🔠
Variables, like any other programming language, are simply placeholders for some value or the outcome of some expressions. The values can be stored in variables and used throughout requests, environments, collections, and scripts.
Syntax of declaring variables in Postman is:
var x = “Hello Postman”

Global Variables in Postman🌍🔠
In this part of "Cheatsheet of Postman Commands," we will discuss Global variables in Postman.
Global variables in Postman can be used in any environment and can be used to execute any request.
It can be used when data transfer to other requests is required.
Syntax of the setting of a global variable:
pm.globals.set('VariableName', Roll_No);
Syntax of the getting of a global variable:
pm.globals.get('VariableName');
Collections Variables in Postman🤓
In this part of "Cheatsheet of Postman Commands," we will discuss Collections variables in Postman.
Collections variables are environment-independent and available for all requests in a collection. It do not change while a collection or request is being executed within the given collection. It could essentially be retrieved but not modified during request execution.
Uses of Collections variables are:
- Firstly, a good substitute for global or environmental variables.
-
Secondly, for URLs / authentication credentials, if there is just one environment.
Syntax of the setting of a collection variable:
pm.collectionVariables.set('VariableName', Roll_No);
Syntax of the getting of a collection variable:
pm.collectionVariables.get('VariableName');
Environment variables in Postman
In this part of "Cheatsheet of Postman Commands," we will discuss Environment variables in Postman.
Environment variables are the most common type of variable in Postman. They are linked to a specific environment used to carry out the request. They have a greater scope than Global variables but a narrower scope than Collection variables.
Uses of Environment variables are:
- Firstly, it is used to save information about the environment.
-
Secondly, it is used for URLs, authentication credentials, and data forwarding to other requests.
Syntax of the setting of an Environment variable:
pm.environment.set('VariableName', Roll_No);
Syntax of the getting of an Environment variable:
pm.environment.get('VariableName');
Data Variables in Postman📁
In this part of "Cheatsheet of Postman Commands," we will discuss Data variables in Postman.
Data variables in Postman appear during request execution via the collection runner. It is vital to note that the source of Data variables is the user-supplied data file in JSON or CSV format. It can only be fetched but not updated/modified or added during request execution.
It is used when multiple datasets are required. It can only be set from a CSV or JSON file and can only be removed from within the CSV or JSON file.
Syntax of the getting of a Data variable:
pm.iterationData.get('VariableName’);
Debugging Variables in Postman🐛
To debug variables in Postman, use console.log in your program.

Example of debugging variables in Postman
var VarName = pm.globals.get("VariableName");
console.log(VarName);