• Home
  • About
  • Contact
  • ado.net
  • angular
  • c#.net
  • design patterns
  • linq
  • mvc
  • .net core
    • .Net Core MVC
    • Blazor Tutorials
  • sql
  • web api
  • dotnet
    • SOLID Principles
    • Entity Framework
    • C#.NET Programs and Algorithms
  • Others
    • C# Interview Questions
    • SQL Server Questions
    • ASP.NET Questions
    • MVC Questions
    • Web API Questions
    • .Net Core Questions
    • Data Structures and Algorithms

Friday, April 17, 2020

How to use POSTMAN to test Web API

 Admin     April 17, 2020     .Net, Web API     No comments   

In this article, I am going to discuss how to use POSTMAN to test Web API Services with examples. We are going to work with the same example that we created in our Creating first web API application article, so please read that article before proceeding with this article.

What is POSTMAN?
The Postman is the most popular and the most powerful HTTP client for testing the restful web services. Postman makes it easy to test the Restful Web APIs, as well as it develops and documents Restful APIs by allowing the users to quickly put together both simple and complex HTTP requests. The Postman is available as both a Google Chrome in-browser app and Google Chrome Packaged App.

The packaged app version of Postman provides many advanced features that include OAuth 2.0 support and bulk uploading/importing that are not available with the Google Chrome in-browser app version. The in-browser version includes a few features, such as session cookies support, that are not yet available in the packaged app version.

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

Step 1: Download and install POSTMAN from Postman

Step 2: Once the Postman is successfully installed, open the Postman. It will look like the image shown below.

How to use POSTMAN to test Web API Services
Postman UI

GET Request using Postman:
Select the HTTP Method as “GET” and enter the URL of your Web API as shown in the below image.

Preparing GET Request using Postman
Preparing GET Request using 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.
Reponse of Web API using Postman
Reponse of Web API

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:
  • Choose the HTTP verb as POST
  • Set the URL
  • 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
POST Request using Postman
POST Request using Postman

Next, we need to provide the string value that we want to add to the string array. We need to provide string value in the request body. To do so click on the body tab and provide the string value as shown below.

POST Request using 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. In the same way, you can test the PUT and DELETE Requests. In this article series, we are going to use the tool Fiddler and Postman to test the services.

Summary:
I Hope this post will be helpful to understand how to test your Web APIs using Postman.
Please share this post with your friends and colleagues.
For any queries please post a comment below.
Happy Coding 😉
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Newer Post Older Post

0 comments:

Post a Comment

If you like this website, please share with your friends on Facebook, Twitter, LinkedIn.

Join us on Telegram

Loved Our Blog Posts? Subscribe To Get Updates Directly To Your Inbox

Like us on Facebook

Popular Posts

  • What is Dependency Injection(DI)
    Hi friends! Today we are going to learn about Dependency Injection and in our last session we have come across Static classes and where it s...
  • C# Programming Examples on Sorting
    Today i am going to tell you some of the Sorting programming questions in C#. Q1- Write a C# program to perform Selection sort. Ans:  Sel...
  • Calling Web API Service in a Cross-Domain Using jQuery AJAX
    In this article, I am going to discuss Calling Web API Service in a Cross-Domain Using jQuery AJAX . Please read our previous article befor...
  • ViewBag in ASP.NET Core MVC
    In this article, I am going to discuss the use of ViewBag in ASP.NET Core MVC application with examples. Please read our previous article ...
  • Recursion And Back Tracking
    In this article, I am going to discuss Recursion And BackTracking in detail. Please read our previous article where we discussed Master Th...
  • What is Abstract Class and When we should use Abstract Class
    Hi friends! In our previous sessions we have seen  Difference Between Class and Struct . And in our last session  we learnt Usability of Sec...
  • Binary to Decimal Conversion in C# with Examples
    In this article, I am going to discuss the Binary to Decimal Conversion in C# with some examples. Please read our previous article where w...

Blog Archive

Contact Form

Name

Email *

Message *

Tags

.Net .Net Core .Net Core MVC Algorithm Angular Anonymous Types Asp.Net Asp.Net MVC Blazor C# Data Structure Database Design Patterns Entity Framework Entity Framework Core Filters Interview Question Management Studio Programming Programs SQL Server SSMS Web API

Copyright © C# Techtics | All Right Reserved.

Protected by Copyscape