Software Training Institute in Chennai with 100% Placements – SLA Institute

Easy way to IT Job

Share on your Social Media

API Testing Using Postman Tutorial From Scratch: A Comprehensive Guide

Published On: June 9, 2025

An API testing tool that is quite popular and well-known for its intuitive graphical user interface is Postman. There is a strong and expanding need for Postman API testing abilities due to the rising dependence on APIs in contemporary software development, as well as Postman’s extensive feature set and ease of usage. Read through this API testing using Postman tutorial for gaining a fundamental understanding about it. Explore our API testing course syllabus here.

Introduction to Postman for API Testing

Postman makes API testing easier to send and examine HTTP requests and responses. Numerous HTTP methods (GET, POST, PUT, DELETE, PATCH, HEAD) and data types (JSON, XML, etc.) are supported by Postman. It enables the development of JavaScript test scripts for verifying API answers. To create and test APIs, Postman helps team members collaborate.

Let’s begin utilizing Postman to test your API! This is a detailed guide that covers the fundamentals.

Download and Install Postman

Go to https://www.postman.com/downloads/, the official Postman website.

Get the program for your operating system (Linux, macOS, or Windows).

Observe the installation guidelines.

Understanding the Postman Interface:

  • Workspace: Your workspace is where you plan out your API testing activities. For cooperation, you can have individual or group workplaces.
  • Collections: Groups of API queries are called collections. Arrange your requests logically, for example, by feature or API endpoint.
  • Requests: A separate request made to an API endpoint. This comprises the URL, headers, body, and HTTP methods (GET, POST, PUT, DELETE, etc.).
  • Environments: Using environments, you may control several sets of variables, such as base URLs for production, staging, and development.
  • Response Section: This is where the body, headers, and status code of the API response are displayed.
  • Sidebar: For navigating between collections, histories, workspaces, etc.

Basic Configuration Steps for API Testing:

Here are the basic configuration steps for API testing:

Create a workspace (recommended but optional):
  • Select “Workspaces” from the upper left menu.
  • Press the “Create Workspace” button.
  • Choose the visibility (Personal or Team) and give it a name.
Create a Collection:
  • To create a new tab, click the “+” button.
  • Choose “Collection” after clicking “Create New” in the upper left corner.
  • Choose a name that accurately describes your collection.
Add Your First Request to the Collection:
  • To create a new tab, click the “+” button.
  • In the URL area, type the URL of the API endpoint that you wish to test.
  • From the dropdown menu, choose the relevant HTTP method (such as GET).
  • To save the request into the collection you just established, click “Save” and select it. Give a name to your request.

Recommended: API Testing Online Course Program.

Using Environments (Highly Recommended for Real-World Testing):
  • In the upper right corner, click the “Environment quick look” symbol, which is represented by an eye.
  • Select “Add new environment.”
  • Name your surroundings “Development” or something like.
  • It is possible to define key-value pairs in the “Variables” section. As an illustration, consider base_url: https://your-dev-api.com/api
  • Preserve the environment.
  • The variable {{base_url}}/your/endpoint can now be used in place of the entire URL in your API request URL. This facilitates switching between several API environments.

Essential Configurations for Testing:

Here are the important configurations for testing process:

  • Headers: Certain headers, such as Content-Type and Authorization, are required by many APIs. These can be added in your request’s “Headers” tab.
  • Body: You may frequently need to send a request body (such as in JSON format) for POST, PUT, and PATCH requests. The “Body” tab is where you may configure this.
  • Pre-Request Scripts: These JavaScript scripts execute before sending your request. They can be used to sign requests, set dynamic variables, and more.
  • Tests: Here, you write your JavaScript-based API test assertions to verify the body, headers, and status code of the API response.

Recommended for Fundamental Testing Knowledge: Manual Testing Course in Chennai.

Sending Your First API Request (GET Request)

Suppose you wish to test a basic public API, such as one that offers details on a placeholder. JSONPlaceholder API (https://jsonplaceholder.typicode.com/) will be used.

  • Open a New Tab: To create a new request tab, click the “+” icon.
  • Choose the HTTP Method: Select “GET” from the dropdown menu, which is the default option.
  • Enter the URL for the request: Enter this in the URL field:https://jsonplaceholder.typicode.com/todos/1
  • Click “Send”; the “Response” section below will display the API’s response. Most likely, the answer will be a JSON object similar to this:

{

    “userId”: 1,

    “id”: 1,

    “title”: “delectus aut autem”,

    “completed”: false

}

  • Examine the Response:
    • Body: The primary information that the API returned. JSON answers are typically formatted beautifully by Postman.
    • Headers: Response metadata, such as the type of content and server details.
    • Status Code: Denotes how the request was handled (e.g., 200 OK for success).

Related: Software Testing Training in Chennai.

Sending a POST Request

The POST method is frequently used to deliver data to an API. Let’s try utilizing the JSONPlaceholder API to add a new “todo” (keep in mind that this API will mimic a successful POST, but it doesn’t store the data).

  • Open a New Tab: Click the “+” icon.
  • Select the HTTP Method: Choose “POST”.
  • Enter the Request URL:https://jsonplaceholder.typicode.com/todos
  • Select the “Body” tab: Click the “Body” tab beneath the URL field.
  • Choose the Type of Body: Select “raw” first, and then “JSON” from the drop-down menu on the right.
  • Put in the JSON request body:

{

    “userId”: 10,

    “title”: “Buy groceries”,

    “completed”: false

}

  • Click “Send”: The data you submitted and a new, simulated ID that the API assigned will probably be included in the response:

{

    “userId”: 10,

    “title”: “Buy groceries”,

    “completed”: false,

    “id”: 201

}

  • Examine the Response: Verify the response content and the status code, which should be 201 Created for a successful POST.

Explore our LoadRunner Training in Chennai.

Organizing Requests with Collections

You can aggregate related API requests with the aid of collections.

  • Create a New Collection: Either select “File” > “New” > “Collection” or click the “+” button next to “Collections” in the left sidebar.
  • Give a Name to Your Collection: “JSONPlaceholder Tests” is one example.
  • Your Requests Will Be Saved for the Collection:
    • Navigate to either the GET or POST request tab that you made.
    • Press the “Save” icon.
    • Select the “JSONPlaceholder Tests” collection that you just made.
    • Give the request a meaningful title, such as “Create New Todo” or “Get Todo 1”.
    • Press “Save.”

Your requests are now arranged in the sidebar’s “JSONPlaceholder Tests” collection.

Upskill Suggestion: Selenium Testing Training in Chennai.

Writing Basic Tests

You can create tests with Postman to verify the API answers.

  • Go to a Request: Select a request from your collection (such as “Get Todo 1”).
  • Navigate to the “Tests” tab, which is located adjacent to the “Body” tab.
  • Write Tests (JavaScript): Postman writes tests using JavaScript. It comes with a useful pm object built in.
  • A few typical test cases are as follows:
    • Verifying the Status Code:

pm.test(“Status code is 200”, function () {

    pm.response.to.have.status(200);

});

  • Testing if the Response Body Contains a Specific Value:

pm.test(“Response body contains title”, function () {

    const responseJson = pm.response.json();

    pm.expect(responseJson.title).to.eql(“delectus aut autem”);

});

  • Testing a Specific Data Type:

pm.test(“Response id is a number”, function () {

    const responseJson = pm.response.json();

    pm.expect(responseJson.id).to.be.a(‘number’);

});

  • Run the Request: To execute the request, click “Send” one again.
  • Check the “Test Results” Tab: Examine the “Test Results” tab to find out if your tests were successful or unsuccessful.

Recommended: Software Testing and QA Analyst Job Seeker Program.

Important Things to Learn in Postman

You may explore the following further:

  • Variables: To manage environments and data that change throughout time.
  • Environments: To oversee various API setups, such as production, staging, and development.
  • Pre-request scripts: To run code (such setting dynamic headers) prior to a request being sent.
  • Assertions: More sophisticated techniques to verify the substance of the response.
  • Collection Runner: To run every request in a collection automatically.

Explore all software training courses at SLA.

Conclusion

A fundamental grasp of API testing using Postman has been given by this tutorial. You now know how to send several kinds of HTTP requests (GET and POST), group them into collections, and create simple tests to verify the answers. To hone your skills, keep practicing and experimenting with various APIs in our API testing training course in Chennai. Have fun with your testing!

Share on your Social Media

Just a minute!

If you have any questions that you did not find answers for, our counsellors are here to answer them. You can get all your queries answered before deciding to join SLA and move your career forward.

We are excited to get started with you

Give us your information and we will arange for a free call (at your convenience) with one of our counsellors. You can get all your queries answered before deciding to join SLA and move your career forward.