Postman API testing for beginners

by May 1, 2020IoT Connectivity

Before we get in to what Postman API testing is and how you can begin to use it, we first need to understand what an API is. API is an abbreviation for Application Programming Interface. It is a set of rules, which defines methods of communication. This aids various software components to interact with each other. API testing involves testing the collection of APIs to see if they meet return accurate response. The testing can determine whether it is well-structured and useful on basis of request parameter, the time taken.

What is Postman?

Postman is an application for testing APIs. It does this by sending a request to the web server and checking the response. This is a very useful tool if you are trying to understand REST APIs available or test the ones that you made. The user interface of Postman API testing is easy to understand even for a beginner, and you don’t even have to type in too much code.

Why Use Postman API testing?

Ease of Access

You can log into your account from anywhere, anytime as long as a Postman application is installed on the computer. This is an attractive feature to access files from various locations and collaborate with others.

Inbuilt organisation

To organised your test suites you can create collections with Postman. When this is coupled with sub folders and requests, it helps the user keep tab easily.

Specialized test creation:

The user has the autonomy to choose the test checkpoints. This is useful especially when you need to the test the API in one particular response.

Iterative testing

The options like Collection Runner or Newman enables the user to run tests in iterative loops. This saves time and effort by reducing redundancy.

Debugging

Postman makes it easy to debug APIs through testing. It is very transparent with the data received and its interpretation.

Installing Postman:

  1. Download the app from the Postman website.

2. Once it has been downloaded, double-click the installer and follow the prompts.

3. After the installation is over, launch the application by clicking the Postman icon.

4. When the application starts for the first time, users will be presented with a login window.

Understanding Postman API testing interface:

Postman provides several API call options (shown below) that can be used to test APIs of application. You can select API call method from the given drop down list, set Authorization, Header, Body information according to the selected call.

We can switch through the tabs to view the different information. For example, body information or header information. The blue send button on the right side, is used to send the request to the URL and receive response. The response can be saved using the send button next to it.

The process of testing API can be understood further through the following simple example. For this, we will use JSONPlaceholder. JSONPlaceholder is a simple fake REST API that is used exclusively for testing.

Example

JSONPlaceholder comes with the following resources.

/posts100 posts
/comments500 comments
/albums100 albums
/photos5000 photos
/todos200 todos
/users10 users

Of these, let us make use of the /users. We do this by typing https://jsonplaceholder.typicode.com/users into the URL tab

After this, click on the Send button to receive the response.

The response can be viewed in various formats which can be chosen from the following drop down list:

There are various kinds of tests that can be created in Postman. Feel free to explore the tool to understand the best fit for you.

Writing your own API test

First select the Tests tab, as shown below:

For this, let us use a open API available on GitHub https://hacker-news.firebaseio.com/v0/item/8863.json?print=pretty (copy and paste this into the URL tab). Then, type out the following test in JavaScript. This will check if the ID of the received object is the same as request ID(8863).

pm.test("Your test name", function () {
  var jsonData = pm.response.json();
  pm.expect(jsonData.id).to.eql(8863);
});

After pasting the code and URL, send the request.

At the bottom tab, you can see that the test passed.

If you change the value 8863 to some other value or alphanumeric combination the test will not pass and will be displayed as a fail.

This is just the tip of the Postman and API testing iceberg. With this introduction and basic understanding, you can now begin to explore the plethora of opportunities and the possibility for much more advanced testing. If you have built and API and want to test it, go ahead! If you just want to explore the possibilities, use one of the public APIs available to expand your horizons!

Creating a multiplication Skill in Alexa using python

Written By Jyotsna Rajaraman

Hi! I'm Jyotsna, an electronics and communication undergrad who likes reading, writing, talking and learning. So when it comes to teaching, all my favorite things come together! I hope my articles have helped and taught you something. 🙂

RELATED POSTS

What is Edge Intelligence: Architecture and Use Cases

What is Edge Intelligence: Architecture and Use Cases

Introduction With the latest advancements in AI technologies, we have noticed a significant increase in the deployment of AI-based applications and services in recent years. More recently, with the booming IoT industry in particular, billions of mobiles and IoT...

Apache Kafka vs Apache Spark : All you need to know

Apache Kafka vs Apache Spark : All you need to know

Introduction Due to the increase in the volume of data, the demand for Stream processing is on the rise. Just processing the data wouldn't be enough, it should be done quickly too so that organizations can react to changing market conditions on a real-time basis. This...

Creating a Multiplication Skill in Alexa using Python

Creating a Multiplication Skill in Alexa using Python

Introduction In this tutorial, we will be focusing on how to create a custom multiplication skill in Alexa using Python. If you're completely new to Alexa skills, you can get a brief idea about it by clicking here. Subsequently, we have posted regarding account...

Creating a Hello World Skill in Alexa using Python

Creating a Hello World Skill in Alexa using Python

Introduction In this tutorial, we will be focusing on how to create a Hello World Skill in Alexa Developer Console. This is the most basic skill, and it would give us an idea about Skill-building using Alexa's developer console. If you're completely new to Alexa, you...

Creating a custom Date-Time skill in Alexa using Python

Creating a custom Date-Time skill in Alexa using Python

Introduction In this tutorial, we will look at how to create a simple date-time skill in Alexa using Python. For this skill, the only prerequisites required are an Alexa developer account and some basic understanding of Python. Also, we have created a post on how to...

All you need to know about Amazon Alexa Skills

All you need to know about Amazon Alexa Skills

Introduction In this tutorial, we will be taking a quick look at Amazon Alexa Skills. So, let us get started with the most common question - What Is Amazon Alexa? Alexa is nothing but a cloud-based voice service provided by the tech giant Amazon. In today's world,...

Wi-Fi HaLow: IEEE 802.11ah Wireless Networking Protocol

Wi-Fi HaLow (pronounced "HEY-Low") is an IEEE 802.11ah wireless networking protocol. It was released in 2017 as an update to the IEEE 802.11-2007 wireless networking standard. It uses 900 MHz, license-exempt bands, to provide extended range Wi-Fi networks, as opposed...

What is IoT Cisco Virtualized Packet Core (VPC)?

What is IoT Cisco Virtualized Packet Core (VPC)?

In this article, we will discuss about what is Cisco Virtualized Packet Core (VPC), How it supports IOT. Finally, we discus about its use cases. What is Virtualized Packet Core (VPC)? Virtualized Packet Core (VPC) is a technology providing all services for 4G, 3G, 2G,...

10 Best FTP clients for Windows and MAC users

10 Best FTP clients for Windows and MAC users

FTP is the abbreviation for File Transfer Protocol. Its a commonly used protocol to exchange files over any network. FTP clients are specifically designed software to transfer files between PC and servers over the internet. When a file is being transferred from one...

What is DNS and How does it work?

What is DNS and How does it work?

The Internet is just a network of 'n' computers that can communicate over various communication channels. Now, anything you do on the Internet is only an exchange of information(through files, scripts, etc.) So for the exchange to happen, you need to locate the other...

VIDEOS – FOLLOW US ON YOUTUBE

EXPLORE OUR IOT PROJECTS

IoT Smart Gardening System – ESP8266, MQTT, Adafruit IO

Gardening is always a very calming pastime. However, our gardens' plants may not always receive the care they require due to our active lifestyles. What if we could remotely keep an eye on their health and provide them with the attention they require? In this article,...

How to Simulate IoT projects using Cisco Packet Tracer

In this tutorial, let's learn how to simulate the IoT project using the Cisco packet tracer. As an example, we shall build a simple Home Automation project to control and monitor devices. Introduction Firstly, let's quickly look at the overview of the software. Packet...

All you need to know about integrating NodeMCU with Ubidots over MQTT

In this tutorial, let's discuss Integrating NodeMCU and Ubidots IoT platform. As an illustration, we shall interface the DHT11 sensor to monitor temperature and Humidity. Additionally, an led bulb is controlled using the dashboard. Besides, the implementation will be...

All you need to know about integrating NodeMCU with Ubidots over Https

In this tutorial, let's discuss Integrating NodeMCU and Ubidots IoT platform. As an illustration, we shall interface the DHT11 sensor to monitor temperature and Humidity. Additionally, an led bulb is controlled using the dashboard. Besides, the implementation will be...

How to design a Wireless Blind Stick using nRF24L01 Module?

Introduction Let's learn to design a low-cost wireless blind stick using the nRF24L01 transceiver module. So the complete project is divided into the transmitter part and receiver part. Thus, the Transmitter part consists of an Arduino Nano microcontroller, ultrasonic...

Sending Temperature data to ThingSpeak Cloud and Visualize

In this article, we are going to learn “How to send temperature data to ThingSpeak Cloud?”. We can then visualize the temperature data uploaded to ThingSpeak Cloud anywhere in the world. But "What is ThingSpeak?” ThingSpeak is an open-source IoT platform that allows...

Amaze your friend with latest tricks of Raspberry Pi and Firebase

Introduction to our Raspberry Pi and Firebase trick Let me introduce you to the latest trick of Raspberry Pi and Firebase we'll be using to fool them. It begins with a small circuit to connect a temperature sensor and an Infrared sensor with Raspberry Pi. The circuit...

How to implement Machine Learning on IoT based Data?

Introduction The industrial scope for the convergence of the Internet of Things(IoT) and Machine learning(ML) is wide and informative. IoT renders an enormous amount of data from various sensors. On the other hand, ML opens up insight hidden in the acquired data....

Smart Display Board based on IoT and Google Firebase

Introduction In this tutorial, we are going to build a Smart Display Board based on IoT and Google Firebase by using NodeMCU8266 (or you can even use NodeMCU32) and LCD. Generally, in shops, hotels, offices, railway stations, notice/ display boards are used. They are...

Smart Gardening System – GO GREEN Project

Automation of farm activities can transform agricultural domain from being manual into a dynamic field to yield higher production with less human intervention. The project Green is developed to manage farms using modern information and communication technologies....