Changing the parameter name Web Api model binding

You can use the Name property of the FromUri binding attribute to use query string parameters with different names to the method arguments.

If you pass simple parameters rather than your QueryParameters type, you can bind the values like this:

/api/values/5?cap=somecap&id=1

public IHttpActionResult GetValue([FromUri(Name = "cap")] string capabilities, int id)    
{
}

Leave a Comment