how to post arbitrary json object to webapi

You can have your post method that takes in a HttpRequestMessage to by pass the model binding logic and you can read the content of the request directly:

    public HttpResponseMessage Post(HttpRequestMessage req)
    {
        var data = req.Content.ReadAsStringAsync().Result; // using .Result here for simplicity...
        ...

    }

By the way, the reason why the action that takes in JObject doesn’t work is because of ‘ObjectId(“…”)’ that is used as the value of “_id” in your data…

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)