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

Devstringx Technologies
5 min readJul 13

--

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
  • Click on Collection and name the collection
  • Expand the collection and click on Add a request
  • After clicking on Add a request default GET method is selected. Now we have to select the POST method from the dropdown
  • Enter request URL with endpoint (login)
  • Then click on the body tab, click on raw, and select JSON
  • Enter JSON data in the body
  • Click on send and see the status and response
  • If you enter the request URL without the endpoint then observe status code is different and the response is not correct

Good to Read:- Write & Add Tests Scripts with Postman

2) API Testing Using the GET Method

Add new request and enter URL with API name and parameters

To use parameters, we need to set the environment

  • Click on the eye icon
  • Click on edit to set the variable to global environment which can be used in all collections
  • Use a variable name for URL and Token
  • Click on Authorization and select type as Bearer Token
  • Enter curly braces then variables are displayed in the dropdown then select the token and save
  • After this, click on send button and view the response for getting all projects by the user

Originally published at https://www.devstringx.com on July 13, 2023

--

--

Devstringx Technologies

Devstringx Technologies is highly recommended IT company for custom software development, mobile app development and automation testing services