I'm trying to send a JSON to my rest-api using RestSharp. Essentially I've created a model class for the json:
public class LogPostData
{
    public string LogMessage { get; set; }
    public string LogStackTrace { get; set; }
    public string LogUserId { get; set; }
    public string LogUserIp { get; set; }
}
so I perform the request in this way:
 var logPost = new LogPostData();
     logPost.LogMessage = "log message"
     logPost.LogStackTrace = "some content";
 var post = JsonConvert.SerializeObject(logPost);
 var client = new RestClient("url of rest api");
 var request = new RestRequest("methodApi", Method.PUT);
     request.RequestFormat = DataFormat.Json;
     request.AddParameter("application/json; charset=utf-8", post, ParameterType.RequestBody);
     request.RequestFormat = DataFormat.Json;
 var response = client.Execute(request);
as you can see I've created the object LogPostData and then serialized it using JsonConvert.SerializeObject.
I called the methodApi passing as parameter the json.
Now, inside my rest api, I did the following:
file_put_contents('debug.txt', serialize($_POST));
the content should be the variable that I sended with RestSharp on post variable, instead I get: a:0:{}
why my $_POST variable is empty?
 
     
    