Q:

Get the POST data back on Web API

I have a Web API server that runs in c#. The httpget methods works perfectly, but I am too new to Web Api to get the post to work, and my searches that I've done is a bit fruitless.
This is my HttpPost in the ApiController
    [HttpPost]
    public bool UploadLogs(UploadLogsIn logs)
    {
        return true;
    }

This is the model
public class UploadLogsIn
{
    public byte[] logData { get; set; }
    public int aLogs { get; set; }
}

In a c++ Application I try to post data to this method. I'm using Curl to do the post
    CURL *curl;
    CURLcode res;

    curl = curl_easy_init();
    if (curl)
    {
        curl_easy_setopt(curl, CURLOPT_URL, "http://192.168.56.109:9615/api/WebApiService/UploadLogs");
        curl_easy_setopt(curl, CURLOPT_POSTFIELDS, R"({"UploadLogsIn": [{"aLogs: 10}]})");
        curl_easy_setopt(curl, CURLOPT_POST, 1L);
        curl_easy_setopt(curl, CURLOPT_TIMEOUT, 20);
        curl_easy_perform(curl);
    }

    curl_easy_cleanup(curl);

When I debug the Web Api, the method gets hit, but the parameter does not contain any data. 
UPDATE
With wireshark, this is the information that is sent
POST /api/WebApiService/UploadLogs HTTP/1.1
Host: 192.168.56.109:9615
Accept: */*
Content-Length: 32
Content-Type: application/x-www-form-urlencoded

Form item: "{"UploadLogsIn": [{"aLogs: 10}]}" = ""

END UPDATE
If I add a header 
        struct curl_slist *headers = NULL;
        headers = curl_slist_append(headers, "Accept: application/json");
        headers = curl_slist_append(headers, "Content-Type: application/json");
        headers = curl_slist_append(headers, "charsets: utf-8");

then my parameter is null.
The Wireshark dump for this is
POST /api/WebApiService/UploadLogs HTTP/1.1
Host: 192.168.56.109:9615
Accept: application/json
Content-Type: application/json
charsets: utf-8
Content-Length: 32

Line-based text data: application/json
{"UploadLogsIn": [{"aLogs: 10}]}

I'm sure there is something dumb that I do not do right. Any help will be appreciated

A:

There is a mismatch between the class you want and the data being sent.
Your desired class looks like this
public class UploadLogsIn {
    public byte[] logData { get; set; }
    public int aLogs { get; set; }
}

But the data being sent looks like this
{"UploadLogsIn": [{"aLogs": 10}]}

Which when deserialized looks like this
public class UploadLogsIn
{
    public int aLogs { get; set; }
}

public class RootObject
{
    public IList<UploadLogsIn> UploadLogsIn { get; set; }
}

See the difference?
To get the model to bind to this action
[HttpPost]
public bool UploadLogs([FromBody]UploadLogsIn logs) {
    return true;
}

The data sent would have to look like this
{"aLogs": 10}

