How to invoke the WepApi Controller Action in browser URL, Below is the Action Method in APIController.
public virtual HttpResponseMessage Export(string ABC, string product, string Release, bool includeInheritedData = false)
{
}
How to invoke the WepApi Controller Action in browser URL, Below is the Action Method in APIController.
public virtual HttpResponseMessage Export(string ABC, string product, string Release, bool includeInheritedData = false)
{
}
you can define route path and name for web api methods. Using that route can access a API controller action if it is simple Get call and has Anonymous access.
For example:
Suppose this a method in your API controller:
[HttpGet,AllowAnonymous][Route("api/register")]
public void Register()
{
}
You can access it in the URL like: localhost/api/register from browser.This is a simple example to explain thing in simple terms. There are lot of other things involved accessing API methods depending upon various factors like security, requirements etc.
Already its predefined in Appstart/WebApiConfig.cs for WebApi controllers they were using like below.
config.Routes.MapHttpRoute("DefaultApiWithId", "Api/{controller}/{id}", new { id = RouteParameter.Optional }, new { id = @"\d+" });
config.Routes.MapHttpRoute("DefaultApiWithAction", "Api/{controller}/{action}");
config.Routes.MapHttpRoute("DefaultApiGet", "Api/{controller}", new { action = "Get" }, new { httpMethod = new HttpMethodConstraint(HttpMethod.Get) });
config.Routes.MapHttpRoute("DefaultApiPost", "Api/{controller}", new { action = "Post" }, new { httpMethod = new HttpMethodConstraint(HttpMethod.Post) });