Getting Started with Postman and APIs: [Interactive Tutorial]— Hands-on Activity! 🛫

Postman — Interactive Tutorial 1
Postman — Interactive Tutorial 1

Welcome to the beginner’s guide to Postman! Postman is a powerful tool for testing and developing APIs (Application Programming Interfaces). It allows you to send HTTP requests to a server and view the responses, making it an essential tool for any developer working with APIs.

In this interactive tutorial, we’ll discuss the in-depth features of Postman and walk you through the basic steps of using it. We’ll also work with some examples to help you get started and get familiarised with APIs + Postman.

Disclaimer: In this article, we’ll cover the concepts of APIs and the installation of Postman. If you liked this article and wanted to continue your learning on Postman and its features, please feel free to Follow me!

Simply put, it’s a tool that allows you to make HTTP requests to a server and receive the responses. This can be useful for testing APIs, as you can use Postman to send requests and view the responses to ensure that your API is working correctly. This is transform the fact that if your API is working correctly, then the back-end system is able to respond appropriately to the requests.

Before jumping right into the Postman, let’s take a step back and understand the basics!

If you’re new to concept of APIs, then you must remember the five important terms which will get repeated whenever you speak about APIs:
1. Server
2. Client
3. Request
4. Response
5. Status Code

Now, let’s take a look at some of the key concepts of Why we use APIs and Why it is so revolutionary?

API Call and it’s Backend
API Call and it’s Backend (Source credit: https://www.boostit.net/)

To start with, it is a set of rules and protocols that specifies how two software systems should communicate with each other. In simple terms, it tells an user, how the Client and the Server should communicate to get the desired data from the database.

It is just a Browser or a Machine from where the Requests are initiated. If you take a look at the above image, you can see the Requests are sent from the Browser to the Web Server which is on the other end.

It is a Machine which responds to your requests from Client and provide valuable information in return which is called as Response in the world of APIs. The Server is obliged to share a Response if your Requests are qualified in the format/standard that it accepts. Once accepted, the Server will share a Status Code which is called as HTTP Response Code. This will tell you if the Response is Successful or NOT. We can take a look at the details of the Status Code once we get into the concepts of Postman. For now, just consider it as a three-digit code that we’ll get along with the Response from the Server.

That said, let’s assume a simple scenario, let’s say you’re in School/University and you wanted to take a leave tomorrow but you would need to request your Class Teacher for it. You’ll follow the below steps:
1. You’ll write a Leave Letter in a standard format using From , To, Subject, and Body.
2. In the To section, you’ll specify that it is to your Class Teacher.
3. In the Subject section, you’ll specify the brief reasoning of the letter.
4. In the Body section, you’ll specify the details.
5. Now, you would need to Request your Class Teacher to sign the Letter so you can take a leave which is an approval.

Based on the above, let’s translate it in the terms of APIs so you can correlate.
1. From or You -> Client
2. To or Class Teacher -> Server
3. Subject -> Request Method [we’ll look into this later]
4. Body -> Request Body
5. Teacher’s Sign -> Response / Status Code.

I hope you must have understood something about the APIs now. APIs allow different softwares or applications to share data and functionality with each other very easily. For example, a weather app might use an API provided by a weather service to retrieve current weather data for a particular location. There are different types of APIs too and it is developed based on certain use cases.

Until now, we were discussing repeated statements on APIs allow different softwares or two different software systems to share data easily. If you take a deeper look at it, you’ll know why are APIs are revolutionary.

For example, I’m developing a Python Application which requires your location from Google Maps but the Google Maps are created using the programming languages C++ and JavaScript. Now there are questions in my mind — How will I be able to interact with the Google Maps? I do not know C++ or JavaScript 🤔. What will I do? 😩

That’s when, a layer that will hide all the complex systems of the backend of the Google Maps i.e. C++ and JavaScript and present itself as an Google Maps API. When I send a Google Maps API Request from my Python Application, automatically it will convert my Request to the C++ and JavaScript format to provide the details that you are Requesting for.

Ok, this is Good Enough knowledge about APIs to start with!! Let’s see more on this, when we cover Postman!!

Prerequisite

To use Postman, you’ll first need to download and install it on your computer. You can refer to this Installation Documentation to know what to do post downloading the package. If you’re stuck somewhere while installation, please feel free to comment so I can help you, if required.

Once you have it installed, you can open it up and start using it to send requests.

Using Postman is fairly simple. You’ll start by selecting the Method of Request you want to send. There are 4 majorly used methods:
1. GET
2. POST
3. PUT
4. DELETE

You’ll then enter the URL of the Server you want to send the request to, and any additional parameters or data like Body that you want to include in the Request. Once you’ve entered this information, you can click the Send button to send the Request and view the Response.

You must be wondering! Where is the Hands-on Activity 😃
Was it a Click-bait? 🤔
No, not at all!
Ok, here we go!

🏃[Hands-on Activity] 🏃

Let’s start with a basic example today, we’ll just keep you from getting overhelmed by the new concepts.

Now, we are going to GET some Response i.e. information from an API which is Publicly available using the URL provided by the Server.

Requirements:
+ Postman Tool
+ Internet
+ Public URL / Endpoint — https://api.genderize.io?name=scott

I’m using the Public URL/Endpoint to GET details of the gender based on the name. Please note, this is just an example. You can use the same from your end, if you cannot find any Publicly available APIs.

A GET request is used to retrieve data from a Server. To send a GET request using Postman, follow these steps:

1. Open Postman and click the New button in the top left corner.

2. In the pop-up window, click on the HTTP Request.

New HTTP Request Postman
New HTTP Request Postman

3. Now, in the New Requestwindow, enter the URL of the Server you want to send the request to in the Request URL field. The moment, you enter the above URL/Endpoint(https://api.genderize.io?name=scott), you can see the params panel getting populated with the name field.

4. Select GET from the dropdown menu next to the Request URL field. But, by default, you can see the GET method.

5. Click the Send button to send the request.

6. You should now see the response with the Status Code from the Server in the Response panel on the right. The response may include data, such as count,gender,name,and probability.

Here’s a screenshot for your reference:

The GET Request from Postman with response
The GET Request from Postman

Yay!! 👏
That’s it! You’ve just sent your first GET request using Postman. In the next section, we’ll walk you through the process of sending a POST request, which is used to create new data on the Server.

I hope this article will be helpful to a greater audience in understanding the basics of APIs and Postman. Please feel free to share your comments on whether you liked it.

For now, thanks for reading!! If you enjoyed this article, please follow and subscribe for the latest updates. Looking for more? Check out the other articles below:

--

--

I am an Open-Source Enthusiast. I learned a lot from the Open-Source community and I love how collaboration, knowledge sharing happens through Open-Source!

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Someshwaran M

I am an Open-Source Enthusiast. I learned a lot from the Open-Source community and I love how collaboration, knowledge sharing happens through Open-Source!