Postman Tutorial for Beginners – A Complete Guide

A few days ago, I received a same message from three different people, asking me to help them with Postman, So I decided to write a complete guide for beginners to get started quickly with Postman.

Simply Saying, Postman is a Client for Testing your API Endpoints. If you visit their website at getpostman.com, It says “Postman Simplifies API Development”. But it provides a complete API Development Environment. It supports team collaborations with workspaces.

To Get Started Download Postman

Download Postman from here: https://www.getpostman.com/downloads/ Postman is available for Mac , Windows and Linux

After you download, install and open it, it shows the basic building blocks on a launch screen, like below. I will go about explaining each one of them in detail.

Basic Blocks of Postman

The 3 Basic Building Blocks of Postman.

  1. Request. Request is a HTTP request. It can be GET, POST, PUT, PATCH, DELETE, COPY, HEAD, OPTIONS, LINK, etc. You can create a request and put the name, description and add it to collection. After you create a request, enter the URL, method, headers, and body.
  2. Collection. Collection is a simply a set or group of requests. You can create requests and group them in collections, enabling easy sharing of your APIs. Think of this a folder for organising requests.
  3. Environment. Environment lets you create different setups for testing APIs. For example, You can have same URL with different domains or IP addresses. You can create environments for your staging servers and production servers. Thus enabling you to switch easily.

The Advance blocks of Postman are Documentation, Mock Servers and Monitor, which in-order to you use them, you need to create an account with Postman. Let me wrap this section quickly, Documentation lets you create a documentation page for your APIs to share it with developers. Mock Servers let you simulate your API endpoints. This is makes life easy when you backend team is busy building the API endpoints, while you need sample requests to test your frontends. You can set the request and response you need in the endpoint. Monitor check your monitors your API endpoint to check the performance and response time.

Creating A Request

To create a postman request, enter the name and description, url, method, headers, and body and click send to test the API Endpoint. You will get the response in the body section.

Postman GET Request Sample

Similarly you can create POST Requests, GET and POST are most frequently used methods.

Generating Code from Request

You can generate code for your choice of programming language from Request. Click on code below send button, it open a small popup like below, select the language you want and you get the code. Boom!!!

Generate Code from Request in Postman

Authorization in Postman

If your API Endpoint requires you to provide authorization in your request, you can do so in the authorisation tab. Postman provides authorization types to make it easy for you to create requests. You can select between, No Auth, Bearer Token, Basic Auth, Digest Auth, OAuth 1.0, OAuth 2.0 and etc. If you need to pass token to server, pick the Bearer Token, for basic auth with username and password pick basic auth, and so on.

Authorization in Postman

Passing Parameters in Request

Passing parameter to request is one of the most important thing you need to do everytime. Parameters can be passed from body section as key value pairs.

Passing Parameters as Key Value Pairs

You can even dump you JSON data into the body in raw section in body.

Passing JSON data in body

Creating Environments in Postman.

Environment is a set a variables that you need to put context of you request. For example your url for production server and staging server is different, you can create a variable for URL that will go in url of request. If you select staging enviroment, request will go to Staging Server, and if you production, your request will be fired on production server. This is example, You can do it your way.

Postman Environments for Production, Staging and Local Server

Cookies in Postman

If you API Endpoint requires cookies to function properly, You can manage cookies in Postman. Click on cookies beside code button below send button in request. You can add the domain name and add your cookie in the box.

Cookies in Postman

Thats it for now!

I think I have covered most of the points in handling postman in beginner’s point of view. If you feel anythings is left-out, let me know. Enjoy Postman App!!!

Join India's Largest Code Learning Community on Uphub.io Get it on Google Play
Sharing options: