HTTP Body
{
"name": "John Doe"
}
Code
#r "Newtonsoft.Json"
using System.Net;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Primitives;
using Newtonsoft.Json;
public static async Task<IActionResult> Run(HttpRequest req, ILogger log)
{
string name = "";
string requestBody = await new StreamReader(req.Body).ReadToEndAsync();
dynamic data = JsonConvert.DeserializeObject(requestBody);
name = data.name;
string responseMessage = "Hello, " + name;
return new OkObjectResult(responseMessage);
}
Result (HTTP POST)
Hello, John Doe
Comments