Common Postman Tips

Common Postman Tips

Learn common Postman tips including global token setup, collection token configuration, and automatic API execution features.

1. Global Token Setup

1. Get Token During Login

Get Token

// Get the response data from the login API
var jsondata=pm.response.json();
// Check if login was successful
if (jsondata.code === 200) {
    // Get token and set it to the environment variable token
    var token=jsondata.data.token
    pm.globals.set("token",token)
} else {
    console.error(jsondata.msg);
}

2. Set Token in Collection

Set Token

2. Automatic API Execution

Run Collection

Right-click on the Collection and select “Run Collection”;

Select the APIs to execute, fill in the number of iterations and delay time on the right, then click “Run test automatic execution”.

Hi! How can I help?