How to pass parameters by POST to an Azure function?

前端 未结 9 1974
暗喜
暗喜 2020-12-24 05:27

I\'m trying to do a simple Azure Function to learn about it. There will be 3 functions:

  • 1 function to insert a row into a table of a database. This table will
9条回答
  •  情话喂你
    2020-12-24 06:32

    If you are using System.Text.Json, you can read the POST data in one line:

    public static async Task Run(
        [HttpTrigger(AuthorizationLevel.Function, "post", Route = null)]
        HttpRequest req,
        ILogger log)
    {
        MyClass myClass = await JsonSerializer.DeserializeAsync(req.Body);
    }
    

    If you are using Newtonsoft.Json, see the answer by Allen Zhang.

提交回复
热议问题