0
I have a question on how to leave optional parameters in the method call in the API.
I have the following method:
[HttpGet("{aplicativoId}/{moduloId}/{taxaId}/{musicaId}/{produtoId}")]
[ProducesResponseType(typeof(IEnumerable<AppDto>), (int)HttpStatusCode.OK)]
public async Task<ActionResult<IEnumerable<AppDto>>> GetAsync()
{
var apps = await _testHandler.GetAsync(aplicativoId);
return Ok(apps);
}
How do I make them all optional? In case, if I pass the 5 values, the method bring the get of the 5 values, if I pass 4 bring only until the musicaId, if pass 3 only until the taxaId and so successively, has some form ?
but this way when executing via Swagger will not appear the optional fields for the person pssar value or not to test the api
– Desalex
If I pass everything on Getasync they are all as optional, the first 2 are mandatory
– Desalex