How can I test my asp.net web API method?

asp.net-web-api, asp.net-web-api2

Solution

UPDATE 2022: It's 2022 now. A lot has changed. There are plenty of clients out there. I will list my favourites.

Postman - Postman has improved since I answered this in 2014. Apart from being a client, it has other features like collaboration, scripting, importing endpoints from various sources like Open API etc. Pretty simple to use.

Thunder Client - A Visual Studio extension that has a similar feel as Postman but a pure API client.

For testing the api, you can use fiddler(http://www.telerik.com/fiddler) or a chrome app called postman.

You should also try the POSTMAN by http://www.getpostman.com/ which can be added to chrome as an app. It really good and lets you organize your apis.

Problem

I have a web api method: ``` [HttpPost, ActionName("GET")] public string Get(string apiKey, DateTime start, DateTime end) { var user = db.Users.SingleOrDefault(u => u.Id == apiKey); if (user == null) { return string.Empty; } var records = db.Histories.Where(h => h.Date >= start && h.Date <= end); return JsonConvert.SerializeObject(records); } ``` And here is the url I tried to call the method, but it doesn't reach to the method. ``` http://localhost:11847/api/History/Get?apiKey=398cfa9b-8c5c-4cf4-b4f3-8904a827ff22&start=2014-01-01&end=2014-12-01 ``` I also have changed the WebApiConfig.cs ``` config.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{action}", defaults: new { id = RouteParameter.Optional } ); ``` from "api/{controller}/{id} to "api/{controller}/{action}

Original source