I\'m creating an API using C# and ASP.NET Web API and I want it to return an error when a parameter is used that isn\'t recognised.
For example:
/api/Eve
I think you should be override methods
Example:
[Route("/app/Events/{startTime})"]
public ApiResponse Get(string startTime)
{
}
[Route("/app/Events/{startTime}/{someRandomeInvalid}")]
public ApiResponse Get(string startTime, string someRandomeInvalid)
{
}
Don't set explicit parameters name. You should be manage/check by order of parameter