I have a method which conducts a search based on 3 criteria:
- Author
- Title
- Keywords
The API method I have created for this search currently looks like this:
[Route("A={author};T={title};K={keywords}")]
[ResponseType(typeof(bool))]
public HttpResponseMessage Get(string author, string title, string keywords)
{
//Code for search
}
The method works perfectly fine when all 3 parameters are passed. However, if I were to simply just enter an author and not title or keywords, I receive a Not Found
error.
Is there a way I can modify the route to allow for when 1 or more parameters are null/empty strings?