ASP.NET Web API-Postman


In the previous tutorial, we have discussed ASP.NET Web API-Testing Tools. Here, in this tutorial, I try to explain how to use POSTMAN to test web API.

Web API - Postman Testing Tool

Postman is an API (application programming interface) testing tool that aids in the sending requests, setting up test data, and validating responses of APIs. This utility has almost all of the features that any developer might require. Every month, over 5 million developers utilize it to make API development straightforward and simple. It supports various HTTP methods, authentication methods, and data formats like JSON and XML etc.

In the previous article, we have created ASP.NET Web API. we will call that API using testing Postman tool.

ASP.NET Web API - Start

Let’s see how to use POSTMAN tool to send an HTTP request to our local ASP.NET Web API Services and check the response.

Step 1: Download and install Postman from Chrome Postman

ASP.NET web API Testing tool Postman

Step 2: Once the Postman is successfully installed or added in your browser, Now open the Postman. It will look like the image displayed below.

ASP.NET web API Testing tool Postman

GET Request using Postman

Select the HTTP Method as GET and enter the URL of your Web API as displayed in the below image.

ASP.NET web API Testing tool Postman

Once you click on the Send button, an HTTP request is sent to the provided URL. The response coming from the Web API Server is displayed in the below image.

ASP.NET web API Testing tool Postman

As you can see in the above image, the HTTP response shows data and response status. Thus, you can also use Postman to test your Web API.

POST Request using Postman

  1. Select the HTTP verb as POST in Postman
  2. Set the URL in URL Secction to get response
  3. Set the Content - Type as application/json.

To do this click on the Header tab and provide the key value as shown in the below image.

ASP.NET web API Testing tool Postman

Next, we need to provide String values must be included in the request body. To do so, go to the body tab and enter the string value displayed below.

ASP.NET web API Testing tool Postman

Once you provided the string value in the request body, click on the send button which will issue a post request to the web API. similarly, you can test the PUT and DELETE verbs Requests also.


Next

Top Articles

  1. Why use C#
  2. How to use comment in C#
  3. How to use variables in C#
  4. How to use keywords in C#