Found 74 Articles for Postman

What is Pre Requests scripts in Postman?

Debomita Bhattacharjee
Updated on 03-Aug-2021 12:47:05

701 Views

The Pre-Request scripts are executed before the execution of requests. These scripts are implemented in JavaScript and mainly created to execute pre-requisite conditions like declaring request headers, parameters, variables, or an output.We can create Pre-Request Script to define the sequence of execution of requests in a Collection. A Pre-Request Script is also utilized for scenarios where value returned from a request is required in the following request or a value returned from a request should be captured prior to the next request.These scripts are defined in the Pre-request Script tab in Postman.Incorporate the below JavaScript in the Pre-Request Script tab ... Read More

How to change the workflow in Postman?

Debomita Bhattacharjee
Updated on 25-Jun-2021 16:30:32

160 Views

In a Collection, the requests are executed in the sequence in which they are created. However, a workflow can be changed in Postman. To illustrate it, let us take a Collection having four requests.To trigger that Collection, click on the arrow appearing to the right of the name of the Collection in the sidebar. The Run button appears, click on it.The Collection Runner window gets launched. Within the RUN ORDERsection, the sequence in which the requests shall get executed is displayed from the top to bottom. In our example, the order is −GETPOSTPUTDELClick on Run Collection1.A new window appears containing ... Read More

What are Snippets in Postman?

Debomita Bhattacharjee
Updated on 25-Jun-2021 16:23:11

2K+ Views

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 ... Read More

How to Add Cookies in Postman?

Debomita Bhattacharjee
Updated on 25-Jun-2021 16:23:49

5K+ Views

We can add cookies in Postman. To add a cookie, the below steps need to be followed −Step1 − Navigate to the Params tab below the address bar and then click on Cookies.Step2 − The MANAGE COOKIES window shall open. It lists down all the current cookies. To add a cookie, click on the Add Cookie button. An edit box with pre-populated values of the cookie are displayed. We can update the value and Save it.Step3 − Send the request to the server.Step4 − After the request has been successfully completed, the Cookies tab in the Response will show the ... Read More

Global Scope Variables in Postman?

Debomita Bhattacharjee
Updated on 25-Jun-2021 16:23:29

458 Views

The Global variables are the ones which can be used in every Environments and can be utilized for executing every request. Click on the eye icon available to the top right corner of the Postman application. In the below image, the Global variable g with value value1 is populated under the Globals section.Let us select another Environment – Environment_Test from the No Environment dropdown. Then again click on the eye icon. The Global variable g with value value1 should also be available for this Environment.Now, enter {{g}} in the address bar (with the Environment pointing to Environment_Test) and hover mouse ... Read More

Collection Runner in Postman?

Debomita Bhattacharjee
Updated on 25-Jun-2021 16:24:12

1K+ Views

A Collection Runner in Postman is used for triggering more than one request simultaneously. After execution, the Collection does not yield a Response Body of individual request.The console of Collection Runner generates the pass or fail status of every request. For a Collection Runner, it is compulsory to have at least two requests for the Collection.To trigger a Collection with a Collection Runner follow the below steps −Step1 − Click on the Runner menu in Postman.Step2 − The Collection Runner window shall open up.Step3 − Choose the name of the Collection from Choose a collection or folder.Step4 − Select an ... Read More

How to use Global Variable in Postman Request?

Debomita Bhattacharjee
Updated on 25-Jun-2021 16:24:44

4K+ Views

We can use a Global variable in Postman Request. . We can set, get and clear a Global variable at runtime using the scripts. This is achieved by the pm.* function. The script to use a Global variable can be included either in the Tests or Pre-Request Script tabTo set a Global variable, the script should be −pm.globals.set('', '')To get the value of a Global variable, the script should be −pm.globals.get('')To get the value of the Global variable in the Postman console, the script should be −console.log(pm.globals.get('')To delete a Global variable, the script is −pm.globals.unset('')Let us try to work with ... Read More

How to see request logs in Postman console?

Debomita Bhattacharjee
Updated on 25-Jun-2021 16:22:50

7K+ Views

We can see request logs in the Postman console. Once a request has been sent, the Postman console records the header of request, variables, Response header and body, certificates, proxy settings, errors, scripts, output obtained from console.log, and so on.The Console is obtained from the Postman application by following the navigation − View menu Show Postman Console. Or using the shortcut Ctrl+Alt+C.Let us send a GET request for an endpoint. Add a Pre-request and Tests scripts.Pre-Request Scriptconsole.log("Tutorialspoint - Postman")Testsconsole.warn("Warning message in console") console.log("Logging message in console") console.info("Info message in console") console.error("Error message in console")Postman Console Output shows the message from ... Read More

How to Use Environment Variables in Postman?

Debomita Bhattacharjee
Updated on 25-Jun-2021 16:21:58

1K+ Views

We can use Environment Variables in Postman. We can configure, obtain and delete an Environment variable at runtime with the help of scripts. This is achieved by the pm.* function. The scripts to use an Environment variable can be included either in the Tests or Pre-Request Script tab.To set an Environment variable, the script should be −pm.environment.set('', '')To get an Environment variable value, the script should be −pm.environment.get('')To get the value of the Environment variable in the Postman console, the script should be −console.log(pm.environment.get(''))To delete an Environment variable, the script should be −pm.environment.unset('')Let us try to use an Environment variable ... Read More

How to get the value of environment variable in Postman?

Debomita Bhattacharjee
Updated on 25-Jun-2021 16:19:09

4K+ Views

We can get the value of an Environment variable in Postman at runtime with the help of scripts. This is done with the help of the pm.* function. The script to get the Environment variable can be included either in the Tests or Pre-Request Script tabTo get an Environment variable, the script should be −pm.environment.get('')Finally, to get the value of the Environment variable in the Postman console, the script should be −console.log(pm.environment.get(''))Let us try to get the value of the Environment variable tutorial.Step1 − Add the below script to get the value of the Environment variable tutorial and print it ... Read More

Advertisements