I have a single controller with two actions. Each action takes a GUID parameter. My request URL looks like this: http://baseURL/api/v1.0/loadfactors/search?cedentId=5FF7165C-7575-EA11-AA4D-949554C02DE1
This is how my actions look like:
[HttpGet("search")]
[ProducesResponseType(StatusCodes.Status200OK)]
public async Task<List<LoadFactorResource>> GetByLobSettingsId([FromQuery]Guid lobSettingsId)
{
return await _service.GetByLobSettingsId(lobSettingsId);
}
[HttpGet,Route("search")]
[ProducesResponseType(StatusCodes.Status200OK)]
public async Task<List<LoadFactorResource>> GetByAccountId([FromQuery]Guid cedentId)
{
return await _service.GetByCedentId(cedentId);
}
Now when I make a request, this is the error I get:
An unhandled exception occurred while processing the request. AmbiguousMatchException: The request matched multiple endpoints. Matches:
LoadFactorsController.GetByLobSettingsId (Api) LoadFactorsController.GetByAccountId (Api)
It seems it is finding multiple actions and not identifying action based on the query parameter. How do I make so it matches based on the parameter?
Thanks.