is there a way to set optional query parameters in Azure Functions? The parameter should not be set as route parameter. To get the query parameters i use following code snipped
IDictionary<string, string> queryParams = req.GetQueryParameterDictionary();
Methode signature is following:
public async Task<IActionResult> Function(
[HttpTrigger(AuthorizationLevel.Function, "post", Route = null)] HttpRequest req,
[DurableClient] IDurableOrchestrationClient starter
)
If you don't want to set it as the route parameter, you can use like below:
string param = req.Query["param"];
if (string.IsNullOrEmpty(param)) {
//do nothing.
} else {
//do something.
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With