How To Test API Web Service In ASP.NET Core 5 Using Postman

Introduction

 
In this article, I will cover the complete procedure of how to test web API Service using Postman. It is the simplest and most beautiful way to test and document your web service. Postman is a collaboration platform for API development. Postman's functions simplify every step of building an API and streamline collaboration so you can create better APIs—quicker.
 
How To Test API Web Service In ASP.NET Core 5 Using Postman
 

How to Test API Web Service in Asp Net Core 5 Using Postman

 
In Postman for API Testing, the professional approach is to make the collection for API Requests for collecting the responses like getting PUT POST AND DELETE Request Response. Open the postman Click on Create Collection.
 
How To Test API Web Service In ASP.NET Core 5 Using Postman
 
Name the Collection in Postman.
 
How To Test API Web Service In ASP.NET Core 5 Using Postman
 
Now the collection is ready for collecting the API Request Response.
 
How To Test API Web Service In ASP.NET Core 5 Using Postman
 
Add the API Request Responses Like PUT,POST, DELETE AND GET,
 
How To Test API Web Service In ASP.NET Core 5 Using Postman
 
We are going to test the following use case for this article. In this article I am going to test the POST, GET, PUT, DELETE, AND UPDATE, Endpoints of Web Service.
 
How To Test API Web Service In ASP.NET Core 5 Using Postman
 
Here in this example, we are going to test the Web Service using Postman Developed using the Asp.Net Core 5 Web API
 
How To Test API Web Service In ASP.NET Core 5 Using Postman
 

Test POST Call in Postman

 
Here we are going to send the JSON object with the Following Properties
  1. {  
  2.     "id": 0,  
  3.     "userName""string",  
  4.     "userPassword""string",  
  5.     "userEmail""string",  
  6.     "createdOn""2021-04-16T20:38:41.062Z",  
  7.     "isDeleted"true  
  8. }  
How To Test API Web Service In ASP.NET Core 5 Using Postman
 
Now Click on Raw and then Select the JSON.
 
How To Test API Web Service In ASP.NET Core 5 Using Postman
 
If we want to Create the New Person in the Database, we must send the JSON Object to the End Point then the data is posted by Postman UI to POST End Point in the Controller then Create Person Object Creates the Complete Person Object in the Database.
 
How To Test API Web Service In ASP.NET Core 5 Using Postman
 
Now you can see that our API gives us the server response == true so it indicates that a new record has been created in the database against our JSON Object that we have sent using Postman.
 

Test DELETE Call in Postman

 
For Deletion of Person, we have a separate End Point Delete Employee from the Database, we must send the JSON Object to the End Point then data is posted by Postman UI to call the End Point DELETE Person in the Controller then Person Object will be deleted from the Database.
 
In Deletion of the record just select body and the select, the form data pass the id value for the record you want to delete from the database.
 
How To Test API Web Service In ASP.NET Core 5 Using Postman
 
We are going to delete the record against the given email if the API server response equal to true then our record deleted from the database successfully.
 
How To Test API Web Service In ASP.NET Core 5 Using Postman
 
In the above two pictures, you can see that after hitting the Delete Endpoint our server response is true it indicates that our record has been deleted from the database against our desired Email.
 

Test GET Call in Postman

 
If we want to get the record of all the personal data from the database, we will hit the GET endpoint in our Web Service using Postman after the completion of the server request all the data will be given to us by our GETAllPerson Endpoint.
 
How To Test API Web Service In ASP.NET Core 5 Using Postman
 
Hit the GET Endpoint for getting all records from the database.
 
How To Test API Web Service In ASP.NET Core 5 Using Postman
 
After the successful execution of Web service, all the record is visible to us in the form of a JSON object in the database we have Only One Record so that
 

Test PUT Call in Postman

 
In put-call, we are going to update the record in the database. We have Separate End Points for All the operations like Update the Record of the Person by User Email from the Database by Hitting the UPDATE End Point that send the request to controller and in controller we have the separate End Point for Updating the record based on User Email from the database.
 
We are going to update the given below JSON Object in the database,
  1. {  
  2.     "id": 0,  
  3.     "userName""Mudassar Ali Khan",  
  4.     "userPassword""17859345@",  
  5.     "userEmail""mudassarali.official@gmail.com",  
  6.     "createdOn""2021-04-16T20:41:15.443Z",  
  7.     "isDeleted"false  
  8. }  
To given below JSON Object
  1. {  
  2.     "id": 0,  
  3.     "userName""Sardar Mudassar Ali Khan",  
  4.     "userPassword""17859345@",  
  5.     "userEmail""mudassarali.official@gmail.com",  
  6.     "createdOn""2021-04-16T20:41:15.443Z",  
  7.     "isDeleted"false  
  8. }  
How To Test API Web Service In ASP.NET Core 5 Using Postman
 
We have sent the API JSON Response to the PUT Endpoint for Updating the Record in the database
 
How To Test API Web Service In ASP.NET Core 5 Using Postman
 
After the successful submission of data, you can see that our server response is true it indicates that our data has been successfully submitted in the database
 
How To Test API Web Service In ASP.NET Core 5 Using Postman
 

Conclusion

 
As a Software Engineer, my Conclusion about the Postman is that it  the best Open API for Testing the RESTful API. As a Developer I have had a great experience with Postman for testing the restful API sending the Complete JSON Object and then getting the response in a professional way. It is easy to implement in Asp.net core Web API Projects and after the configuration Developers can enjoy the beauty of Postman Open API.