What Is Postman & How to Use Postman to Test API? – Devstringx

Back to Blog
Feature image for Postman API test

What Is Postman & How to Use Postman to Test API? – Devstringx

What Is Postman?

Postman is a platform or software testing tool used for API Testing. It is a simple GUI (Graphic User Interface) to send and view HTTP requests and responses.

API (Application Programming Interface) is an interface that defines a set of protocols (rules) that help various software components to interact with each other.

What Is Postman Tool Used for?

Postman tool is used to help developers easily create, test, share, and document APIs. Postman is a user-friendly tool that helps us to optimize our time when executing tests.

Features of Postman

  1. New– It is used to create a unique environment or request
  2. Import– Used to import collection or environment
  3. Runner– Used for executing automation tests
  4. Collections– Created for arranging the test suites
  5. My workspace– Create new workspace individually or as a team
  6. History– Used for displaying past requests
  7. Request Tab– Used for displaying the title of the request
  8. HTTP request– Used for displaying a dropdown list of various request methods
  9. Params– Used for writing required parameters for the request
  10. Authorization– To use/test APIs, authorization is required
  11. Body– Used to enter data in text/JSON
  12. Save– Used to save changes made to a request
  13. Pre-Request Script– Used for executing test scripts before requests

Advantages of Postman

  • Using the Postman tool, there is no need to learn a new programming language
  • It is easy to understand because of the interactive interface
  • Postman tool provides the user to store values in variables at the environment level which can be used in any request URL, header, and body

HTTP Methods

HTTP means Hyper Text Transfer Protocol which is used to allow communication between servers and clients
Mostly used HTTP methods are:
  • GET: This method is only used to retrieve data/information
  • POST: This method is used to send data to servers like upload, create, update
  • PUT: It sends data to the server to create/update a resource
  • DELETE: This method deletes only specified resource
  • PATCH: This method is used when there is a need to update only one field of resource

Steps to Use Postman On a Browser

  1. Go to the Postman website www.postman.com
  2. Click on the Sign Up for Free button
  3. Enter the email, username, and password
  4. Click on Create free account button
  5. Then, enter your name and what is your role.
  6. Click on the Continue button
  7. Now, the Postman dashboard screen is displayed

How to Use Postman for API Testing?

  • Open Postman
  • Select workspace

Good to Read:- A Detailed Guide on Newman Postman

HTTP Methods for API Testing

However, there are numerous methods of API testing like POST, GET, PUT, DELETE, etc but here we are sharing 02 HTTP methods for API Testing.

1) Testing API Using the POST Method

  • Click on the new button from the left side
Postman Workspace image
  • Click on Collection and name the collection
Postman New Collection image
  • Expand the collection and click on Add a request
Complete Documentation in Postman Image
  • After clicking on Add a request default GET method is selected. Now we have to select the POST method from the dropdown
New collection new request in Postman
  • Enter request URL with endpoint (login)
Image of Query Params
  • Then click on the body tab, click on raw, and select JSON
  • Enter JSON data in the body
Image of Postman JSON
  • Click on send and see the status and response
Image of Postman 200 status
  • If you enter the request URL without the endpoint then observe status code is different and the response is not correct
Status 404 not found in postman

2) API Testing Using the GET Method

Add new request and enter URL with API name and parameters
Project Collection image

To use parameters, we need to set the environment

  • Click on the eye icon

Quick look Image

  • Click on edit to set the variable to global environment which can be used in all collections

image of No global variables

  • Use a variable name for URL and Token

New request image

  • Click on Authorization and select type as Bearer Token

Bearer token image

  • Enter curly braces then variables are displayed in the dropdown then select the token and save

image of authorization

  • After this, click on send button and view the response for getting all projects by the user

image of new request

Share this post

Back to Blog