A Beginners Guide to Testing a Web API/Service with Postman


API stands for Application Programming Interface and it is defined by a set of rules that contains different methods of communication between software components to interact with each other. We created an API from scratch in this post, and we’ll now test its execution with Postman.

To thoroughly test an API, we need to access its endpoints and one of the better ways of doing that is by using a web client such as Postman, a standalone tool that’s able to make HTTP requests from outside the service.

When using Postman, there’s no need to write any HTTP code, we can interact with our API through test suites called collections and make simple execution commands.

In this tutorial, we’ll cover the following topics :

  • Installing Postman
  • Setting up the environment to test our API
  • Creating a series of semi-automated HTTP requests tests called collections
  • Running single HTTP requests

You’ll need :

  • An Web API/Service to test, you can see how to develop one with Spring Boot by clicking here
  • Postman client

Getting started

First thing we need to do is install Postman in our Linux, Mac or Windows computer.

If you’re using Linux, this can be done easily by enabling snapd with the following commands in your shell :

sudo apt update
sudo apt install snapd
sudo snap install postman

You can also download Postman directly from its website.

The following user interface is what you should expect to see when opening Postman for the first time :

Postman initial user interface

Creating a Postman Collection with HTTP requests

We can think of a collection as a series of requests that will be saved and executed by Postman.

Creating a new collection for our API should be simple, we can do that by clicking the Create a collection button in the left corner.

Creating a New Collection

Once our collection is created, the next step should be adding our personalized requests.

The API we developed supports the following endpoints, so we should create a HTTP request for each of them :

  • Create : Create a new user with the POST method in /users
  • Detail : List a specific user with the GET method in /users/{id}
  • List : List all users with the GET method in /users
  • Update : Update an existing user with the PUT method in /users/{id}
  • Delete : Remove an existing user with the DELETE method in /users/{id}

Be sure to enter our request method URL for each endpoint and use the dropdown menu to change the standard GET method to the method of choice.

Delete endpoint with its appropriate URL and request method

Providing a message body for the POST and PUT methods

When creating or updating an user, we need to provide a message body specifying the fields we want to create or change.

Since our API deals with JSON data, we need to provide it with JSON content type.

Below the URL address, there’s a row of tab headers. To specify our message body, we’ll click the Body tab to get to the body editor.

In the Body tab, there’s a row of buttons that control the formatting and content type of the request, select the raw option and in the dropdown menu to the right, apply the JSON content type.

Once all our options are set, we should add our JSON content to the message body :

"name": "Fourth"
Create endpoint with the POST method

We can assert that the POST request was successful by checking the HTTP response status : 201 Created.

As for our PUT method, we’ll follow the same exact steps and add to the message body of our user with id 1 :

"id" : 1,
"name": "Neo UPDATED"
Update endpoint with the PUT method

Running single requests with the GET or DELETE method

When running single GET or DELETE requests, we don’t need to specify a message body.

All we need to do is click the Send button to the right of the URL address.

List all users endpoint with the GET method
Delete user endpoint with the DELETE method

Once again, by checking our HTTP response status, we can assert that our request was successful.


By completing this tutorial, you can now verify the execution of all sorts of endpoints with the Postman client.

This comes in handy when working with an API/Web service.

Source code

There isn’t any source code available for this tutorial, but you can check the source code of our API here.

Thanks for reading !! Feel free to leave any comment.

About the author

Website | + Posts

Software Consultant with more than 11 years experience, most of that in Finance area. I love building things and see them running and making a difference.

Specialised in Golang (2 years), Java (11 years), Javascript, React and Angular (1 year), PHP (2 years), project management and delivery leading (2 years), mentoring and coaching (1 year).

Website | + Posts

Electrical engineering student from Brazil passionate about learning and teaching people.

Had some professional and academic engineering experiences, now my focus is on studying and developing software as a full time job.

Leave a Reply

Your email address will not be published. Required fields are marked *