Master Postman: Essential Features and Advanced Tips for API Testing

This comprehensive guide walks you through Postman's core capabilities—including installation, interface navigation, sending requests, handling query parameters, forms, JSON and file uploads, response analysis, collection management, batch execution, logging, assertions, variables, pre‑request scripts, and request chaining—empowering developers and testers to automate and streamline API testing workflows.

Programmer DD
Programmer DD
Programmer DD
Master Postman: Essential Features and Advanced Tips for API Testing

Overview

Postman is a powerful HTTP API debugging and testing tool that offers a rich set of features for developers and testers. It simplifies request creation, response inspection, test automation, and collaboration.

Installation

Postman no longer supports a browser version after 2018, so you must download the desktop client. For Windows, download the installer from the official website, run the installer, and follow the prompts to complete installation.

Postman overview image
Postman overview image

Interface Navigation

The main UI includes a request builder, method selector, URL bar, Params, Headers, Body, and a response pane with tabs for Pretty, Raw, and Preview. Additional panels provide access to Collections, Environments, and Logs.

Postman UI elements
Postman UI elements

Sending the First Request

Open Postman and click the "+" button to create a new request.

Enter the request URL, e.g., http://www.weather.com.cn/data/sk/101010100.html.

Select the HTTP method (GET by default) and click Send .

View the JSON response in the response pane.

First request response
First request response

Basic Functions

Common request types : query parameters, form‑encoded, JSON, multipart/form‑data (file upload).

Query parameters : add key‑value pairs in the Params tab or directly in the URL after ?.

Form requests : set Content‑Type: application/x-www-form-urlencoded and fill key‑value pairs in the Body → x‑www‑form‑urlencoded tab.

File upload : choose form‑data in Body, set the field type to File, and select a local file.

JSON requests : select rawJSON in Body and paste the JSON payload.

POST http://localhost/index.php/home/Uploadify/imageUp/savepath/head_pic/pictitle/banner/dir/images.html HTTP/1.1
Content-Type: multipart/form-data

file=a1.jpg

Response Parsing

Postman displays the response in three tabs:

Pretty : formatted view (JSON, HTML, etc.).

Raw : raw response data.

Preview : renders HTML responses.

Response tabs
Response tabs

Collection Management (Collections)

Collections let you group related requests, organize them into folders (modules), and run them together. To create a collection, click New Collection , name it, add folders, and add requests inside each folder.

Create collection
Create collection

Batch Execution

Select a collection, click the three‑dot menu, and choose Run to open the Collection Runner. All requests in the collection are selected by default; click Run Collection to execute them sequentially.

Collection Runner
Collection Runner

Logging and Debugging

Use console.log("message") in Pre‑request Script or Tests to output logs. Open the Postman console via the menu or the bottom‑left icon to view logs, filter by level, and search for specific entries.

Console logs
Console logs

Assertions

Write JavaScript assertions in the Tests tab using the pm.test API. Common assertions include status code, response time, header presence, body content, and JSON value checks.

pm.test("Status code is 200", function () {
    pm.response.to.have.status(200);
});
pm.test("Content-Type header is present", function () {
    pm.response.to.have.header("Content-Type");
});
pm.test("Response body contains string", function () {
    pm.expect(pm.response.text()).to.include("string_you_want_to_search");
});

Variables (Global, Environment, Collection)

Variables store reusable values. Define them via the gear icon (Globals/Environments) or in a collection’s Variables tab. Use {{variableName}} in request fields, or access them in scripts with pm.globals.get, pm.environment.get, or pm.collectionVariables.get. Set them with pm.globals.set, pm.environment.set, or pm.collectionVariables.set.

// Set a variable
pm.environment.set("token", "abc123");
// Get a variable
var token = pm.environment.get("token");

Pre‑request Scripts

Pre‑request scripts run before the request is sent. They are useful for generating dynamic data (e.g., timestamps, random numbers) or encrypting parameters.

var timestamp = Date.now();
pm.environment.set("ts", timestamp);

Request Chaining (Interface Association)

Extract data from a response, store it in a variable, and use it in a subsequent request. Example: upload an avatar, capture the returned url, save it as a variable, and use that variable in the image preview request.

// Extract URL from previous response
var json = pm.response.json();
pm.environment.set("avatarUrl", json.url);

Then reference {{avatarUrl}} in the next request’s URL.

Common Return Value Extraction

Use JavaScript dot notation and array indexing to retrieve nested JSON values.

// Example JSON
var json = pm.response.json();
var userId = json.data.user_id; // nested object
var secondPoint = json.data.roles.points[1]; // array index
var lastId = json.data.rows.slice(-1)[0].id; // last element
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

AutomationHTTPVariablesAPI testingPostmanassertionsCollection Runner
Programmer DD
Written by

Programmer DD

A tinkering programmer and author of "Spring Cloud Microservices in Action"

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.