I have below code and below Json Sample is returened in requestBody. I would like to check if my requestBody contains key ComputerModel or not, and if it contains I would like to get that value. How can I do that?
Json response I get in quick watch:(requestBody)
{
"id": "Test",
"Type": "Test",
"ComputerModel": "Testings"
"Properties": {
"Access": "CUSTOMER"
}
}
C# code:
public static async Task<IActionResult> Run(
[HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)]
HttpRequest req, ILogger log)
{
string requestBody = await new StreamReader(req.Body).ReadToEndAsync();
string computermodel= req.Query["ComputerModel"]; // I don't get anything here
string responseMessage = string.IsNullOrEmpty(Computermodel)
? "This HTTP triggered function executed successfully. Pass a name in the query string or in the request body for a personalized response."
: $"Hello, {name}. This HTTP triggered function executed successfully.";
return new OkObjectResult(responseMessage);
}