Thursday, September 26, 2013

Web API Test Client

In this post I'm using a nuget package called "Simple Test Client For ASP.Net Web API". Using that we can easily test our web API resources.

First create a project using ASP.Net MVC Web API template. Add a class called Student.
Add StudentApiController like below.
Using nuget add WebApiTestClient package.
Open Api.chtml file which located in below location.
Edit file and add content highlighted in below image.
Run the web application and browse to help page. Click any of the API link. In bottom right corner you'll see the button called "Test API". When you clicked it using the opened dialog you can test your APIs very easily.
You can find the source code of this in GitHub.

No comments:

Post a Comment