(C# ASP.NET Core) Using Postman to Run WebApi

Postman is a software that can be used to easily and conveniently run and execute web api. It can be installed as a desktop application. The software offers a lot of functionality, but we shall be using a small part of that - relevant to just our web api needs.

Categories | About |     |  


Where to get this software

Visit https://www.postman.com/ and download the software. As far as I understand, the software can be downloaded and used free of cost for small, testing purposes at individual level. I was able to download it without the need of signing up for their account.

Install the software and get the shortcut on your desktop. Double click and open the Postman window.

Video Explanation (see it happen!)

Please watch the following youtube video:

A very small introduction

The window seems too complex and full of features.

There is a drop down that allows you to choose the type of request. In this chapter we have done only the GET type of API so far. So choose the request as GET.

There is a textbox adjacent to the dropdown. We have to enter a target URL in this textbox. Let us type https://microsoft.com.

Just below this there are various options for sending data to the server. We can add query string name-value parameters. We can specify request headers. We can specify data to be sent as the body of the request. You can examine all these possibilities yourself. I will take them on need basis, for example, I will use this part when I will be testing a POST type of web api.

For now, we have no data to send. So hit the Send button to send a GET request to the home page of this URL.

As soon as the request completes, we can see various items of response data. For example, body of the response contains the html received from the server.

Then we have cookies, headers and other things.

After this brief introduction, let us test our own web api now!

Testing our own WebApi with Postman

Open the project and run it in a browser so that we can obtain the URL. Ensure that an API gives a response. In our case our API is GET /doctor/1. This API returns a json string for a record of id = 1.

Copy this URL and paste it in the Postman window.

We have no data to send, so hit the Send button.

We observe that we receive a json response immediately.

This is how we can use Postman to test a WebApi. Please note that this software is more helpful for testing requests such as a POST request, something that is the topic of our next tutorial - thanks!

This Blog Post/Article "(C# ASP.NET Core) Using Postman to Run WebApi" by Parveen is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.