Creation Of API Reqest Using Postman Tool

Introduction

In this article, we will look at how to install Postman and then create API Request using Postman Tool.

Postman

Postman is a tool that helps us to design, Test, document, and mock API.

This tool has the ability to make various types of HTTP requests like GET, POST, PUT, PATCH, and convert the API to code for languages like JavaScript and Python.

Advantages of using Postman

  • Postman is a user-friendly tool.
  • Postman supports continuous integration
  • We can collaborate and work within teams using workspaces.
  • Easy to debug the tests run in postman
  • We can perform Automation Testing using postman
  • We can also Monitor API collections at a certain interval of time period.
  • Easy to write tests, postman itself provides code snippets that are inbuilt which makes it easy for testers to write tests.
  • Postman allows users to build collections for their API calls. Every set can create multiple requests and subfolders. It will help to organize the test suites.
  • We can also mock an API and document API which will be helpful for developers.

Installation

We can use postman as an application downloaded in your system or as a chrome extension or as a web application.

Visit the below link to download the application with respect to your OS platform.

Link: https://www.postman.com/downloads/

Once installed login using your credentials, If you don't have kindly create a login using your gmail or personnal mail id.

Creation of API Reqest using Postman Tool

Postman site will display the application to be downloaded as per the OS that you are using so that you can download it.

Various sections of postman

Header section

The header section contains the options like the file edit view help under that we have home workspaces interceptors and settings icon Interceptor enables you to capture network requests and cookies directly from a Chrome browser. You need to install interceptor as a chrome extension to use it.

Left sidebar

Left sidebar contains the tiles to,

  • create collection
  • Create mock API servers
  • create monitors
  • create environment
  • and see the run history of tests
  • It will also be able to see the collection explorer.

Builder section

The builder section is the area that helps us to configure the API Contract details so that we can hit and run the see the API.

Response section

Response section is the area in which users can view the results of the execution.

Logs

For viewing the logs click the console button at the bottom of the postman tool.

Creation of API Reqest using Postman Tool

Creating an API Request

We can create by clicking on new button from the collection explorer and then clicking the http request option.

Or

Create a collection. by clicking on new button from the collection explorer and clicking the collection option. Inside the collection click the three dot icon and click add request option to add the request to the collection.

The best practice is to go ahead and use the second option hence it provides many options to use more features of postman like monitors, documentation, environment, etc.

After creating the API request, in the builder section kindly provide all the API contract details.

I have explained all these contract details in the article API Testing,

  • HTTP methods
  • Auth
  • headers
  • Body->if its put or post request
  • URI

Pre-request script

Pre request script is the script that runs before the request has been hit.

tests

tests for API is written using javascript which runs after the response has been received.

Summary

Hope you got good knowledge of what is postman tool and how to install it and create API request using Postman tool.