Showing posts with label Postman. Show all posts
Showing posts with label Postman. Show all posts

Saturday, February 22, 2025

Generate UUID in Postman

We can do GET Request to UUID Tools endpoint to generate UUID from Postman client.

Endpoint:

https://www.uuidtools.com/api/generate/v4

Script in Postman:

let jsonData = JSON.parse( responseBody);postman.setGlobalVariable( "UUIDValue", jsonData[ 0 ] );

Monday, November 14, 2022

How to set Date time while making PostMan Requests?

To set Date time while making Requests in PostMan, we can use Pre-request Script.

Sample Code:

const moment = require( 'moment' );    pm.environment.set( "currentDateTime", moment().utc().format( "YYYYMMDDTHHmmss" ) + "Z" );

Saturday, May 28, 2022

How to set Environment Variables from XML Response in Postman?

xml2Json() can be used to convert the API response from XML to JSON. Then, we can retrieve the values from the JSON string.

Sample Code:
let XMLToJSONResponse = xml2Json( responseBody ); 
pm.environment.set( “Id”, XMLToJSONResponse[ “CUSTOMER” ][ “ID” ] ); 
pm.environment.set( “FirstName”, XMLToJSONResponse[ “CUSTOMER” ][ “FIRSTNAME” ] ); 
pm.environment.set( “LastName”, XMLToJSONResponse[ “CUSTOMER” ][ “LASTNAME” ] );

Thursday, May 26, 2022

How to set Environment Variables in Postman?

Setting Environment Variable in Postman avoid manually setting the variable values for subsequent API Calls.
 
1. pm.environment.set() can be used to set Environment Variable in Postman. Code should be used under Tests tab.
 
Sample Code:
let jsonData = JSON.parse( responseBody );
pm.environment.set(“loginId”, jsonData.login);
pm.environment.set(“URL”, jsonData.url);
pm.environment.set(“nodeId”, jsonData.node_id);

2. Once the request is sent. We can check the variable values in the Environment.

Monday, November 1, 2021

How to use variables in PostMan client?

1. Select Environments.
2. Click Global.
3. Declare variable name, current value and initial value.

4. Use {{Variable_Name}} while making requests.

How to change Cursor Color Theme?

Effortless Customization: A Step-by-Step Guide to Changing Your Cursor Color Theme Are you tired of the same old cursor on your screen? Do y...